Commit 93101af3 authored by Alan Stern's avatar Alan Stern Committed by Jiri Kosina

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: default avatarAlan Stern <stern@rowland.harvard.edu>
CC: Oliver Neukum <oliver@neukum.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 01a7c984
...@@ -435,16 +435,6 @@ static int hid_submit_ctrl(struct hid_device *hid) ...@@ -435,16 +435,6 @@ static int hid_submit_ctrl(struct hid_device *hid)
* Output interrupt completion handler. * Output interrupt completion handler.
*/ */
static int irq_out_pump_restart(struct hid_device *hid)
{
struct usbhid_device *usbhid = hid->driver_data;
if (usbhid->outhead != usbhid->outtail)
return hid_submit_out(hid);
else
return -1;
}
static void hid_irq_out(struct urb *urb) static void hid_irq_out(struct urb *urb)
{ {
struct hid_device *hid = urb->context; struct hid_device *hid = urb->context;
...@@ -469,15 +459,17 @@ static void hid_irq_out(struct urb *urb) ...@@ -469,15 +459,17 @@ static void hid_irq_out(struct urb *urb)
spin_lock_irqsave(&usbhid->lock, flags); spin_lock_irqsave(&usbhid->lock, flags);
if (unplug) if (unplug) {
usbhid->outtail = usbhid->outhead; usbhid->outtail = usbhid->outhead;
else } else {
usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1); usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1);
if (!irq_out_pump_restart(hid)) { if (usbhid->outhead != usbhid->outtail &&
/* Successfully submitted next urb in queue */ hid_submit_out(hid) == 0) {
spin_unlock_irqrestore(&usbhid->lock, flags); /* Successfully submitted next urb in queue */
return; spin_unlock_irqrestore(&usbhid->lock, flags);
return;
}
} }
clear_bit(HID_OUT_RUNNING, &usbhid->iofl); clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
...@@ -489,15 +481,6 @@ static void hid_irq_out(struct urb *urb) ...@@ -489,15 +481,6 @@ static void hid_irq_out(struct urb *urb)
/* /*
* Control pipe completion handler. * Control pipe completion handler.
*/ */
static int ctrl_pump_restart(struct hid_device *hid)
{
struct usbhid_device *usbhid = hid->driver_data;
if (usbhid->ctrlhead != usbhid->ctrltail)
return hid_submit_ctrl(hid);
else
return -1;
}
static void hid_ctrl(struct urb *urb) static void hid_ctrl(struct urb *urb)
{ {
...@@ -526,15 +509,17 @@ static void hid_ctrl(struct urb *urb) ...@@ -526,15 +509,17 @@ static void hid_ctrl(struct urb *urb)
hid_warn(urb->dev, "ctrl urb status %d received\n", status); hid_warn(urb->dev, "ctrl urb status %d received\n", status);
} }
if (unplug) if (unplug) {
usbhid->ctrltail = usbhid->ctrlhead; usbhid->ctrltail = usbhid->ctrlhead;
else } else {
usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1);
if (!ctrl_pump_restart(hid)) { if (usbhid->ctrlhead != usbhid->ctrltail &&
/* Successfully submitted next urb in queue */ hid_submit_ctrl(hid) == 0) {
spin_unlock(&usbhid->lock); /* Successfully submitted next urb in queue */
return; spin_unlock(&usbhid->lock);
return;
}
} }
clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment