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: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
int ret = 0;
spin_lock_irqsave(&isp116x->lock, flags);
int ret = 0;
spin_lock_irqsave(&isp116x->lock, flags);
val = isp116x_read_reg32(isp116x, HCCONTROL);
val = isp116x_read_reg32(isp116x, HCCONTROL);
switch (val & HCCONTROL_HCFS) {
case HCCONTROL_USB_OPER:
switch (val & HCCONTROL_HCFS) {
case HCCONTROL_USB_OPER:
+ spin_unlock_irqrestore(&isp116x->lock, flags);
val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE);
val |= HCCONTROL_USB_SUSPEND;
if (device_may_wakeup(&hcd->self.root_hub->dev))
val |= HCCONTROL_RWE;
/* Wait for usb transfers to finish */
val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE);
val |= HCCONTROL_USB_SUSPEND;
if (device_may_wakeup(&hcd->self.root_hub->dev))
val |= HCCONTROL_RWE;
/* Wait for usb transfers to finish */
+ 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);
- case HCCONTROL_USB_SUSPEND:
break;
case HCCONTROL_USB_RESUME:
isp116x_write_reg32(isp116x, HCCONTROL,
break;
case HCCONTROL_USB_RESUME:
isp116x_write_reg32(isp116x, HCCONTROL,
HCCONTROL_USB_RESET);
case HCCONTROL_USB_RESET:
ret = -EBUSY;
HCCONTROL_USB_RESET);
case HCCONTROL_USB_RESET:
ret = -EBUSY;
+ default: /* HCCONTROL_USB_SUSPEND */
+ spin_unlock_irqrestore(&isp116x->lock, flags);
- default:
- ret = -EINVAL;
- spin_unlock_irqrestore(&isp116x->lock, flags);
.remove = isp116x_remove,
.suspend = isp116x_suspend,
.resume = isp116x_resume,
.remove = isp116x_remove,
.suspend = isp116x_suspend,
.resume = isp116x_resume,
- .driver = {
- .name = (char *)hcd_name,
- },
+ .driver = {
+ .name = (char *)hcd_name,
+ },
};
/*-----------------------------------------------------------------*/
};
/*-----------------------------------------------------------------*/