[PATCH libinput 6/6] touchpad: change the sanity check function to a bool

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 19 00:49:29 UTC 2016


And rename to make the return value more obvious

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 190448b..777914e 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2081,9 +2081,9 @@ out:
 		  device->devname);
 }
 
-static int
-tp_sanity_check(struct tp_dispatch *tp,
-		struct evdev_device *device)
+static bool
+tp_pass_sanity_check(struct tp_dispatch *tp,
+		     struct evdev_device *device)
 {
 	struct libevdev *evdev = device->evdev;
 	struct libinput *libinput = tp_libinput_context(tp);
@@ -2097,13 +2097,13 @@ tp_sanity_check(struct tp_dispatch *tp,
 	if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_FINGER))
 		goto error;
 
-	return 0;
+	return true;
 
 error:
 	log_bug_kernel(libinput,
 		       "device %s failed touchpad sanity checks\n",
 		       device->devname);
-	return -1;
+	return false;
 }
 
 static void
@@ -2183,8 +2183,8 @@ tp_init(struct tp_dispatch *tp,
 	tp->base.interface = &tp_interface;
 	tp->device = device;
 
-	if (tp_sanity_check(tp, device) != 0)
-		return -1;
+	if (!tp_pass_sanity_check(tp, device))
+		return false;
 
 	tp_init_default_resolution(tp, device);
 
-- 
2.7.4



More information about the wayland-devel mailing list