diff options
author | Benjamin Tissoires <benjamin.tissoires@gmail.com> | 2013-02-25 05:31:46 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-02-25 07:26:41 -0500 |
commit | d881427253da011495f4193663d809d0e9dfa215 (patch) | |
tree | fe4eb817ab712f7049b1d3ef675fec69d9207675 /drivers/hid/usbhid | |
parent | f3757cea18fadce23c95a4c4bc3123af73a95e65 (diff) |
HID: use hid_hw_request() instead of direct call to usbhid
This allows the hid drivers to be independent from the transport layer.
The patch was constructed by replacing all occurences of
usbhid_submit_report() by its hid_hw_request() counterpart.
Then, drivers not requiring USB_HID anymore have their USB_HID
dependency cleaned in the Kconfig file.
Finally, few drivers still depends on USB_HID. Many of them
are requiring the io wait callback. They are found in the next patch.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
For the sensor-hub part:
Tested-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 | 64 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 4 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbhid.h | 2 |
4 files changed, 35 insertions, 38 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 99d95d3368b5..da68687d2c7c 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -639,7 +639,7 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re | |||
639 | } | 639 | } |
640 | } | 640 | } |
641 | 641 | ||
642 | void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) | 642 | static void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) |
643 | { | 643 | { |
644 | struct usbhid_device *usbhid = hid->driver_data; | 644 | struct usbhid_device *usbhid = hid->driver_data; |
645 | unsigned long flags; | 645 | unsigned long flags; |
@@ -648,7 +648,6 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns | |||
648 | __usbhid_submit_report(hid, report, dir); | 648 | __usbhid_submit_report(hid, report, dir); |
649 | spin_unlock_irqrestore(&usbhid->lock, flags); | 649 | spin_unlock_irqrestore(&usbhid->lock, flags); |
650 | } | 650 | } |
651 | EXPORT_SYMBOL_GPL(usbhid_submit_report); | ||
652 | 651 | ||
653 | /* Workqueue routine to send requests to change LEDs */ | 652 | /* Workqueue routine to send requests to change LEDs */ |
654 | static void hid_led(struct work_struct *work) | 653 | static void hid_led(struct work_struct *work) |
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index f91c136821f7..0f1efa39ec46 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c | |||
@@ -263,8 +263,8 @@ static void pidff_set_envelope_report(struct pidff_device *pidff, | |||
263 | envelope->attack_level, | 263 | envelope->attack_level, |
264 | pidff->set_envelope[PID_ATTACK_LEVEL].value[0]); | 264 | pidff->set_envelope[PID_ATTACK_LEVEL].value[0]); |
265 | 265 | ||
266 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE], | 266 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_ENVELOPE], |
267 | USB_DIR_OUT); | 267 | HID_REQ_SET_REPORT); |
268 | } | 268 | } |
269 | 269 | ||
270 | /* | 270 | /* |
@@ -290,8 +290,8 @@ static void pidff_set_constant_force_report(struct pidff_device *pidff, | |||
290 | pidff_set_signed(&pidff->set_constant[PID_MAGNITUDE], | 290 | pidff_set_signed(&pidff->set_constant[PID_MAGNITUDE], |
291 | effect->u.constant.level); | 291 | effect->u.constant.level); |
292 | 292 | ||
293 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONSTANT], | 293 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONSTANT], |
294 | USB_DIR_OUT); | 294 | HID_REQ_SET_REPORT); |
295 | } | 295 | } |
296 | 296 | ||
297 | /* | 297 | /* |
@@ -325,8 +325,8 @@ static void pidff_set_effect_report(struct pidff_device *pidff, | |||
325 | pidff->effect_direction); | 325 | pidff->effect_direction); |
326 | pidff->set_effect[PID_START_DELAY].value[0] = effect->replay.delay; | 326 | pidff->set_effect[PID_START_DELAY].value[0] = effect->replay.delay; |
327 | 327 | ||
328 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT], | 328 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT], |
329 | USB_DIR_OUT); | 329 | HID_REQ_SET_REPORT); |
330 | } | 330 | } |
331 | 331 | ||
332 | /* | 332 | /* |
@@ -357,8 +357,8 @@ static void pidff_set_periodic_report(struct pidff_device *pidff, | |||
357 | pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase); | 357 | pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase); |
358 | pidff->set_periodic[PID_PERIOD].value[0] = effect->u.periodic.period; | 358 | pidff->set_periodic[PID_PERIOD].value[0] = effect->u.periodic.period; |
359 | 359 | ||
360 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_PERIODIC], | 360 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_PERIODIC], |
361 | USB_DIR_OUT); | 361 | HID_REQ_SET_REPORT); |
362 | 362 | ||
363 | } | 363 | } |
364 | 364 | ||
@@ -399,8 +399,8 @@ static void pidff_set_condition_report(struct pidff_device *pidff, | |||
399 | effect->u.condition[i].left_saturation); | 399 | effect->u.condition[i].left_saturation); |
400 | pidff_set(&pidff->set_condition[PID_DEAD_BAND], | 400 | pidff_set(&pidff->set_condition[PID_DEAD_BAND], |
401 | effect->u.condition[i].deadband); | 401 | effect->u.condition[i].deadband); |
402 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_CONDITION], | 402 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONDITION], |
403 | USB_DIR_OUT); | 403 | HID_REQ_SET_REPORT); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
@@ -440,8 +440,8 @@ static void pidff_set_ramp_force_report(struct pidff_device *pidff, | |||
440 | effect->u.ramp.start_level); | 440 | effect->u.ramp.start_level); |
441 | pidff_set_signed(&pidff->set_ramp[PID_RAMP_END], | 441 | pidff_set_signed(&pidff->set_ramp[PID_RAMP_END], |
442 | effect->u.ramp.end_level); | 442 | effect->u.ramp.end_level); |
443 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_RAMP], | 443 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_RAMP], |
444 | USB_DIR_OUT); | 444 | HID_REQ_SET_REPORT); |
445 | } | 445 | } |
446 | 446 | ||
447 | /* | 447 | /* |
@@ -465,8 +465,8 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) | |||
465 | int j; | 465 | int j; |
466 | 466 | ||
467 | pidff->create_new_effect_type->value[0] = efnum; | 467 | pidff->create_new_effect_type->value[0] = efnum; |
468 | usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], | 468 | hid_hw_request(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], |
469 | USB_DIR_OUT); | 469 | HID_REQ_SET_REPORT); |
470 | hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", efnum); | 470 | hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", 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; |
@@ -475,8 +475,8 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) | |||
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 | usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD], | 478 | hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD], |
479 | USB_DIR_IN); | 479 | HID_REQ_GET_REPORT); |
480 | usbhid_wait_io(pidff->hid); | 480 | usbhid_wait_io(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]) { |
@@ -513,8 +513,8 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n) | |||
513 | pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; | 513 | pidff->effect_operation[PID_LOOP_COUNT].value[0] = n; |
514 | } | 514 | } |
515 | 515 | ||
516 | usbhid_submit_report(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], | 516 | hid_hw_request(pidff->hid, pidff->reports[PID_EFFECT_OPERATION], |
517 | USB_DIR_OUT); | 517 | HID_REQ_SET_REPORT); |
518 | } | 518 | } |
519 | 519 | ||
520 | /** | 520 | /** |
@@ -535,8 +535,8 @@ static int pidff_playback(struct input_dev *dev, int effect_id, int value) | |||
535 | static void pidff_erase_pid(struct pidff_device *pidff, int pid_id) | 535 | static void pidff_erase_pid(struct pidff_device *pidff, int pid_id) |
536 | { | 536 | { |
537 | pidff->block_free[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id; | 537 | pidff->block_free[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id; |
538 | usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_FREE], | 538 | hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_FREE], |
539 | USB_DIR_OUT); | 539 | HID_REQ_SET_REPORT); |
540 | } | 540 | } |
541 | 541 | ||
542 | /* | 542 | /* |
@@ -718,8 +718,8 @@ static void pidff_set_gain(struct input_dev *dev, u16 gain) | |||
718 | struct pidff_device *pidff = dev->ff->private; | 718 | struct pidff_device *pidff = dev->ff->private; |
719 | 719 | ||
720 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain); | 720 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain); |
721 | usbhid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], | 721 | hid_hw_request(pidff->hid, pidff->reports[PID_DEVICE_GAIN], |
722 | USB_DIR_OUT); | 722 | HID_REQ_SET_REPORT); |
723 | } | 723 | } |
724 | 724 | ||
725 | static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude) | 725 | static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude) |
@@ -744,8 +744,8 @@ static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude) | |||
744 | pidff->set_effect[PID_DIRECTION_ENABLE].value[0] = 1; | 744 | pidff->set_effect[PID_DIRECTION_ENABLE].value[0] = 1; |
745 | pidff->set_effect[PID_START_DELAY].value[0] = 0; | 745 | pidff->set_effect[PID_START_DELAY].value[0] = 0; |
746 | 746 | ||
747 | usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_EFFECT], | 747 | hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT], |
748 | USB_DIR_OUT); | 748 | HID_REQ_SET_REPORT); |
749 | } | 749 | } |
750 | 750 | ||
751 | /* | 751 | /* |
@@ -1158,18 +1158,18 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1158 | 1158 | ||
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 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); | 1161 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); |
1162 | usbhid_wait_io(hid); | 1162 | usbhid_wait_io(hid); |
1163 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); | 1163 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); |
1164 | usbhid_wait_io(hid); | 1164 | usbhid_wait_io(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 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_CONTROL], USB_DIR_OUT); | 1168 | hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); |
1169 | usbhid_wait_io(hid); | 1169 | usbhid_wait_io(hid); |
1170 | 1170 | ||
1171 | /* pool report is sometimes messed up, refetch it */ | 1171 | /* pool report is sometimes messed up, refetch it */ |
1172 | usbhid_submit_report(hid, pidff->reports[PID_POOL], USB_DIR_IN); | 1172 | hid_hw_request(hid, pidff->reports[PID_POOL], HID_REQ_GET_REPORT); |
1173 | usbhid_wait_io(hid); | 1173 | usbhid_wait_io(hid); |
1174 | 1174 | ||
1175 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { | 1175 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { |
@@ -1181,8 +1181,8 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1181 | break; | 1181 | break; |
1182 | } | 1182 | } |
1183 | hid_dbg(pidff->hid, "pid_pool requested again\n"); | 1183 | hid_dbg(pidff->hid, "pid_pool requested again\n"); |
1184 | usbhid_submit_report(hid, pidff->reports[PID_POOL], | 1184 | hid_hw_request(hid, pidff->reports[PID_POOL], |
1185 | USB_DIR_IN); | 1185 | HID_REQ_GET_REPORT); |
1186 | usbhid_wait_io(hid); | 1186 | usbhid_wait_io(hid); |
1187 | } | 1187 | } |
1188 | } | 1188 | } |
@@ -1269,8 +1269,8 @@ int hid_pidff_init(struct hid_device *hid) | |||
1269 | 1269 | ||
1270 | if (test_bit(FF_GAIN, dev->ffbit)) { | 1270 | if (test_bit(FF_GAIN, dev->ffbit)) { |
1271 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff); | 1271 | pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff); |
1272 | usbhid_submit_report(hid, pidff->reports[PID_DEVICE_GAIN], | 1272 | hid_hw_request(hid, pidff->reports[PID_DEVICE_GAIN], |
1273 | USB_DIR_OUT); | 1273 | HID_REQ_SET_REPORT); |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | error = pidff_check_autocenter(pidff, dev); | 1276 | error = pidff_check_autocenter(pidff, dev); |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 87bd64959a91..430d2a9e4521 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -705,7 +705,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
705 | if (report == NULL) | 705 | if (report == NULL) |
706 | break; | 706 | break; |
707 | 707 | ||
708 | usbhid_submit_report(hid, report, USB_DIR_IN); | 708 | hid_hw_request(hid, report, HID_REQ_GET_REPORT); |
709 | usbhid_wait_io(hid); | 709 | usbhid_wait_io(hid); |
710 | 710 | ||
711 | r = 0; | 711 | r = 0; |
@@ -724,7 +724,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
724 | if (report == NULL) | 724 | if (report == NULL) |
725 | break; | 725 | break; |
726 | 726 | ||
727 | usbhid_submit_report(hid, report, USB_DIR_OUT); | 727 | hid_hw_request(hid, report, HID_REQ_SET_REPORT); |
728 | usbhid_wait_io(hid); | 728 | usbhid_wait_io(hid); |
729 | 729 | ||
730 | r = 0; | 730 | r = 0; |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index bd87a61e5303..aa1d5ff1208f 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -38,8 +38,6 @@ int usbhid_wait_io(struct hid_device* hid); | |||
38 | void usbhid_close(struct hid_device *hid); | 38 | void usbhid_close(struct hid_device *hid); |
39 | int usbhid_open(struct hid_device *hid); | 39 | int usbhid_open(struct hid_device *hid); |
40 | void usbhid_init_reports(struct hid_device *hid); | 40 | void usbhid_init_reports(struct hid_device *hid); |
41 | void usbhid_submit_report | ||
42 | (struct hid_device *hid, struct hid_report *report, unsigned char dir); | ||
43 | int usbhid_get_power(struct hid_device *hid); | 41 | int usbhid_get_power(struct hid_device *hid); |
44 | void usbhid_put_power(struct hid_device *hid); | 42 | void usbhid_put_power(struct hid_device *hid); |
45 | struct usb_interface *usbhid_find_interface(int minor); | 43 | struct usb_interface *usbhid_find_interface(int minor); |