Commit b7966a4d7be0a10329f03330390f4bdaf453d74a

Authored by Benjamin Tissoires
Committed by Jiri Kosina
1 parent d881427253

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>

Showing 8 changed files with 18 additions and 22 deletions Side-by-side Diff

... ... @@ -479,7 +479,7 @@
479 479  
480 480 config HID_PICOLCD
481 481 tristate "PicoLCD (graphic version)"
482   - depends on USB_HID
  482 + depends on HID
483 483 ---help---
484 484 This provides support for Minibox PicoLCD devices, currently
485 485 only the graphical ones are supported.
drivers/hid/hid-ntrig.c
... ... @@ -119,7 +119,7 @@
119 119 return -EINVAL;
120 120  
121 121 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
122   - usbhid_wait_io(hdev);
  122 + hid_hw_wait(hdev);
123 123 return (int)report->field[0]->value[0];
124 124 }
125 125  
... ... @@ -937,7 +937,7 @@
937 937 if (report) {
938 938 /* Let the device settle to ensure the wakeup message gets
939 939 * through */
940   - usbhid_wait_io(hdev);
  940 + hid_hw_wait(hdev);
941 941 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
942 942  
943 943 /*
drivers/hid/hid-picolcd_fb.c
... ... @@ -19,7 +19,6 @@
19 19  
20 20 #include <linux/hid.h>
21 21 #include <linux/vmalloc.h>
22   -#include "usbhid/usbhid.h"
23 22  
24 23 #include <linux/fb.h>
25 24 #include <linux/module.h>
... ... @@ -269,7 +268,7 @@
269 268 mutex_unlock(&info->lock);
270 269 if (!data)
271 270 return;
272   - usbhid_wait_io(data->hdev);
  271 + hid_hw_wait(data->hdev);
273 272 mutex_lock(&info->lock);
274 273 n = 0;
275 274 }
... ... @@ -287,7 +286,7 @@
287 286 spin_unlock_irqrestore(&fbdata->lock, flags);
288 287 mutex_unlock(&info->lock);
289 288 if (data)
290   - usbhid_wait_io(data->hdev);
  289 + hid_hw_wait(data->hdev);
291 290 return;
292 291 }
293 292 out:
drivers/hid/hid-sensor-hub.c
... ... @@ -18,7 +18,6 @@
18 18 */
19 19 #include <linux/device.h>
20 20 #include <linux/hid.h>
21   -#include "usbhid/usbhid.h"
22 21 #include <linux/module.h>
23 22 #include <linux/slab.h>
24 23 #include <linux/mfd/core.h>
... ... @@ -204,7 +203,7 @@
204 203 }
205 204 hid_set_field(report->field[field_index], 0, value);
206 205 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
207   - usbhid_wait_io(hsdev->hdev);
  206 + hid_hw_wait(hsdev->hdev);
208 207  
209 208 done_proc:
210 209 mutex_unlock(&data->mutex);
... ... @@ -227,7 +226,7 @@
227 226 goto done_proc;
228 227 }
229 228 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT);
230   - usbhid_wait_io(hsdev->hdev);
  229 + hid_hw_wait(hsdev->hdev);
231 230 *value = report->field[field_index]->value[0];
232 231  
233 232 done_proc:
drivers/hid/usbhid/hid-core.c
... ... @@ -705,7 +705,7 @@
705 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 710 struct usbhid_device *usbhid = hid->driver_data;
711 711  
... ... @@ -719,7 +719,6 @@
719 719  
720 720 return 0;
721 721 }
722   -EXPORT_SYMBOL_GPL(usbhid_wait_io);
723 722  
724 723 static int hid_set_idle(struct usb_device *dev, int ifnum, int report, int idle)
725 724 {
drivers/hid/usbhid/hid-pidff.c
... ... @@ -471,13 +471,13 @@
471 471  
472 472 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0;
473 473 pidff->block_load_status->value[0] = 0;
474   - usbhid_wait_io(pidff->hid);
  474 + hid_hw_wait(pidff->hid);
475 475  
476 476 for (j = 0; j < 60; j++) {
477 477 hid_dbg(pidff->hid, "pid_block_load requested\n");
478 478 hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD],
479 479 HID_REQ_GET_REPORT);
480   - usbhid_wait_io(pidff->hid);
  480 + hid_hw_wait(pidff->hid);
481 481 if (pidff->block_load_status->value[0] ==
482 482 pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) {
483 483 hid_dbg(pidff->hid, "device reported free memory: %d bytes\n",
... ... @@ -551,7 +551,7 @@
551 551 effect_id, pidff->pid_id[effect_id]);
552 552 /* Wait for the queue to clear. We do not want a full fifo to
553 553 prevent the effect removal. */
554   - usbhid_wait_io(pidff->hid);
  554 + hid_hw_wait(pidff->hid);
555 555 pidff_playback_pid(pidff, pid_id, 0);
556 556 pidff_erase_pid(pidff, pid_id);
557 557  
558 558  
559 559  
560 560  
... ... @@ -1159,18 +1159,18 @@
1159 1159 pidff->device_control->value[0] = pidff->control_id[PID_RESET];
1160 1160 /* We reset twice as sometimes hid_wait_io isn't waiting long enough */
1161 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 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 1166 pidff->device_control->value[0] =
1167 1167 pidff->control_id[PID_ENABLE_ACTUATORS];
1168 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 1171 /* pool report is sometimes messed up, refetch it */
1172 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 1175 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) {
1176 1176 while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) {
... ... @@ -1183,7 +1183,7 @@
1183 1183 hid_dbg(pidff->hid, "pid_pool requested again\n");
1184 1184 hid_hw_request(hid, pidff->reports[PID_POOL],
1185 1185 HID_REQ_GET_REPORT);
1186   - usbhid_wait_io(hid);
  1186 + hid_hw_wait(hid);
1187 1187 }
1188 1188 }
1189 1189 }
drivers/hid/usbhid/hiddev.c
... ... @@ -706,7 +706,7 @@
706 706 break;
707 707  
708 708 hid_hw_request(hid, report, HID_REQ_GET_REPORT);
709   - usbhid_wait_io(hid);
  709 + hid_hw_wait(hid);
710 710  
711 711 r = 0;
712 712 break;
... ... @@ -725,7 +725,7 @@
725 725 break;
726 726  
727 727 hid_hw_request(hid, report, HID_REQ_SET_REPORT);
728   - usbhid_wait_io(hid);
  728 + hid_hw_wait(hid);
729 729  
730 730 r = 0;
731 731 break;
drivers/hid/usbhid/usbhid.h
... ... @@ -34,7 +34,6 @@
34 34 #include <linux/input.h>
35 35  
36 36 /* API provided by hid-core.c for USB HID drivers */
37   -int usbhid_wait_io(struct hid_device* hid);
38 37 void usbhid_close(struct hid_device *hid);
39 38 int usbhid_open(struct hid_device *hid);
40 39 void usbhid_init_reports(struct hid_device *hid);