public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: musb: Force-disable pullup on shutdown
@ 2019-03-21 14:42 Paul Cercueil
  2019-04-01 17:17 ` Bin Liu
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Cercueil @ 2019-03-21 14:42 UTC (permalink / raw)
  To: Bin Liu; +Cc: linux-usb, linux-kernel, od, Paul Cercueil

When the musb is shutdown, for instance when the driver is unloaded,
force-disable the pullup. Otherwise, the host will still see the gadget
device even after the shutdown.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/usb/musb/musb_gadget.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index ffe462a657b1..a78a7391031b 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1808,11 +1808,18 @@ int musb_gadget_setup(struct musb *musb)
 
 void musb_gadget_cleanup(struct musb *musb)
 {
+	unsigned long flags;
+
 	if (musb->port_mode == MUSB_HOST)
 		return;
 
 	cancel_delayed_work_sync(&musb->gadget_work);
 	usb_del_gadget_udc(&musb->g);
+
+	/* Force-disable the pull-up */
+	spin_lock_irqsave(&musb->lock, flags);
+	musb_pullup(musb, 0);
+	spin_unlock_irqrestore(&musb->lock, flags);
 }
 
 /*
-- 
2.11.0


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

end of thread, other threads:[~2019-04-03 18:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-21 14:42 [PATCH] usb: musb: Force-disable pullup on shutdown Paul Cercueil
2019-04-01 17:17 ` Bin Liu
2019-04-01 17:46   ` Paul Cercueil
2019-04-01 18:20     ` Bin Liu
2019-04-02 19:58       ` Paul Cercueil
2019-04-03 13:26         ` Bin Liu
2019-04-03 15:31           ` Paul Cercueil
2019-04-03 15:46             ` Bin Liu
2019-04-03 15:52               ` Paul Cercueil
2019-04-03 18:54                 ` Bin Liu

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