diff options
author | Jiri Kosina <jkosina@suse.cz> | 2013-06-03 05:27:48 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-06-03 05:27:48 -0400 |
commit | b1a1442a23776756b254b69786848a94d92445ba (patch) | |
tree | c02acbe08a96ec04d4a836624ce972f86d85a15b /drivers/hid | |
parent | 68e353fe476e7dab4644b9e7b4979b72726397ae (diff) |
HID: core: fix reporting of raw events
hdrw->raw event can return three different return value types:
- ret < 0 indicates that the hdrv driver found an error while parsing
- ret == 0 indicates no error has been encountered, and the driver has
processed the report
- ret > 0 indicates that there was no parsing error, and the driver hasn't
processed the event.
Calling hid_report_raw_event() has to be called appropriately so that it
reflects what has been done by ->raw_event() callback, otherwise we might
updates of the in-kernel structure are lost upon arrival of the report, which
is wrong.
Reported-and-tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-and-tested-by: Daniel Leung <daniel.leung@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index c27207860dfb..8f616bd81eee 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1293,7 +1293,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
1293 | 1293 | ||
1294 | if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { | 1294 | if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { |
1295 | ret = hdrv->raw_event(hid, report, data, size); | 1295 | ret = hdrv->raw_event(hid, report, data, size); |
1296 | if (ret != 0) { | 1296 | if (ret < 0) { |
1297 | ret = ret < 0 ? ret : 0; | 1297 | ret = ret < 0 ? ret : 0; |
1298 | goto unlock; | 1298 | goto unlock; |
1299 | } | 1299 | } |