aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_drm2/ecore_drm2_device.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-08-03 14:56:19 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-08-09 14:56:58 -0500
commitd8a9b895bb3c3e70c4b56441c0c34b981381a8d0 (patch)
tree7d14273fb4af8ab7d53f8369e54fe85a3fac4311 /src/lib/ecore_drm2/ecore_drm2_device.c
parentecore_drm2: Remove connector bitfield (diff)
downloadefl-d8a9b895bb3c3e70c4b56441c0c34b981381a8d0.tar.gz
ecore_drm2: Merge ecore_drm2_device_find and ecore_drm2_device_open
There's never a reason to find a device and not open it, so all callers end up calling these two functions back to back.
Diffstat (limited to 'src/lib/ecore_drm2/ecore_drm2_device.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index aa8917ce4e..42a21c0742 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -593,43 +593,29 @@ _drm2_atomic_state_free(Ecore_Drm2_Atomic_State *state)
}
EAPI Ecore_Drm2_Device *
-ecore_drm2_device_find(const char *seat, unsigned int tty)
+ecore_drm2_device_open(const char *seat, unsigned int tty)
{
- Ecore_Drm2_Device *dev;
+ Ecore_Drm2_Device *device;
- dev = calloc(1, sizeof(Ecore_Drm2_Device));
- if (!dev) return NULL;
+ device = calloc(1, sizeof(Ecore_Drm2_Device));
+ if (!device) return NULL;
- dev->em = elput_manager_connect(seat, tty);
- if (!dev->em)
+ device->em = elput_manager_connect(seat, tty);
+ if (!device->em)
{
ERR("Could not connect to input manager");
goto man_err;
}
- dev->path = _drm2_device_find(dev->em, seat);
- if (!dev->path)
+ device->path = _drm2_device_find(device->em, seat);
+ if (!device->path)
{
ERR("Could not find drm device on seat %s", seat);
goto path_err;
}
- return dev;
-
-path_err:
- elput_manager_disconnect(dev->em);
-man_err:
- free(dev);
- return NULL;
-}
-
-EAPI int
-ecore_drm2_device_open(Ecore_Drm2_Device *device)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1);
-
device->fd = elput_manager_open(device->em, device->path, -1);
- if (device->fd < 0) goto open_err;
+ if (device->fd < 0) goto path_err;
if (!elput_input_init(device->em))
{
@@ -681,12 +667,15 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
ecore_event_handler_add(ELPUT_EVENT_DEVICE_CHANGE,
_cb_device_change, device);
- return device->fd;
+ return device;
input_err:
elput_manager_close(device->em, device->fd);
-open_err:
- return -1;
+path_err:
+ elput_manager_disconnect(device->em);
+man_err:
+ free(device);
+ return NULL;
}
EAPI void