public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: musb: Fix locking errors for host only mode
@ 2016-08-18 22:40 Tony Lindgren
       [not found] ` <1471560038-6243-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2016-08-18 22:40 UTC (permalink / raw)
  To: Bin Liu
  Cc: Andreas Kemnade, Felipe Balbi, George Cherian,
	Kishon Vijay Abraham I, Ivaylo Dimitrov, Ladislav Michl,
	Sergei Shtylyov, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

If we have USB gadgets disabled and USB_MUSB_HOST set, we get
errors "possible irq lock inverssion dependency detected"
errors during boot.

Let's fix the issue by adding start_musb flag and start
the controller after we're out of the spinlock protected
section.

Reported-by: Ladislav Michl <ladis-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
Tested-by: Ladislav Michl <ladis-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/musb/musb_virthub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index 192248f..fe08e77 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -290,6 +290,7 @@ int musb_hub_control(
 	u32		temp;
 	int		retval = 0;
 	unsigned long	flags;
+	bool		start_musb = false;
 
 	spin_lock_irqsave(&musb->lock, flags);
 
@@ -390,7 +391,7 @@ int musb_hub_control(
 			 * logic relating to VBUS power-up.
 			 */
 			if (!hcd->self.is_b_host && musb_has_gadget(musb))
-				musb_start(musb);
+				start_musb = true;
 			break;
 		case USB_PORT_FEAT_RESET:
 			musb_port_reset(musb, true);
@@ -451,5 +452,9 @@ error:
 		retval = -EPIPE;
 	}
 	spin_unlock_irqrestore(&musb->lock, flags);
+
+	if (start_musb)
+		musb_start(musb);
+
 	return retval;
 }
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-08-26 15:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18 22:40 [PATCH] usb: musb: Fix locking errors for host only mode Tony Lindgren
     [not found] ` <1471560038-6243-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-08-24 18:46   ` Bin Liu
2016-08-24 19:15     ` Tony Lindgren
     [not found]       ` <20160824191508.nf63okevka5kkfks-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-08-24 19:29         ` Tony Lindgren
     [not found]           ` <20160824192926.bjfgzbzhaj5cg4o5-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-08-24 19:33             ` Bin Liu
2016-08-25 17:18   ` Bin Liu
2016-08-26 14:39     ` Tony Lindgren
     [not found]       ` <20160826143904.ew3cufraegj7rbjm-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-08-26 14:56         ` Bin Liu
2016-08-26 14:57           ` Tony Lindgren
     [not found]             ` <20160826145738.ptsdhdbcn3vudszb-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-08-26 15:14               ` Bin Liu
2016-08-26 15:25                 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox