aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2013-02-25 05:31:47 -0500
committerJiri Kosina <jkosina@suse.cz>2013-02-25 07:26:41 -0500
commitb7966a4d7be0a10329f03330390f4bdaf453d74a (patch)
tree73e1456d2199e16edf22af60929507ae25cff281
parentd881427253da011495f4193663d809d0e9dfa215 (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>
-rw-r--r--drivers/hid/Kconfig2
-rw-r--r--drivers/hid/hid-ntrig.c4
-rw-r--r--drivers/hid/hid-picolcd_fb.c5
-rw-r--r--drivers/hid/hid-sensor-hub.c5
-rw-r--r--drivers/hid/usbhid/hid-core.c3
-rw-r--r--drivers/hid/usbhid/hid-pidff.c16
-rw-r--r--drivers/hid/usbhid/hiddev.c4
-rw-r--r--drivers/hid/usbhid/usbhid.h1
8 files changed, 18 insertions, 22 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f0acf2754b69..c802b0716f48 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -479,7 +479,7 @@ config HID_PETALYNX
479 479
480config HID_PICOLCD 480config HID_PICOLCD
481 tristate "PicoLCD (graphic version)" 481 tristate "PicoLCD (graphic version)"
482 depends on USB_HID 482 depends on HID
483 ---help--- 483 ---help---
484 This provides support for Minibox PicoLCD devices, currently 484 This provides support for Minibox PicoLCD devices, currently
485 only the graphical ones are supported. 485 only the graphical ones are supported.
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index b926592e6c16..ef95102515e4 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -119,7 +119,7 @@ static inline int ntrig_get_mode(struct hid_device *hdev)
119 return -EINVAL; 119 return -EINVAL;
120 120
121 hid_hw_request(hdev, report, HID_REQ_GET_REPORT); 121 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
122 usbhid_wait_io(hdev); 122 hid_hw_wait(hdev);
123 return (int)report->field[0]->value[0]; 123 return (int)report->field[0]->value[0];
124} 124}
125 125
@@ -937,7 +937,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
937 if (report) { 937 if (report) {
938 /* Let the device settle to ensure the wakeup message gets 938 /* Let the device settle to ensure the wakeup message gets
939 * through */ 939 * through */
940 usbhid_wait_io(hdev); 940 hid_hw_wait(hdev);
941 hid_hw_request(hdev, report, HID_REQ_GET_REPORT); 941 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
942 942
943 /* 943 /*
diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c
index 98f61de9a5e0..591f6b22aa94 100644
--- a/drivers/hid/hid-picolcd_fb.c
+++ b/drivers/hid/hid-picolcd_fb.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/hid.h> 20#include <linux/hid.h>
21#include <linux/vmalloc.h> 21#include <linux/vmalloc.h>
22#include "usbhid/usbhid.h"
23 22
24#include <linux/fb.h> 23#include <linux/fb.h>
25#include <linux/module.h> 24#include <linux/module.h>
@@ -269,7 +268,7 @@ static void picolcd_fb_update(struct fb_info *info)
269 mutex_unlock(&info->lock); 268 mutex_unlock(&info->lock);
270 if (!data) 269 if (!data)
271 return; 270 return;
272 usbhid_wait_io(data->hdev); 271 hid_hw_wait(data->hdev);
273 mutex_lock(&info->lock); 272 mutex_lock(&info->lock);
274 n = 0; 273 n = 0;
275 } 274 }
@@ -287,7 +286,7 @@ static void picolcd_fb_update(struct fb_info *info)
287 spin_unlock_irqrestore(&fbdata->lock, flags); 286 spin_unlock_irqrestore(&fbdata->lock, flags);
288 mutex_unlock(&info->lock); 287 mutex_unlock(&info->lock);
289 if (data) 288 if (data)
290 usbhid_wait_io(data->hdev); 289 hid_hw_wait(data->hdev);
291 return; 290 return;
292 } 291 }
293out: 292out:
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 59d29f853ac0..ca7498107327 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -18,7 +18,6 @@
18 */ 18 */
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/hid.h> 20#include <linux/hid.h>
21#include "usbhid/usbhid.h"
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/mfd/core.h> 23#include <linux/mfd/core.h>
@@ -204,7 +203,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
204 } 203 }
205 hid_set_field(report->field[field_index], 0, value); 204 hid_set_field(report->field[field_index], 0, value);
206 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); 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
209done_proc: 208done_proc:
210 mutex_unlock(&data->mutex); 209 mutex_unlock(&data->mutex);
@@ -227,7 +226,7 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
227 goto done_proc; 226 goto done_proc;
228 } 227 }
229 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT); 228 hid_hw_request(hsdev->hdev, report, HID_REQ_GET_REPORT);
230 usbhid_wait_io(hsdev->hdev); 229 hid_hw_wait(hsdev->hdev);
231 *value = report->field[field_index]->value[0]; 230 *value = report->field[field_index]->value[0];
232 231
233done_proc: 232done_proc:
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
708int usbhid_wait_io(struct hid_device *hid) 708static 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}
722EXPORT_SYMBOL_GPL(usbhid_wait_io);
723 722
724static int hid_set_idle(struct usb_device *dev, int ifnum, int report, int idle) 723static 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 */
37int usbhid_wait_io(struct hid_device* hid);
38void usbhid_close(struct hid_device *hid); 37void usbhid_close(struct hid_device *hid);
39int usbhid_open(struct hid_device *hid); 38int usbhid_open(struct hid_device *hid);
40void usbhid_init_reports(struct hid_device *hid); 39void usbhid_init_reports(struct hid_device *hid);