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);
}
static int
tp_sanity_check(struct tp_dispatch *tp,
static bool
tp_pass_sanity_check(struct tp_dispatch *tp,
struct evdev_device *device)
{
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))
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);