From patchwork Tue Feb 27 10:54:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 129766 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1247839lja; Tue, 27 Feb 2018 02:54:48 -0800 (PST) X-Google-Smtp-Source: AH8x225KGsAJ950tKqJ9GYBbFZLV3OjzoU3tdn1AFJl/OtrFvnE6bNM0JmautM7XghJ34fqvpJWt X-Received: by 10.99.116.23 with SMTP id p23mr10742990pgc.178.1519728888569; Tue, 27 Feb 2018 02:54:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519728888; cv=none; d=google.com; s=arc-20160816; b=KAEeUS6roUW9G4yDuH6JYWLPcO3dzPrYRdk7FqyH/Km5qmyMC4ZJMtPuMM3JqNFUIq y9mwxLwlO/qecQMvjDtCMGtV/z9EVylABkXB/6/ftuN6p1EkTwZzZRGnsSlGq2ZX+Shf 9djH2X+47XHKBDgXDX3IdIrHxFv/cv1EqiQgG3s9wrQStI58ipvOhD/5sg8VXFl9a/6X 7o8MlrBm2NP2RjY2Aa46MdHQE+c1/FmCNvag49OrsrnOxS2NccibA5mhDfE1tDljwPId qt0RLooVe3D+jKOBkMeiJvir98bQ6GLll/Lf9qBD0YbKxc/NY9FwbWYAFiUAUltUoQ7T i3gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=5Pbq01ywFxrVoKvgfOQJLLrUpb46WofKxS28r6YxrnY=; b=RKVlowagjZyQdi8mSI+fMfNTsKo4ebE0ay01n3sFCazmd9zaO3hTBYC/lqtnnax3qa 7mGO30/fwzXBS8RWCGfUPBhn5HK+dJIPwssXvugy20ISMth2zSB1n2E5quPj0hGpam3n FLY+3TZhLKhV0a/UtLhMzndaLB0s5migPCi3tSwiohX7pROOax9+L17hWnW5RSUXtBlG EMHyLzf5pXB51IzCSsuecfPi4ZyedfqfeyxM0UFgFV/2+qVGXuvtJLw8AABkFkCw61J2 GhGVgX46Tf/f33mQiYSMHYXv+iXvt6qVyQ1jVHZpJxf/Iuaist9+nFbXNA9gV8CN6Gwg dAXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PEQwB2Il; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k21si8356173pff.287.2018.02.27.02.54.48; Tue, 27 Feb 2018 02:54:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PEQwB2Il; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752670AbeB0Kyr (ORCPT + 10 others); Tue, 27 Feb 2018 05:54:47 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:41668 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752526AbeB0Kyq (ORCPT ); Tue, 27 Feb 2018 05:54:46 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1RAsi8c024396; Tue, 27 Feb 2018 04:54:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519728884; bh=TDEozNzsRYFKmv+raO29GbHqAE4bWPhcbF7OKHzspZY=; h=From:To:CC:Subject:Date; b=PEQwB2IljLvbnHzGx3yFvfPt9Mul/B4KW9328OGTrbosmjfcRy4dIxAK+my1CAa3D u7v2IYTyFQO6G2qPav16gwMd9Az6c/KXaAdTIt+d6JGJk/BM2tuDnDQAutEaN5bEYv PG3WquRgiEIiihNbfUU5mfNU+ZP3dtVwmDAHfhsY= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RAsigF024072; Tue, 27 Feb 2018 04:54:44 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 27 Feb 2018 04:54:44 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 27 Feb 2018 04:54:43 -0600 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RAshc1026533; Tue, 27 Feb 2018 04:54:43 -0600 Received: from lta0400828d.ti.com (vboxa0400828d.emea.dhcp.ti.com [172.22.233.227]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RAsesZ019928; Tue, 27 Feb 2018 04:54:41 -0600 From: Roger Quadros To: CC: , , , Roger Quadros , "# v4 . 12+" Subject: [PATCH] usb: dwc3: prevent setting PRTCAP to OTG from debugfs Date: Tue, 27 Feb 2018 12:54:37 +0200 Message-ID: <1519728877-9366-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org We don't support PRTCAP == OTG yet, so prevent user from setting it via debugfs. Fixes: 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly") Cc: # v4.12+ Signed-off-by: Roger Quadros --- drivers/usb/dwc3/core.c | 3 +++ 1 file changed, 3 insertions(+) -- cheers, -roger Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e94bf91..df4569d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -119,6 +119,9 @@ static void __dwc3_set_mode(struct work_struct *work) if (dwc->dr_mode != USB_DR_MODE_OTG) return; + if (dwc->desired_dr_role == DWC3_GCTL_PRTCAP_OTG) + return; + switch (dwc->current_dr_role) { case DWC3_GCTL_PRTCAP_HOST: dwc3_host_exit(dwc);