diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2014-12-16 17:06:01 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-12-17 09:08:26 +0100 |
commit | bf159447537ed234afb569f91f5fd8c54ffa4c36 (patch) | |
tree | df66b1dbbe170e05933876378310073b94255640 | |
parent | e529fea919872c6568bbda7873c64ac5d807ee83 (diff) | |
download | op-kernel-dev-bf159447537ed234afb569f91f5fd8c54ffa4c36.zip op-kernel-dev-bf159447537ed234afb569f91f5fd8c54ffa4c36.tar.gz |
HID: logitech-hidpp: bail out if wtp_connect fails
If wtp_connect() fails, that means most of the time that the device has
been disconnected. Subsequent attempts to contact the device will fail
too, so it's simpler to bail out earlier.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-logitech-hidpp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 6a5fe97..e1f3aca 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -862,24 +862,24 @@ static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) return 0; }; -static void wtp_connect(struct hid_device *hdev, bool connected) +static int wtp_connect(struct hid_device *hdev, bool connected) { struct hidpp_device *hidpp = hid_get_drvdata(hdev); struct wtp_data *wd = hidpp->private_data; int ret; if (!connected) - return; + return 0; if (!wd->x_size) { ret = wtp_get_config(hidpp); if (ret) { hid_err(hdev, "Can not get wtp config: %d\n", ret); - return; + return ret; } } - hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, + return hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, true, true); } @@ -1063,8 +1063,11 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) struct input_dev *input; char *name, *devm_name; - if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) - wtp_connect(hdev, connected); + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { + ret = wtp_connect(hdev, connected); + if (ret) + return; + } if (!connected || hidpp->delayed_input) return; |