From patchwork Tue Sep 19 08:46:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 112974 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4644729qgf; Tue, 19 Sep 2017 01:46:25 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDerNJNPxyvk43drWIJZqbJhBIda6oPJCoUENnpW7qmjYid1PvfP9dh9y0pTuRJ+EBXHpc2 X-Received: by 10.98.71.20 with SMTP id u20mr607991pfa.23.1505810784920; Tue, 19 Sep 2017 01:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505810784; cv=none; d=google.com; s=arc-20160816; b=VCOBQHuugYSYERgYu6O0cTx3JEAP5xhKGgJ06+LcLbBp11IMo8ZuGVyB2Ow5kgsHf/ ShH6fby3oo9qtXWIG7B+MdB3wSoNJUmaKPSzNiQQsBWtFL3zWuvn2EuPCZTQnyQ7t/ck k/2qGvJdwilV6E7eboMP3JIC1iICz5Gu1R5wSX+EnO64pA8RYKHE/Omcg+dOlHxBgqOz 5XPogHw6VkMW3l2fovhHiYvXfe1LRocptBwFONVaqC9CK5nLd7oQpckeTrwejVFH0kFX knds3G6WMyldC7cstIjuO2tq2ajNDdIBDe2OVuZcqpPLGcy542XoP7Z4hXMUFQulodam GYCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=vLUQoLyTDts1mIloj0D9MbZpb12Sc6170ZujEZVGM+c=; b=CQ7bJ3MK8CQ6VCk8UYJf++g5iN12mKuaMvV4cKav/DkAe2JihO9nmntfExaf0bmT89 d8l4riENceW9zw3Xewcb7ILg8/hr7rVx/I1QPZ5wieUkouDpv9ImpCTLSE2vcbd7c8i1 r2+t79FZDhEoSLpkPFeikwS4CMsQVjN61J80gptpEs0bZ0zGBmyl5IZ/Vek05f35xcEW P3h9S4rP8JnG6O3v9z+Bk4FCr1muYx3VIyoh3wtQwEbE0AuAx1twJ3bLnsKa8DrB05OL UFSjKYdp57nRvgtpTP7NxiBhW0gaguvaoWWpQpHDRPMRT1zeWfk2CEeGx/Rv1L652j1t ahPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=m3oPq9he; 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 k11si1045250pgr.75.2017.09.19.01.46.24; Tue, 19 Sep 2017 01:46:24 -0700 (PDT) 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=m3oPq9he; 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 S1751283AbdISIqX (ORCPT + 7 others); Tue, 19 Sep 2017 04:46:23 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:45030 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750948AbdISIqX (ORCPT ); Tue, 19 Sep 2017 04:46:23 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8J8kLc9027599; Tue, 19 Sep 2017 03:46:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1505810781; bh=qegiygVsh9SmYgj9aCW7Fswbo1toDckpMXRp7SXVkBk=; h=From:To:CC:Subject:Date; b=m3oPq9hekGParLmW6oMIYGsXSyqg3I3m5Er3UIwuzOxb+VhOGGbzJj5ctsunIgp2z qJxx1JFfKdCWlu4vKeJU97EFo8rEqQ5UuA5qhknk7eRVG/fdTn9/vvARG//IfzHVXm ID9dGK6k0ZqBfbK8pX8tLDotMZPtCfvd4T5TN/aQ= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8J8kLLp014254; Tue, 19 Sep 2017 03:46:21 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 19 Sep 2017 03:46:20 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 19 Sep 2017 03:46:20 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8J8kINI028464; Tue, 19 Sep 2017 03:46:19 -0500 From: Roger Quadros To: CC: , , , Roger Quadros , "[v4.13+]" Subject: [PATCH] usb: gadget: core: fix ->udc_set_speed() logic Date: Tue, 19 Sep 2017 11:46:16 +0300 Message-ID: <1505810776-29361-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 Consider the following case: udc controller supports SuperSpeed. If we first load a HighSpeed gadget followed by a SuperSpeed gadget, the SuperSpeed gadget will be limited to HighSpeed as UDC core driver doesn't call ->udc_set_speed() in the second case. Call ->udc_set_speed() unconditionally to fix this issue. This will also fix the case for dwc3 controller driver when SuperSpeed gadget is loaded first and works in HighSpeed only as udc_set_speed() was never being called. Fixes: 6099eca796ae ("usb: gadget: core: introduce ->udc_set_speed() method") Cc: [v4.13+] Signed-off-by: Roger Quadros --- drivers/usb/gadget/udc/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.7.4 Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 75c51ca..d41d07a 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1320,8 +1320,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri udc->dev.driver = &driver->driver; udc->gadget->dev.driver = &driver->driver; - if (driver->max_speed < udc->gadget->max_speed) - usb_gadget_udc_set_speed(udc, driver->max_speed); + usb_gadget_udc_set_speed(udc, driver->max_speed); ret = driver->bind(udc->gadget, driver); if (ret)