Commit fd7b635d authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: fix MSEC_TO_JIFFIES in usb code

Here are some MSEC_TO_JIFFIES() fixes missed by whoever did it,
plus a minor fix to grab root_hub->serialize() during OHCI
suspend.  (I forgot to cut/paste those lines from resume.)
parent 676ab9a6
......@@ -769,7 +769,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
* and make khubd collect PORT_STAT_C_SUSPEND to
* stop that signaling.
*/
ehci->reset_done [i] = jiffies + MSEC_TO_JIFFIES (20);
ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
mod_timer (&ehci->hcd.rh_timer,
ehci->reset_done [i] + 1);
ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
......
......@@ -75,7 +75,7 @@ static int ehci_hub_suspend (struct usb_hcd *hcd)
(void) handshake (&ehci->regs->status, STS_HALT, STS_HALT, 2000);
root->dev.power.power_state = 3;
ehci->next_statechange = jiffies + MSEC_TO_JIFFIES(10);
ehci->next_statechange = jiffies + msecs_to_jiffies(10);
spin_unlock_irq (&ehci->lock);
return status;
}
......@@ -112,7 +112,7 @@ static int ehci_hub_resume (struct usb_hcd *hcd)
temp = readl (&ehci->regs->port_status [i]);
temp &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E);
if (temp & PORT_SUSPEND) {
ehci->reset_done [i] = jiffies + MSEC_TO_JIFFIES (20);
ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
temp |= PORT_RESUME;
}
writel (temp, &ehci->regs->port_status [i]);
......@@ -139,7 +139,7 @@ static int ehci_hub_resume (struct usb_hcd *hcd)
writel (ehci->command | temp, &ehci->regs->command);
root->dev.power.power_state = 0;
ehci->next_statechange = jiffies + MSEC_TO_JIFFIES(5);
ehci->next_statechange = jiffies + msecs_to_jiffies(5);
ehci->hcd.state = USB_STATE_RUNNING;
return 0;
}
......@@ -334,7 +334,7 @@ static int ehci_hub_control (
writel ((temp & ~PORT_WAKE_BITS) | PORT_RESUME,
&ehci->regs->port_status [wIndex]);
ehci->reset_done [wIndex] = jiffies
+ MSEC_TO_JIFFIES (20);
+ msecs_to_jiffies (20);
}
break;
case USB_PORT_FEAT_C_SUSPEND:
......@@ -514,7 +514,7 @@ static int ehci_hub_control (
* usb 2.0 spec says 50 ms resets on root
*/
ehci->reset_done [wIndex] = jiffies
+ MSEC_TO_JIFFIES (50);
+ msecs_to_jiffies (50);
}
writel (temp, &ehci->regs->port_status [wIndex]);
break;
......
......@@ -596,12 +596,10 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
/*-------------------------------------------------------------------------*/
#define MSEC_TO_JIFFIES(msec) ((HZ * (msec) + 999) / 1000)
static inline void msec_delay(int msec)
static inline void msec_delay(unsigned msec)
{
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSEC_TO_JIFFIES(msec));
schedule_timeout(msecs_to_jiffies(msec));
}
#ifndef DEBUG
......
......@@ -143,7 +143,7 @@ static int ohci_hub_suspend (struct usb_hcd *hcd)
(void) readl (&ohci->regs->control);
/* no resumes until devices finish suspending */
ohci->next_statechange = jiffies + MSEC_TO_JIFFIES (5);
ohci->next_statechange = jiffies + msecs_to_jiffies (5);
succeed:
/* it's not USB_STATE_SUSPENDED unless access to this
......@@ -262,7 +262,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
root->dev.power.power_state = 0;
/* keep it alive for ~5x suspend + resume costs */
ohci->next_statechange = jiffies + MSEC_TO_JIFFIES (250);
ohci->next_statechange = jiffies + msecs_to_jiffies (250);
/* maybe turn schedules back on */
enables = 0;
......
......@@ -127,8 +127,9 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
#ifdef CONFIG_USB_SUSPEND
(void) usb_suspend_device (hcd->self.root_hub);
#else
/* FIXME lock root hub */
down (&hcd->self.root_hub->serialize);
(void) ohci_hub_suspend (hcd);
up (&hcd->self.root_hub->serialize);
#endif
/* let things settle down a bit */
......
......@@ -397,12 +397,10 @@ static inline void disable (struct ohci_hcd *ohci)
ohci->hcd.state = USB_STATE_HALT;
}
#define MSEC_TO_JIFFIES(msec) ((HZ * (msec) + 999) / 1000)
static inline void msec_delay(int msec)
static inline void msec_delay(unsigned msec)
{
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSEC_TO_JIFFIES(msec));
schedule_timeout(msecs_to_jiffies(msec));
}
#define FI 0x2edf /* 12000 bits per frame (-1) */
......
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