Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp728552img; Thu, 21 Mar 2019 07:45:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9vYAg8SWL0X5ZhzAmbBgG34gwE3sUlLoarwM5k0Z6AwacOsMKJlzedP2jZogZ2gX/ET43 X-Received: by 2002:a17:902:8c84:: with SMTP id t4mr3916677plo.298.1553179543804; Thu, 21 Mar 2019 07:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553179543; cv=none; d=google.com; s=arc-20160816; b=L0eoEInvSfPWKCV1visCywrp+sDsfD2XxiFe+4ij2zvJISHC1p8b4Bpc0A/BqFM59i SCDvQl+gI88hvtcKOd0NFUeipqgLXNQiWbVwD6MwkWTnNV9V1hiv9LPPOsPtoflDpY6+ 6+43R+8bVys9m8VAo2twZo6rclroJUJ8zrU/nEU8uT6OsbssjQkCuJ6dYfa4zl1oePQ+ Ka8836Q6l0GYZz+taDoZ6wdpNXmJdSDG9iIDXcHxcIxD+8gu6MSrrKqTKT1pVY9H44uq KdZaSq6ZsOlhQ2CdxP4PvbqJ/rxKbFTEA3gRQxTibB7SHZPHFi9ybFBAlQ4uyr+e/mDF g5iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Y6zik/OXb4wlKL56pTqENQbTKhIMGne//RzaGCY864Y=; b=qHTQQV36jNKYN01BaUjOXr5iaH6taWbQE8B4Pqd2Fd7Yna6lvS9Ejo6veaAhd0Yj5X AaXCFrgOc3zYBoE8urKKcXiNOZvgEu415Hc0B1GZsPK9ihyxyxC1MXjhVBv05tTejIga f/y45sG+ztB3PHdR1YlcFigvdGwkgHbfI1jRTJQHsdR7gNylGhodRcZzQB6zffi0XV0k re+PkYX3+UQMcEUtvQUi8joqmkyd0awT0GfsHcUbPpitM9GpP9OXRMSkFWQYalr8CXlh MAYeWDekOw8JnHVLKX3Ci9Kg0x4ByWSu79FodpNRZtDDZL25am2FX+GQIMZ/tsuD7L46 59lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=eKhlECiA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si4287867pfi.286.2019.03.21.07.45.25; Thu, 21 Mar 2019 07:45:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=eKhlECiA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbfCUOm5 (ORCPT + 99 others); Thu, 21 Mar 2019 10:42:57 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:41366 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728085AbfCUOm5 (ORCPT ); Thu, 21 Mar 2019 10:42:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1553179373; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Y6zik/OXb4wlKL56pTqENQbTKhIMGne//RzaGCY864Y=; b=eKhlECiAwPXB7Rd8KV0/LkWmDTrDj8bQgaejHKKnMa3o4bLht0HOK7UicWVKTPKjs5pnfx VQfETFXZiT0Qf5WURG5Jbk/YXm/FbTx+ww0N95o7vPWtcACSuk8QnjuRLZrPcemlFXP2Pi u2H5YbDAHAa+qDZQPjjw663UzmWFhTY= From: Paul Cercueil To: Bin Liu Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil Subject: [PATCH] usb: musb: Force-disable pullup on shutdown Date: Thu, 21 Mar 2019 15:42:46 +0100 Message-Id: <20190321144246.3547-1-paul@crapouillou.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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