From 65815c0b77237ffee8836c9021ee48612e82b64b Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <greg@kroah.com>
Date: Tue, 18 May 2004 01:58:57 -0700
Subject: [PATCH] USB: remove ehci and ohci's private sleep function and use
 msleep() instead.

---
 drivers/usb/host/ehci-hcd.c | 4 ++--
 drivers/usb/host/ehci.h     | 6 ------
 drivers/usb/host/ohci-hcd.c | 4 ++--
 drivers/usb/host/ohci-hub.c | 4 ++--
 drivers/usb/host/ohci-pci.c | 6 +++---
 drivers/usb/host/ohci.h     | 6 ------
 6 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 172223e87e9a..08fb7643be42 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -632,7 +632,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state)
 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
 
 	while (time_before (jiffies, ehci->next_statechange))
-		msec_delay (100);
+		msleep (100);
 
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub);
@@ -654,7 +654,7 @@ static int ehci_resume (struct usb_hcd *hcd)
 	// maybe restore (PCI) FLADJ
 
 	while (time_before (jiffies, ehci->next_statechange))
-		msec_delay (100);
+		msleep (100);
 
 #ifdef	CONFIG_USB_SUSPEND
 	retval = usb_resume_device (hcd->self.root_hub);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index d2debae2bc7e..ed4d00291f89 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -596,12 +596,6 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
 
 /*-------------------------------------------------------------------------*/
 
-static inline void msec_delay(unsigned msec)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(msec));
-}
-
 #ifndef DEBUG
 #define STUB_DEBUG_FILES
 #endif	/* DEBUG */
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index a695e117af80..b5279a019169 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -417,7 +417,7 @@ static int hc_reset (struct ohci_hcd *ohci)
 		writel (OHCI_INTR_OC, &ohci->regs->intrenable);
 		writel (OHCI_OCR, &ohci->regs->cmdstatus);
 		while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
-			msec_delay (10);
+			msleep (10);
 			if (--temp == 0) {
 				ohci_err (ohci, "USB HC TakeOver failed!\n");
 				return -1;
@@ -451,7 +451,7 @@ static int hc_reset (struct ohci_hcd *ohci)
 	}
 	// flush those pci writes
 	(void) readl (&ohci->regs->control);
-	msec_delay (50);
+	msleep (50);
 
 	/* HC Reset requires max 10 us delay */
 	writel (OHCI_HCR,  &ohci->regs->cmdstatus);
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index ef2015f94c6b..516d87d9c565 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -248,7 +248,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
 	/* Then re-enable operations */
 	writel (OHCI_USB_OPER, &ohci->regs->control);
 	(void) readl (&ohci->regs->control);
-	msec_delay (3);
+	msleep (3);
 
 	temp = OHCI_CONTROL_INIT | OHCI_USB_OPER;
 	if (ohci->hcd.can_wakeup)
@@ -258,7 +258,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
 	(void) readl (&ohci->regs->control);
 
 	/* TRSMRCY */
-	msec_delay (10);
+	msleep (10);
 	root->dev.power.power_state = 0;
 
 	/* keep it alive for ~5x suspend + resume costs */
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index f69036014ff5..0e7f9f804a96 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -122,7 +122,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
 
 	/* suspend root hub, hoping it keeps power during suspend */
 	while (time_before (jiffies, ohci->next_statechange))
-		msec_delay (100);
+		msleep (100);
 
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub);
@@ -133,7 +133,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
 #endif
 
 	/* let things settle down a bit */
-	msec_delay (100);
+	msleep (100);
 	
 #ifdef CONFIG_PMAC_PBOOK
 	if (_machine == _MACH_Pmac)
@@ -170,7 +170,7 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
 
 	/* resume root hub */
 	while (time_before (jiffies, ohci->next_statechange))
-		msec_delay (100);
+		msleep (100);
 #ifdef	CONFIG_USB_SUSPEND
 	/* get extra cleanup even if remote wakeup isn't in use */
 	retval = usb_resume_device (hcd->self.root_hub);
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 10166f9f8e85..70f32ef7271e 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -397,12 +397,6 @@ static inline void disable (struct ohci_hcd *ohci)
 	ohci->hcd.state = USB_STATE_HALT;
 }
 
-static inline void msec_delay(unsigned msec)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(msec));
-}
-
 #define	FI			0x2edf		/* 12000 bits per frame (-1) */
 #define	DEFAULT_FMINTERVAL 	((((6 * (FI - 210)) / 7) << 16) | FI)
 #define LSTHRESH		0x628		/* lowspeed bit threshold */
-- 
2.30.9