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 03:08:26 -0500 |
commit | bf159447537ed234afb569f91f5fd8c54ffa4c36 (patch) | |
tree | df66b1dbbe170e05933876378310073b94255640 /drivers/hid | |
parent | e529fea919872c6568bbda7873c64ac5d807ee83 (diff) |
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>
Diffstat (limited to 'drivers/hid')
-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 6a5fe9735179..e1f3aca4ba31 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) | |||
862 | return 0; | 862 | return 0; |
863 | }; | 863 | }; |
864 | 864 | ||
865 | static void wtp_connect(struct hid_device *hdev, bool connected) | 865 | static int wtp_connect(struct hid_device *hdev, bool connected) |
866 | { | 866 | { |
867 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 867 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
868 | struct wtp_data *wd = hidpp->private_data; | 868 | struct wtp_data *wd = hidpp->private_data; |
869 | int ret; | 869 | int ret; |
870 | 870 | ||
871 | if (!connected) | 871 | if (!connected) |
872 | return; | 872 | return 0; |
873 | 873 | ||
874 | if (!wd->x_size) { | 874 | if (!wd->x_size) { |
875 | ret = wtp_get_config(hidpp); | 875 | ret = wtp_get_config(hidpp); |
876 | if (ret) { | 876 | if (ret) { |
877 | hid_err(hdev, "Can not get wtp config: %d\n", ret); | 877 | hid_err(hdev, "Can not get wtp config: %d\n", ret); |
878 | return; | 878 | return ret; |
879 | } | 879 | } |
880 | } | 880 | } |
881 | 881 | ||
882 | hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, | 882 | return hidpp_touchpad_set_raw_report_state(hidpp, wd->mt_feature_index, |
883 | true, true); | 883 | true, true); |
884 | } | 884 | } |
885 | 885 | ||
@@ -1063,8 +1063,11 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) | |||
1063 | struct input_dev *input; | 1063 | struct input_dev *input; |
1064 | char *name, *devm_name; | 1064 | char *name, *devm_name; |
1065 | 1065 | ||
1066 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 1066 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { |
1067 | wtp_connect(hdev, connected); | 1067 | ret = wtp_connect(hdev, connected); |
1068 | if (ret) | ||
1069 | return; | ||
1070 | } | ||
1068 | 1071 | ||
1069 | if (!connected || hidpp->delayed_input) | 1072 | if (!connected || hidpp->delayed_input) |
1070 | return; | 1073 | return; |