linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: otg: twl4030-usb: spin_unlock_irq in interrupt handler
@ 2012-07-21  7:40 Denis Efremov
  2012-08-09  9:37 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Efremov @ 2012-07-21  7:40 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Denis Efremov, Greg Kroah-Hartman, linux-usb, linux-kernel

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-11 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-21  7:40 [PATCH] usb: otg: twl4030-usb: spin_unlock_irq in interrupt handler Denis Efremov
2012-08-09  9:37 ` Felipe Balbi
2012-08-11 11:31   ` Denis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).