Commit 22c43863 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Greg Kroah-Hartman

[PATCH] drivers/usb: fix-up schedule_timeout() usage

Description: Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dd16525b
...@@ -631,8 +631,10 @@ static void usbin_stop(struct usb_audiodev *as) ...@@ -631,8 +631,10 @@ static void usbin_stop(struct usb_audiodev *as)
i = u->flags; i = u->flags;
spin_unlock_irqrestore(&as->lock, flags); spin_unlock_irqrestore(&as->lock, flags);
while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) { while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) {
set_current_state(notkilled ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); if (notkilled)
schedule_timeout(1); schedule_timeout_interruptible(1);
else
schedule_timeout_uninterruptible(1);
spin_lock_irqsave(&as->lock, flags); spin_lock_irqsave(&as->lock, flags);
i = u->flags; i = u->flags;
spin_unlock_irqrestore(&as->lock, flags); spin_unlock_irqrestore(&as->lock, flags);
...@@ -1102,8 +1104,10 @@ static void usbout_stop(struct usb_audiodev *as) ...@@ -1102,8 +1104,10 @@ static void usbout_stop(struct usb_audiodev *as)
i = u->flags; i = u->flags;
spin_unlock_irqrestore(&as->lock, flags); spin_unlock_irqrestore(&as->lock, flags);
while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) { while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) {
set_current_state(notkilled ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); if (notkilled)
schedule_timeout(1); schedule_timeout_interruptible(1);
else
schedule_timeout_uninterruptible(1);
spin_lock_irqsave(&as->lock, flags); spin_lock_irqsave(&as->lock, flags);
i = u->flags; i = u->flags;
spin_unlock_irqrestore(&as->lock, flags); spin_unlock_irqrestore(&as->lock, flags);
......
...@@ -1147,8 +1147,7 @@ ehci_endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep) ...@@ -1147,8 +1147,7 @@ ehci_endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep)
case QH_STATE_UNLINK: /* wait for hw to finish? */ case QH_STATE_UNLINK: /* wait for hw to finish? */
idle_timeout: idle_timeout:
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
set_current_state (TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout (1);
goto rescan; goto rescan;
case QH_STATE_IDLE: /* fully unlinked */ case QH_STATE_IDLE: /* fully unlinked */
if (list_empty (&qh->qtd_list)) { if (list_empty (&qh->qtd_list)) {
......
...@@ -382,8 +382,7 @@ ohci_endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep) ...@@ -382,8 +382,7 @@ ohci_endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep)
goto sanitize; goto sanitize;
} }
spin_unlock_irqrestore (&ohci->lock, flags); spin_unlock_irqrestore (&ohci->lock, flags);
set_current_state (TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout (1);
goto rescan; goto rescan;
case ED_IDLE: /* fully unlinked */ case ED_IDLE: /* fully unlinked */
if (list_empty (&ed->td_list)) { if (list_empty (&ed->td_list)) {
......
...@@ -610,8 +610,7 @@ static void cypress_close(struct usb_serial_port *port, struct file * filp) ...@@ -610,8 +610,7 @@ static void cypress_close(struct usb_serial_port *port, struct file * filp)
timeout = max((HZ*2560)/bps,HZ/10); timeout = max((HZ*2560)/bps,HZ/10);
else else
timeout = 2*HZ; timeout = 2*HZ;
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(timeout);
schedule_timeout(timeout);
dbg("%s - stopping urbs", __FUNCTION__); dbg("%s - stopping urbs", __FUNCTION__);
usb_kill_urb (port->interrupt_in_urb); usb_kill_urb (port->interrupt_in_urb);
......
...@@ -652,8 +652,7 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp) ...@@ -652,8 +652,7 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
timeout = max((HZ*2560)/bps,HZ/10); timeout = max((HZ*2560)/bps,HZ/10);
else else
timeout = 2*HZ; timeout = 2*HZ;
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(timeout);
schedule_timeout(timeout);
/* shutdown our urbs */ /* shutdown our urbs */
dbg("%s - shutting down urbs", __FUNCTION__); dbg("%s - shutting down urbs", __FUNCTION__);
......
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