evdev: factor out closing a device into evdev_suspend()
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 30 Jan 2014 05:34:00 +0000 (15:34 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 18 Sep 2014 01:30:15 +0000 (11:30 +1000)
No functional changes, just prep work for an upcoming patch

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev.c
src/evdev.h

index 71c523675b28ea6eb997cf842f0cf04637823576..054beb637540e9da6e579d4a5e0048bb3bb5581f 100644 (file)
@@ -1165,8 +1165,8 @@ release_pressed_keys(struct evdev_device *device)
        }
 }
 
-void
-evdev_device_remove(struct evdev_device *device)
+int
+evdev_device_suspend(struct evdev_device *device)
 {
        if (device->source)
                libinput_remove_source(device->base.seat->libinput,
@@ -1178,6 +1178,15 @@ evdev_device_remove(struct evdev_device *device)
                mtdev_close_delete(device->mtdev);
        close_restricted(device->base.seat->libinput, device->fd);
        device->fd = -1;
+
+       return 0;
+}
+
+void
+evdev_device_remove(struct evdev_device *device)
+{
+       evdev_device_suspend(device);
+
        list_remove(&device->base.link);
 
        notify_removed_device(&device->base);
index 9de44bc8b7f08274b5139a0cbf8a48e7c24a00c6..ef02491cba54f3d7fe281e7a2d60a62b8fca2352 100644 (file)
@@ -186,6 +186,8 @@ double
 evdev_device_transform_y(struct evdev_device *device,
                         double y,
                         uint32_t height);
+int
+evdev_device_suspend(struct evdev_device *device);
 
 void
 evdev_keyboard_notify_key(struct evdev_device *device,