aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-07-19 16:08:39 -0400
committerJiri Kosina <jkosina@suse.cz>2012-07-20 05:24:24 -0400
commit93101af31bc5df4486103f6b3ef212aaa5341b09 (patch)
tree7d6b54fad4f755732717206d178c9a37d488c7a1 /drivers/hid/usbhid
parent01a7c984e86fd45b760bb0da8b635059dff602e1 (diff)
HID: usbhid: inline some simple routines
This patch (as1594) simplifies the usbhid driver by inlining a couple of routines. As a result of an earlier patch, irq_out_pump_restart() and ctrl_pump_restart() are each used in only one place. Since they don't really do what their names say, and since they each involve only about two lines of actual code, there's no reason to keep them as separate functions. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Oliver Neukum <oliver@neukum.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r--drivers/hid/usbhid/hid-core.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 213b3f39753c..0fa07d95202d 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -435,16 +435,6 @@ static int hid_submit_ctrl(struct hid_device *hid)
435 * Output interrupt completion handler. 435 * Output interrupt completion handler.
436 */ 436 */
437 437
438static int irq_out_pump_restart(struct hid_device *hid)
439{
440 struct usbhid_device *usbhid = hid->driver_data;
441
442 if (usbhid->outhead != usbhid->outtail)
443 return hid_submit_out(hid);
444 else
445 return -1;
446}
447
448static void hid_irq_out(struct urb *urb) 438static void hid_irq_out(struct urb *urb)
449{ 439{
450 struct hid_device *hid = urb->context; 440 struct hid_device *hid = urb->context;
@@ -469,15 +459,17 @@ static void hid_irq_out(struct urb *urb)
469 459
470 spin_lock_irqsave(&usbhid->lock, flags); 460 spin_lock_irqsave(&usbhid->lock, flags);
471 461
472 if (unplug) 462 if (unplug) {
473 usbhid->outtail = usbhid->outhead; 463 usbhid->outtail = usbhid->outhead;
474 else 464 } else {
475 usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1); 465 usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1);
476 466
477 if (!irq_out_pump_restart(hid)) { 467 if (usbhid->outhead != usbhid->outtail &&
478 /* Successfully submitted next urb in queue */ 468 hid_submit_out(hid) == 0) {
479 spin_unlock_irqrestore(&usbhid->lock, flags); 469 /* Successfully submitted next urb in queue */
480 return; 470 spin_unlock_irqrestore(&usbhid->lock, flags);
471 return;
472 }
481 } 473 }
482 474
483 clear_bit(HID_OUT_RUNNING, &usbhid->iofl); 475 clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
@@ -489,15 +481,6 @@ static void hid_irq_out(struct urb *urb)
489/* 481/*
490 * Control pipe completion handler. 482 * Control pipe completion handler.
491 */ 483 */
492static int ctrl_pump_restart(struct hid_device *hid)
493{
494 struct usbhid_device *usbhid = hid->driver_data;
495
496 if (usbhid->ctrlhead != usbhid->ctrltail)
497 return hid_submit_ctrl(hid);
498 else
499 return -1;
500}
501 484
502static void hid_ctrl(struct urb *urb) 485static void hid_ctrl(struct urb *urb)
503{ 486{
@@ -526,15 +509,17 @@ static void hid_ctrl(struct urb *urb)
526 hid_warn(urb->dev, "ctrl urb status %d received\n", status); 509 hid_warn(urb->dev, "ctrl urb status %d received\n", status);
527 } 510 }
528 511
529 if (unplug) 512 if (unplug) {
530 usbhid->ctrltail = usbhid->ctrlhead; 513 usbhid->ctrltail = usbhid->ctrlhead;
531 else 514 } else {
532 usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); 515 usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1);
533 516
534 if (!ctrl_pump_restart(hid)) { 517 if (usbhid->ctrlhead != usbhid->ctrltail &&
535 /* Successfully submitted next urb in queue */ 518 hid_submit_ctrl(hid) == 0) {
536 spin_unlock(&usbhid->lock); 519 /* Successfully submitted next urb in queue */
537 return; 520 spin_unlock(&usbhid->lock);
521 return;
522 }
538 } 523 }
539 524
540 clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); 525 clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);