Commit 3c86726c authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

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: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 2ebaebcf
...@@ -283,7 +283,8 @@ The available HID callbacks are: ...@@ -283,7 +283,8 @@ The available HID callbacks are:
int reqtype) int reqtype)
Same as ->request() but provides the report as raw buffer. This request shall Same as ->request() but provides the report as raw buffer. This request shall
be synchronous. A transport driver must not use ->wait() to complete such be synchronous. A transport driver must not use ->wait() to complete such
requests. requests. This request is mandatory and hid core will reject the device if
it is missing.
- int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len) - int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len)
Send raw output report via intr channel. Used by some HID device drivers Send raw output report via intr channel. Used by some HID device drivers
......
...@@ -1330,9 +1330,6 @@ void __hid_request(struct hid_device *hid, struct hid_report *report, ...@@ -1330,9 +1330,6 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
int ret; int ret;
int len; int len;
if (!hid->ll_driver->raw_request)
return;
buf = hid_alloc_report_buf(report, GFP_KERNEL); buf = hid_alloc_report_buf(report, GFP_KERNEL);
if (!buf) if (!buf)
return; return;
...@@ -2471,6 +2468,14 @@ int hid_add_device(struct hid_device *hdev) ...@@ -2471,6 +2468,14 @@ int hid_add_device(struct hid_device *hdev)
if (hid_ignore(hdev)) if (hid_ignore(hdev))
return -ENODEV; return -ENODEV;
/*
* Check for the mandatory transport channel.
*/
if (!hdev->ll_driver->raw_request) {
hid_err(hdev, "transport driver missing .raw_request()\n");
return -EINVAL;
}
/* /*
* Read the device report descriptor once and use as template * Read the device report descriptor once and use as template
* for the driver-specific modifications. * for the driver-specific modifications.
......
...@@ -1266,9 +1266,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid) ...@@ -1266,9 +1266,7 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid)
} }
input_set_drvdata(input_dev, hid); input_set_drvdata(input_dev, hid);
if (hid->ll_driver->request || hid->ll_driver->output_report || input_dev->event = hidinput_input_event;
hid->ll_driver->raw_request)
input_dev->event = hidinput_input_event;
input_dev->open = hidinput_open; input_dev->open = hidinput_open;
input_dev->close = hidinput_close; input_dev->close = hidinput_close;
input_dev->setkeycode = hidinput_setkeycode; input_dev->setkeycode = hidinput_setkeycode;
......
...@@ -992,11 +992,8 @@ static inline int hid_hw_raw_request(struct hid_device *hdev, ...@@ -992,11 +992,8 @@ static inline int hid_hw_raw_request(struct hid_device *hdev,
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf) if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
return -EINVAL; return -EINVAL;
if (hdev->ll_driver->raw_request) return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
rtype, reqtype); rtype, reqtype);
return -ENOSYS;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment