提交 0be930c5 编写于 作者: O Olav Kongas 提交者: Greg Kroah-Hartman

[PATCH] USB: isp116x-hcd: replace mdelay() by msleep()

Replace mdelay() by msleep() in bus_suspend(); the rest of the system will
gain 7ms. The related code is reorganized to minimize the number of
locking/unlocking calls.

The last hunk of the patch is the formatting change by Lindent.
Signed-off-by: NOlav Kongas <ok@artecdesign.ee>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 e9aa795a
...@@ -1420,20 +1420,22 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd) ...@@ -1420,20 +1420,22 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd)
int ret = 0; int ret = 0;
spin_lock_irqsave(&isp116x->lock, flags); spin_lock_irqsave(&isp116x->lock, flags);
val = isp116x_read_reg32(isp116x, HCCONTROL); val = isp116x_read_reg32(isp116x, HCCONTROL);
switch (val & HCCONTROL_HCFS) { switch (val & HCCONTROL_HCFS) {
case HCCONTROL_USB_OPER: case HCCONTROL_USB_OPER:
spin_unlock_irqrestore(&isp116x->lock, flags);
val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE); val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE);
val |= HCCONTROL_USB_SUSPEND; val |= HCCONTROL_USB_SUSPEND;
if (device_may_wakeup(&hcd->self.root_hub->dev)) if (device_may_wakeup(&hcd->self.root_hub->dev))
val |= HCCONTROL_RWE; val |= HCCONTROL_RWE;
/* Wait for usb transfers to finish */ /* Wait for usb transfers to finish */
mdelay(2); msleep(2);
spin_lock_irqsave(&isp116x->lock, flags);
isp116x_write_reg32(isp116x, HCCONTROL, val); isp116x_write_reg32(isp116x, HCCONTROL, val);
spin_unlock_irqrestore(&isp116x->lock, flags);
/* Wait for devices to suspend */ /* Wait for devices to suspend */
mdelay(5); msleep(5);
case HCCONTROL_USB_SUSPEND:
break; break;
case HCCONTROL_USB_RESUME: case HCCONTROL_USB_RESUME:
isp116x_write_reg32(isp116x, HCCONTROL, isp116x_write_reg32(isp116x, HCCONTROL,
...@@ -1441,12 +1443,11 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd) ...@@ -1441,12 +1443,11 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd)
HCCONTROL_USB_RESET); HCCONTROL_USB_RESET);
case HCCONTROL_USB_RESET: case HCCONTROL_USB_RESET:
ret = -EBUSY; ret = -EBUSY;
default: /* HCCONTROL_USB_SUSPEND */
spin_unlock_irqrestore(&isp116x->lock, flags);
break; break;
default:
ret = -EINVAL;
} }
spin_unlock_irqrestore(&isp116x->lock, flags);
return ret; return ret;
} }
...@@ -1715,9 +1716,9 @@ static struct platform_driver isp116x_driver = { ...@@ -1715,9 +1716,9 @@ static struct platform_driver isp116x_driver = {
.remove = isp116x_remove, .remove = isp116x_remove,
.suspend = isp116x_suspend, .suspend = isp116x_suspend,
.resume = isp116x_resume, .resume = isp116x_resume,
.driver = { .driver = {
.name = (char *)hcd_name, .name = (char *)hcd_name,
}, },
}; };
/*-----------------------------------------------------------------*/ /*-----------------------------------------------------------------*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册