diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-12-16 18:23:51 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-12-17 02:53:51 -0500 |
commit | e529fea919872c6568bbda7873c64ac5d807ee83 (patch) | |
tree | 4b433d3bae5412bca305ea5d9bbc5a820bd65e4a /drivers/hid | |
parent | 0349678ccd74d16c1f2bb58ecafec13ef7110e36 (diff) |
HID: logitech-hidpp: separate HID++ from WTP processing
Previously wtp_raw_event would be called through
hidpp_raw_hidpp_event (for the touchpad report) and hidpp_raw_event
(for the mouse report).
This patch removes one calling surface, making a clearer distinction
between "generic HID++ processing" (matching internal reports) and
device-specific event processing.
Suggested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-logitech-hidpp.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 2f420c0b6609..6a5fe9735179 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
@@ -924,7 +924,7 @@ static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data, | |||
924 | 924 | ||
925 | /* | 925 | /* |
926 | * If the mutex is locked then we have a pending answer from a | 926 | * If the mutex is locked then we have a pending answer from a |
927 | * previoulsly sent command | 927 | * previously sent command. |
928 | */ | 928 | */ |
929 | if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { | 929 | if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { |
930 | /* | 930 | /* |
@@ -955,9 +955,6 @@ static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data, | |||
955 | return 1; | 955 | return 1; |
956 | } | 956 | } |
957 | 957 | ||
958 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | ||
959 | return wtp_raw_event(hidpp->hid_dev, data, size); | ||
960 | |||
961 | return 0; | 958 | return 0; |
962 | } | 959 | } |
963 | 960 | ||
@@ -965,7 +962,9 @@ static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, | |||
965 | u8 *data, int size) | 962 | u8 *data, int size) |
966 | { | 963 | { |
967 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | 964 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); |
965 | int ret = 0; | ||
968 | 966 | ||
967 | /* Generic HID++ processing. */ | ||
969 | switch (data[0]) { | 968 | switch (data[0]) { |
970 | case REPORT_ID_HIDPP_LONG: | 969 | case REPORT_ID_HIDPP_LONG: |
971 | if (size != HIDPP_REPORT_LONG_LENGTH) { | 970 | if (size != HIDPP_REPORT_LONG_LENGTH) { |
@@ -973,16 +972,23 @@ static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, | |||
973 | size); | 972 | size); |
974 | return 1; | 973 | return 1; |
975 | } | 974 | } |
976 | return hidpp_raw_hidpp_event(hidpp, data, size); | 975 | ret = hidpp_raw_hidpp_event(hidpp, data, size); |
976 | break; | ||
977 | case REPORT_ID_HIDPP_SHORT: | 977 | case REPORT_ID_HIDPP_SHORT: |
978 | if (size != HIDPP_REPORT_SHORT_LENGTH) { | 978 | if (size != HIDPP_REPORT_SHORT_LENGTH) { |
979 | hid_err(hdev, "received hid++ report of bad size (%d)", | 979 | hid_err(hdev, "received hid++ report of bad size (%d)", |
980 | size); | 980 | size); |
981 | return 1; | 981 | return 1; |
982 | } | 982 | } |
983 | return hidpp_raw_hidpp_event(hidpp, data, size); | 983 | ret = hidpp_raw_hidpp_event(hidpp, data, size); |
984 | break; | ||
984 | } | 985 | } |
985 | 986 | ||
987 | /* If no report is available for further processing, skip calling | ||
988 | * raw_event of subclasses. */ | ||
989 | if (ret != 0) | ||
990 | return ret; | ||
991 | |||
986 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | 992 | if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) |
987 | return wtp_raw_event(hdev, data, size); | 993 | return wtp_raw_event(hdev, data, size); |
988 | 994 | ||