[PATCH] usb: otg: twl4030-usb: spin_unlock_irq in interrupt handler

From: Denis Efremov
Date: Sat Jul 21 2012 - 03:37:22 EST


The replacement of spin_lock_irq/spin_unlock_irq pair in
twl4030_usb_linkstat function by
spin_lock_irqsave/spin_lock_irqrestore pair.
The twl4030_usb_linkstat function is called from twl4030_usb_irq
interrupt handler. Therefore reenabling of handler interrupt line
should be avoided.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <yefremov.denis@xxxxxxxxx>
---
drivers/usb/otg/twl4030-usb.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index c4a86da..c89a2f5 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -251,6 +251,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
int status;
int linkstat = USB_EVENT_NONE;
struct usb_otg *otg = twl->phy.otg;
+ unsigned long flags;

twl->vbus_supplied = false;

@@ -288,7 +289,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
* are registered, and that both are active...
*/

- spin_lock_irq(&twl->lock);
+ spin_lock_irqsave(&twl->lock, flags);
twl->linkstat = linkstat;
if (linkstat == USB_EVENT_ID) {
otg->default_a = true;
@@ -297,7 +298,7 @@ static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl)
otg->default_a = false;
twl->phy.state = OTG_STATE_B_IDLE;
}
- spin_unlock_irq(&twl->lock);
+ spin_unlock_irqrestore(&twl->lock, flags);

return linkstat;
}
--
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/