From david-b@pacbell.net Tue Jan 9 16:16:46 2007 From: Marc Pignat Date: Tue, 9 Jan 2007 14:00:11 -0800 Subject: USB: ohci-at91 refcount fix for irq wake enables To: Greg KH Cc: linux-usb-devel@lists.sourceforge.net, marc.pignat@hevs.ch, Andrew Victor Message-ID: <200701091400.12300.david-b@pacbell.net> Content-Disposition: inline From: Marc Pignat The attached patch fixes the unbalanced calls to enable_irq_wake() and disable_irq_wake() in the AT91 USB Host driver. It should resolve these kernel messages: Unbalanced IRQ x wake disable BUG: warning at kernel/irq/manage.c:167/set_irq_wake() (The original code was debugged before a bug in the genirq wakeup irq logic was fixed by adding the IRQ wake enable/disable refcounting. Not all code yet uses the bugfixed model.) Signed-off-by: Andrew Victor Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-at91.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- gregkh-2.6.orig/drivers/usb/host/ohci-at91.c +++ gregkh-2.6/drivers/usb/host/ohci-at91.c @@ -170,7 +170,6 @@ static int usb_hcd_at91_remove(struct us at91_stop_hc(pdev); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); - disable_irq_wake(hcd->irq); clk_put(fclk); clk_put(iclk); @@ -271,8 +270,6 @@ ohci_hcd_at91_drv_suspend(struct platfor if (device_may_wakeup(&pdev->dev)) enable_irq_wake(hcd->irq); - else - disable_irq_wake(hcd->irq); /* * The integrated transceivers seem unable to notice disconnect, @@ -293,6 +290,11 @@ ohci_hcd_at91_drv_suspend(struct platfor static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) { + struct usb_hcd *hcd = platform_get_drvdata(pdev); + + if (device_may_wakeup(&pdev->dev)) + disable_irq_wake(hcd->irq); + if (!clocked) { clk_enable(iclk); clk_enable(fclk);