[PATCH] drivers/usb: fix-up schedule_timeout() usage
authorNishanth Aravamudan <nacc@us.ibm.com>
Mon, 15 Aug 2005 18:30:11 +0000 (11:30 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 12 Sep 2005 19:23:44 +0000 (12:23 -0700)
Description: Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/audio.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ohci-hcd.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/pl2303.c

index f8f21567cc22489c505d104851c80ab03fe8e47f..50858273f8d3e980ea1651f6b47b51ff2656623c 100644 (file)
@@ -631,8 +631,10 @@ static void usbin_stop(struct usb_audiodev *as)
        i = u->flags;
        spin_unlock_irqrestore(&as->lock, flags);
        while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) {
-               set_current_state(notkilled ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               if (notkilled)
+                       schedule_timeout_interruptible(1);
+               else
+                       schedule_timeout_uninterruptible(1);
                spin_lock_irqsave(&as->lock, flags);
                i = u->flags;
                spin_unlock_irqrestore(&as->lock, flags);
@@ -1102,8 +1104,10 @@ static void usbout_stop(struct usb_audiodev *as)
        i = u->flags;
        spin_unlock_irqrestore(&as->lock, flags);
        while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) {
-               set_current_state(notkilled ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1);
+               if (notkilled)
+                       schedule_timeout_interruptible(1);
+               else
+                       schedule_timeout_uninterruptible(1);
                spin_lock_irqsave(&as->lock, flags);
                i = u->flags;
                spin_unlock_irqrestore(&as->lock, flags);
index ae5ba4ddfb40e44ca1d346a3933cd4a46c80fd60..b948ffd94f4587ab3d07e6ccf1743a18a89e9ebd 100644 (file)
@@ -1147,8 +1147,7 @@ rescan:
        case QH_STATE_UNLINK:           /* wait for hw to finish? */
 idle_timeout:
                spin_unlock_irqrestore (&ehci->lock, flags);
-               set_current_state (TASK_UNINTERRUPTIBLE);
-               schedule_timeout (1);
+               schedule_timeout_uninterruptible(1);
                goto rescan;
        case QH_STATE_IDLE:             /* fully unlinked */
                if (list_empty (&qh->qtd_list)) {
index 56b43f2a0e52c3eaaa750bebd7fb94e27f16d2bd..ddaa9c82c58dd5e0de854f399cf7a11f6b93f9d4 100644 (file)
@@ -382,8 +382,7 @@ sanitize:
                        goto sanitize;
                }
                spin_unlock_irqrestore (&ohci->lock, flags);
-               set_current_state (TASK_UNINTERRUPTIBLE);
-               schedule_timeout (1);
+               schedule_timeout_uninterruptible(1);
                goto rescan;
        case ED_IDLE:           /* fully unlinked */
                if (list_empty (&ed->td_list)) {
index 05c44ae3ed32adce07adbfb0a3d05edfdc5c1979..9ee1aaff2fcdc759a8f0fa28864eb58a5719ddf6 100644 (file)
@@ -610,8 +610,7 @@ static void cypress_close(struct usb_serial_port *port, struct file * filp)
                timeout = max((HZ*2560)/bps,HZ/10);
        else
                timeout = 2*HZ;
-       set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(timeout);
+       schedule_timeout_interruptible(timeout);
 
        dbg("%s - stopping urbs", __FUNCTION__);
        usb_kill_urb (port->interrupt_in_urb);
index 461474176cfbc8aae66081e1dc1c3b3117c83c37..ea8c6e74be4f441ce1224c2de18ddc963cd0409e 100644 (file)
@@ -652,8 +652,7 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
                timeout = max((HZ*2560)/bps,HZ/10);
        else
                timeout = 2*HZ;
-       set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(timeout);
+       schedule_timeout_interruptible(timeout);
 
        /* shutdown our urbs */
        dbg("%s - shutting down urbs", __FUNCTION__);