diff options
| -rw-r--r-- | drivers/hid/usbhid/hid-core.c | 47 |
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 | ||
| 438 | static 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 | |||
| 448 | static void hid_irq_out(struct urb *urb) | 438 | static 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 | */ |
| 492 | static 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 | ||
| 502 | static void hid_ctrl(struct urb *urb) | 485 | static 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); |
