aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2014-02-20 15:24:49 -0500
committerJiri Kosina <jkosina@suse.cz>2014-02-24 11:23:15 -0500
commit3c86726cfe38952f0366f86acfbbb025813ec1c2 (patch)
tree74192839f11f698ee74ea55b4c17717e4c1bffba
parent2ebaebcf31096f83401c850393e93bc8f28db0e9 (diff)
HID: make .raw_request mandatory
SET_REPORT and GET_REPORT are mandatory in the HID specification. Make the corresponding API in hid-core mandatory too, which removes the need to test against it in some various places. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--Documentation/hid/hid-transport.txt3
-rw-r--r--drivers/hid/hid-core.c11
-rw-r--r--drivers/hid/hid-input.c4
-rw-r--r--include/linux/hid.h5
4 files changed, 12 insertions, 11 deletions
diff --git a/Documentation/hid/hid-transport.txt b/Documentation/hid/hid-transport.txt
index 9dbbceaef4f3..3dcba9fd4a3a 100644
--- a/Documentation/hid/hid-transport.txt
+++ b/Documentation/hid/hid-transport.txt
@@ -283,7 +283,8 @@ The available HID callbacks are:
283 int reqtype) 283 int reqtype)
284 Same as ->request() but provides the report as raw buffer. This request shall 284 Same as ->request() but provides the report as raw buffer. This request shall
285 be synchronous. A transport driver must not use ->wait() to complete such 285 be synchronous. A transport driver must not use ->wait() to complete such
286 requests. 286 requests. This request is mandatory and hid core will reject the device if
287 it is missing.
287 288
288 - int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len) 289 - int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len)
289 Send raw output report via intr channel. Used by some HID device drivers 290 Send raw output report via intr channel. Used by some HID device drivers
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b6ae69711d2a..0b57babe3f9f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1330,9 +1330,6 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
1330 int ret; 1330 int ret;
1331 int len; 1331 int len;
1332 1332
1333 if (!hid->ll_driver->raw_request)
1334 return;
1335
1336 buf = hid_alloc_report_buf(report, GFP_KERNEL); 1333 buf = hid_alloc_report_buf(report, GFP_KERNEL);
1337 if (!buf) 1334 if (!buf)
1338 return; 1335 return;
@@ -2472,6 +2469,14 @@ int hid_add_device(struct hid_device *hdev)
2472 return -ENODEV; 2469 return -ENODEV;
2473 2470
2474 /* 2471 /*
2472 * Check for the mandatory transport channel.
2473 */
2474 if (!hdev->ll_driver->raw_request) {
2475 hid_err(hdev, "transport driver missing .raw_request()\n");
2476 return -EINVAL;
2477 }
2478
2479 /*
2475 * Read the device report descriptor once and use as template 2480 * Read the device report descriptor once and use as template
2476 * for the driver-specific modifications. 2481 * for the driver-specific modifications.
2477 */ 2482 */
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 310b96779e8e..f5aef792f13b 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1266,9 +1266,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid)
1266 } 1266 }
1267 1267
1268 input_set_drvdata(input_dev, hid); 1268 input_set_drvdata(input_dev, hid);
1269 if (hid->ll_driver->request || hid->ll_driver->output_report || 1269 input_dev->event = hidinput_input_event;
1270 hid->ll_driver->raw_request)
1271 input_dev->event = hidinput_input_event;
1272 input_dev->open = hidinput_open; 1270 input_dev->open = hidinput_open;
1273 input_dev->close = hidinput_close; 1271 input_dev->close = hidinput_close;
1274 input_dev->setkeycode = hidinput_setkeycode; 1272 input_dev->setkeycode = hidinput_setkeycode;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 60f3ff762376..5eb282e0dff7 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -992,11 +992,8 @@ static inline int hid_hw_raw_request(struct hid_device *hdev,
992 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) 992 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
993 return -EINVAL; 993 return -EINVAL;
994 994
995 if (hdev->ll_driver->raw_request) 995 return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
996 return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
997 rtype, reqtype); 996 rtype, reqtype);
998
999 return -ENOSYS;
1000} 997}
1001 998
1002/** 999/**