summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2017-07-24 12:46:18 -0400
committerJiri Kosina <jkosina@suse.cz>2017-07-27 09:14:28 -0400
commitfc2237a724a9e448599076d7d23497f51e2f7441 (patch)
tree0f6fc077d1452bba1d2e690d08f6bef622f20919 /drivers/hid
parentbc35f73aa62f51b80f769d3a6617f4a4ba11d81e (diff)
HID: introduce hid_is_using_ll_driver
Although HID itself is transport-agnostic, occasionally a driver may want to interact with the low-level transport that a device is connected through. To do this, we need to know what kind of bus is in use. The first guess may be to look at the 'bus' field of the 'struct hid_device', but this field may be emulated in some cases (e.g. uhid). More ideally, we can check which ll_driver a device is using. This function introduces a 'hid_is_using_ll_driver' function and makes the 'struct hid_ll_driver' of the four most common transports accessible through hid.h. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Acked-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/i2c-hid/i2c-hid.c3
-rw-r--r--drivers/hid/uhid.c3
-rw-r--r--drivers/hid/usbhid/hid-core.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 046f692fd0a2..77396145d2d0 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -780,7 +780,7 @@ static int i2c_hid_power(struct hid_device *hid, int lvl)
780 return 0; 780 return 0;
781} 781}
782 782
783static struct hid_ll_driver i2c_hid_ll_driver = { 783struct hid_ll_driver i2c_hid_ll_driver = {
784 .parse = i2c_hid_parse, 784 .parse = i2c_hid_parse,
785 .start = i2c_hid_start, 785 .start = i2c_hid_start,
786 .stop = i2c_hid_stop, 786 .stop = i2c_hid_stop,
@@ -790,6 +790,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
790 .output_report = i2c_hid_output_report, 790 .output_report = i2c_hid_output_report,
791 .raw_request = i2c_hid_raw_request, 791 .raw_request = i2c_hid_raw_request,
792}; 792};
793EXPORT_SYMBOL_GPL(i2c_hid_ll_driver);
793 794
794static int i2c_hid_init_irq(struct i2c_client *client) 795static int i2c_hid_init_irq(struct i2c_client *client)
795{ 796{
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 7f8ff39ed44b..6f819f144cb4 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -369,7 +369,7 @@ static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf,
369 return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT); 369 return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT);
370} 370}
371 371
372static struct hid_ll_driver uhid_hid_driver = { 372struct hid_ll_driver uhid_hid_driver = {
373 .start = uhid_hid_start, 373 .start = uhid_hid_start,
374 .stop = uhid_hid_stop, 374 .stop = uhid_hid_stop,
375 .open = uhid_hid_open, 375 .open = uhid_hid_open,
@@ -378,6 +378,7 @@ static struct hid_ll_driver uhid_hid_driver = {
378 .raw_request = uhid_hid_raw_request, 378 .raw_request = uhid_hid_raw_request,
379 .output_report = uhid_hid_output_report, 379 .output_report = uhid_hid_output_report,
380}; 380};
381EXPORT_SYMBOL_GPL(uhid_hid_driver);
381 382
382#ifdef CONFIG_COMPAT 383#ifdef CONFIG_COMPAT
383 384
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 76013eb5cb7f..e1047ad0d59b 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1261,7 +1261,7 @@ static int usbhid_idle(struct hid_device *hid, int report, int idle,
1261 return hid_set_idle(dev, ifnum, report, idle); 1261 return hid_set_idle(dev, ifnum, report, idle);
1262} 1262}
1263 1263
1264static struct hid_ll_driver usb_hid_driver = { 1264struct hid_ll_driver usb_hid_driver = {
1265 .parse = usbhid_parse, 1265 .parse = usbhid_parse,
1266 .start = usbhid_start, 1266 .start = usbhid_start,
1267 .stop = usbhid_stop, 1267 .stop = usbhid_stop,
@@ -1274,6 +1274,7 @@ static struct hid_ll_driver usb_hid_driver = {
1274 .output_report = usbhid_output_report, 1274 .output_report = usbhid_output_report,
1275 .idle = usbhid_idle, 1275 .idle = usbhid_idle,
1276}; 1276};
1277EXPORT_SYMBOL_GPL(usb_hid_driver);
1277 1278
1278static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id) 1279static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1279{ 1280{