touchpad: change the sanity check function to a bool

And rename to make the return value more obvious

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
Peter Hutterer 2016-07-19 10:16:49 +10:00
parent bc84245ec3
commit a5066edaaf

View file

@ -2081,8 +2081,8 @@ out:
device->devname); device->devname);
} }
static int static bool
tp_sanity_check(struct tp_dispatch *tp, tp_pass_sanity_check(struct tp_dispatch *tp,
struct evdev_device *device) struct evdev_device *device)
{ {
struct libevdev *evdev = device->evdev; struct libevdev *evdev = device->evdev;
@ -2097,13 +2097,13 @@ tp_sanity_check(struct tp_dispatch *tp,
if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_FINGER)) if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_FINGER))
goto error; goto error;
return 0; return true;
error: error:
log_bug_kernel(libinput, log_bug_kernel(libinput,
"device %s failed touchpad sanity checks\n", "device %s failed touchpad sanity checks\n",
device->devname); device->devname);
return -1; return false;
} }
static void static void
@ -2183,8 +2183,8 @@ tp_init(struct tp_dispatch *tp,
tp->base.interface = &tp_interface; tp->base.interface = &tp_interface;
tp->device = device; tp->device = device;
if (tp_sanity_check(tp, device) != 0) if (!tp_pass_sanity_check(tp, device))
return -1; return false;
tp_init_default_resolution(tp, device); tp_init_default_resolution(tp, device);