From 22c438632850c0d6257b45c90afed0cea6953afc Mon Sep 17 00:00:00 2001 From: Nishanth Aravamudan Date: Mon, 15 Aug 2005 11:30:11 -0700 Subject: [PATCH] [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: Nishanth Aravamudan Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/audio.c | 12 ++++++++---- drivers/usb/host/ehci-hcd.c | 3 +-- drivers/usb/host/ohci-hcd.c | 3 +-- drivers/usb/serial/cypress_m8.c | 3 +-- drivers/usb/serial/pl2303.c | 3 +-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c index f8f21567cc..50858273f8 100644 --- a/drivers/usb/class/audio.c +++ b/drivers/usb/class/audio.c @@ -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); diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index ae5ba4ddfb..b948ffd94f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -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)) { diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 56b43f2a0e..ddaa9c82c5 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -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)) { diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 05c44ae3ed..9ee1aaff2f 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -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); diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 461474176c..ea8c6e74be 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -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__); -- 2.39.2