mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Bin Liu <b-liu@ti.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	od@zcrc.me, Paul Cercueil <paul@crapouillou.net>
Subject: [PATCH] usb: musb: Force-disable pullup on shutdown
Date: Thu, 21 Mar 2019 15:42:46 +0100	[thread overview]
Message-ID: <20190321144246.3547-1-paul@crapouillou.net> (raw)

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


             reply	other threads:[~2019-03-21 14:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 14:42 Paul Cercueil [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190321144246.3547-1-paul@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=b-liu@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=od@zcrc.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®