diff options
author | Benjamin Tissoires <benjamin.tissoires@gmail.com> | 2013-02-25 05:31:47 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-02-25 07:26:41 -0500 |
commit | b7966a4d7be0a10329f03330390f4bdaf453d74a (patch) | |
tree | 73e1456d2199e16edf22af60929507ae25cff281 /drivers/hid/usbhid | |
parent | d881427253da011495f4193663d809d0e9dfa215 (diff) |
HID: use hid_hw_wait() instead of direct call to usbhid
This removes most of the dependencies between hid drivers and usbhid.
The patch was constructed by replacing all occurences of
usbhid_wait_io() by its hid_hw_wait() counterpart.
Then, drivers not requiring USB_HID anymore have their USB_HID
dependency cleaned in the Kconfig file.
As of today, few drivers are still requiring an explicit USB layer
dependency:
* ntrig (a patch is on its way)
* multitouch (one patch following and another on its way)
* lenovo tpkbd
* roccat
* sony
The last three are two deeply using direct calls to the usb subsystem
to be able to be cleaned right now.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 3 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-pidff.c | 16 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 4 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbhid.h | 1 |
4 files changed, 11 insertions, 13 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index da68687d2c7c..420466bc481a 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -705,7 +705,7 @@ static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, un | |||
705 | return 0; | 705 | return 0; |
706 | } | 706 | } |
707 | 707 | ||
708 | int usbhid_wait_io(struct hid_device *hid) | 708 | static int usbhid_wait_io(struct hid_device *hid) |
709 | { | 709 | { |
710 | struct usbhid_device *usbhid = hid->driver_data; | 710 | struct usbhid_device *usbhid = hid->driver_data; |
711 | 711 | ||
@@ -719,7 +719,6 @@ int usbhid_wait_io(struct hid_device *hid) | |||
719 | 719 | ||
720 | return 0; | 720 | return 0; |
721 | } | 721 | } |
722 | EXPORT_SYMBOL_GPL(usbhid_wait_io); | ||
723 | 722 | ||
724 | static int hid_set_idle(struct usb_device *dev, int ifnum, int report, int idle) | 723 | static int hid_set_idle(struct usb_device *dev, int ifnum, int report, int idle) |
725 | { | 724 | { |
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index 0f1efa39ec46..10b616702780 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c | |||
@@ -471,13 +471,13 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) | |||
471 | 471 | ||
472 | pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; | 472 | pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; |
473 | pidff->block_load_status->value[0] = 0; | 473 | pidff->block_load_status->value[0] = 0; |
474 | usbhid_wait_io(pidff->hid); | 474 | hid_hw_wait(pidff->hid); |
475 | 475 | ||
476 | for (j = 0; j < 60; j++) { | 476 | for (j = 0; j < 60; j++) { |
477 | hid_dbg(pidff->hid, "pid_block_load requested\n"); | 477 | hid_dbg(pidff->hid, "pid_block_load requested\n"); |
478 | hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD], | 478 | hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD], |
479 | HID_REQ_GET_REPORT); | 479 | HID_REQ_GET_REPORT); |
480 | usbhid_wait_io(pidff->hid); | 480 | hid_hw_wait(pidff->hid); |
481 | if (pidff->block_load_status->value[0] == | 481 | if (pidff->block_load_status->value[0] == |
482 | pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { | 482 | pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { |
483 | hid_dbg(pidff->hid, "device reported free memory: %d bytes\n", | 483 | hid_dbg(pidff->hid, "device reported free memory: %d bytes\n", |
@@ -551,7 +551,7 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id) | |||
551 | effect_id, pidff->pid_id[effect_id]); | 551 | effect_id, pidff->pid_id[effect_id]); |
552 | /* Wait for the queue to clear. We do not want a full fifo to | 552 | /* Wait for the queue to clear. We do not want a full fifo to |
553 | prevent the effect removal. */ | 553 | prevent the effect removal. */ |
554 | usbhid_wait_io(pidff->hid); | 554 | hid_hw_wait(pidff->hid); |
555 | pidff_playback_pid(pidff, pid_id, 0); | 555 | pidff_playback_pid(pidff, pid_id, 0); |
556 | pidff_erase_pid(pidff, pid_id); | 556 | pidff_erase_pid(pidff, pid_id); |
557 | 557 | ||
@@ -1159,18 +1159,18 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1159 | pidff->device_control->value[0] = pidff->control_id[PID_RESET]; | 1159 | pidff->device_control->value[0] = pidff->control_id[PID_RESET]; |
1160 | /* We reset twice as sometimes hid_wait_io isn't waiting long enough */ | 1160 | /* We reset twice as sometimes hid_wait_io isn't waiting long enough */ |
1161 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); | 1161 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); |
1162 | usbhid_wait_io(hid); | 1162 | hid_hw_wait(hid); |
1163 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); | 1163 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); |
1164 | usbhid_wait_io(hid); | 1164 | hid_hw_wait(hid); |
1165 | 1165 | ||
1166 | pidff->device_control->value[0] = | 1166 | pidff->device_control->value[0] = |
1167 | pidff->control_id[PID_ENABLE_ACTUATORS]; | 1167 | pidff->control_id[PID_ENABLE_ACTUATORS]; |
1168 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); | 1168 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); |
1169 | usbhid_wait_io(hid); | 1169 | hid_hw_wait(hid); |
1170 | 1170 | ||
1171 | /* pool report is sometimes messed up, refetch it */ | 1171 | /* pool report is sometimes messed up, refetch it */ |
1172 | hid_hw_request(hid, pidff->reports[PID_POOL], HID_REQ_GET_REPORT); | 1172 | hid_hw_request(hid, pidff->reports[PID_POOL], HID_REQ_GET_REPORT); |
1173 | usbhid_wait_io(hid); | 1173 | hid_hw_wait(hid); |
1174 | 1174 | ||
1175 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { | 1175 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { |
1176 | while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) { | 1176 | while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) { |
@@ -1183,7 +1183,7 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1183 | hid_dbg(pidff->hid, "pid_pool requested again\n"); | 1183 | hid_dbg(pidff->hid, "pid_pool requested again\n"); |
1184 | hid_hw_request(hid, pidff->reports[PID_POOL], | 1184 | hid_hw_request(hid, pidff->reports[PID_POOL], |
1185 | HID_REQ_GET_REPORT); | 1185 | HID_REQ_GET_REPORT); |
1186 | usbhid_wait_io(hid); | 1186 | hid_hw_wait(hid); |
1187 | } | 1187 | } |
1188 | } | 1188 | } |
1189 | } | 1189 | } |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 430d2a9e4521..2f1ddca6f2e0 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -706,7 +706,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
706 | break; | 706 | break; |
707 | 707 | ||
708 | hid_hw_request(hid, report, HID_REQ_GET_REPORT); | 708 | hid_hw_request(hid, report, HID_REQ_GET_REPORT); |
709 | usbhid_wait_io(hid); | 709 | hid_hw_wait(hid); |
710 | 710 | ||
711 | r = 0; | 711 | r = 0; |
712 | break; | 712 | break; |
@@ -725,7 +725,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
725 | break; | 725 | break; |
726 | 726 | ||
727 | hid_hw_request(hid, report, HID_REQ_SET_REPORT); | 727 | hid_hw_request(hid, report, HID_REQ_SET_REPORT); |
728 | usbhid_wait_io(hid); | 728 | hid_hw_wait(hid); |
729 | 729 | ||
730 | r = 0; | 730 | r = 0; |
731 | break; | 731 | break; |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index aa1d5ff1208f..dbb6af699135 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/input.h> | 34 | #include <linux/input.h> |
35 | 35 | ||
36 | /* API provided by hid-core.c for USB HID drivers */ | 36 | /* API provided by hid-core.c for USB HID drivers */ |
37 | int usbhid_wait_io(struct hid_device* hid); | ||
38 | void usbhid_close(struct hid_device *hid); | 37 | void usbhid_close(struct hid_device *hid); |
39 | int usbhid_open(struct hid_device *hid); | 38 | int usbhid_open(struct hid_device *hid); |
40 | void usbhid_init_reports(struct hid_device *hid); | 39 | void usbhid_init_reports(struct hid_device *hid); |