[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1101271034490.2090-100000@iolanthe.rowland.org>
Date: Thu, 27 Jan 2011 10:36:15 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Yin Kangkai <kangkai.yin@...el.com>
cc: linux-usb@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
David Brownell <dbrownell@...rs.sourceforge.net>,
<linux-kernel@...r.kernel.org>
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists