lkml.org 
[lkml]   [2011]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] USB: EHCI: fix scheduling while atomic during suspend
On Thu, 27 Jan 2011, Yin Kangkai wrote:

> There is a msleep with spin lock held during ehci pci suspend, which will
> cause kernel BUG: scheduling while atomic. Fix that.

> diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
> index 86f0815..a16c94a 100644
> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -111,14 +111,19 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
> {
> int port;
> u32 temp;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&ehci->lock, flags);
>
> /* If remote wakeup is enabled for the root hub but disabled
> * for the controller, we must adjust all the port wakeup flags
> * when the controller is suspended or resumed. In all other
> * cases they don't need to be changed.
> */
> - if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup)
> + if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) {
> + spin_unlock_irqrestore(&ehci->lock, flags);
> return;
> + }

You should move the spin_lock_irqsave() down to here. Then the
spin_unlock_irqrestore() above won't be needed.

Alan Stern



\
 
 \ /
  Last update: 2011-01-27 16:39    [W:0.043 / U:2.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site