diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-07-11 11:23:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-16 19:56:48 -0400 |
commit | c4f3476436f7452b97c8accb5dd7d53219a11a3f (patch) | |
tree | 95711a24bb4357dab53d4641aae5a09292974fb8 /drivers/usb/host/ehci-tegra.c | |
parent | f42890782241a60d107f23d08089a4a12b507a11 (diff) |
USB: EHCI: fix up locking
This patch (as1588) adjusts the locking in ehci-hcd's various halt,
shutdown, and suspend/resume pathways. We want to hold the spinlock
while writing device registers and accessing shared variables, but not
while polling in a loop.
In addition, there's no need to call ehci_work() at times when no URBs
can be active, i.e., in ehci_stop() and ehci_bus_suspend().
Finally, ehci_adjust_port_wakeup_flags() is called only in situations
where interrupts are enabled; therefore it can use spin_lock_irq
rather than spin_lock_irqsave.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci-tegra.c')
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index f7f3ce3275b8..65360945df78 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -445,12 +445,11 @@ static int controller_suspend(struct device *dev) | |||
445 | if (time_before(jiffies, ehci->next_statechange)) | 445 | if (time_before(jiffies, ehci->next_statechange)) |
446 | msleep(10); | 446 | msleep(10); |
447 | 447 | ||
448 | spin_lock_irqsave(&ehci->lock, flags); | 448 | ehci_halt(ehci); |
449 | 449 | ||
450 | spin_lock_irqsave(&ehci->lock, flags); | ||
450 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | 451 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; |
451 | ehci_halt(ehci); | ||
452 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 452 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
453 | |||
454 | spin_unlock_irqrestore(&ehci->lock, flags); | 453 | spin_unlock_irqrestore(&ehci->lock, flags); |
455 | 454 | ||
456 | tegra_ehci_power_down(hcd); | 455 | tegra_ehci_power_down(hcd); |