lkml.org 
[lkml]   [2019]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb: musb: Force-disable pullup on shutdown
Date
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
\
 
 \ /
  Last update: 2019-03-21 15:43    [W:0.103 / U:8.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site