From patchwork Tue Oct 13 09:27:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11835251 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A83D14D5 for ; Tue, 13 Oct 2020 09:28:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00C5F21548 for ; Tue, 13 Oct 2020 09:28:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="XyAi5nHy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403962AbgJMJ22 (ORCPT ); Tue, 13 Oct 2020 05:28:28 -0400 Received: from mail-eopbgr60085.outbound.protection.outlook.com ([40.107.6.85]:54087 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403925AbgJMJ22 (ORCPT ); Tue, 13 Oct 2020 05:28:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Akqp5tZ/a82cdb2LMVSwQ0w0KqDE7X/Kf3yp4yOJhDN+s2iXYrmPKReAslMQqx/LCrj+Pv/NjqFYHbQre6aECdLI7Atcgp/+lPa4Kgo46J747iUm/ugMzPywFadl/nKe5d6ydf9apvL97cteQggLreY9rfZR1PtiJxtrQ+/miLSzntojym+VVlvlS2V9g24C9N5z+bB5KZ/lTDYElozJr+kMgwsLCPTZawUTWr57uj75IYAEL9qVjKVHOJPdXjAaQeehuY0JyY7J9KYWgsEXDiuvL0I3XkdfBgm7tVYwpENXGj9+4SU0j/xN9AKQE6QxfzmziMTY2zc9I6tyDhFwUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k55LTBTg22UkXA+DuTEVqvu423dGP4yE1dNXe4nFM3U=; b=nsdmUmLfn+42esobXrSMcVH5RyrlgtZukgeDdfLDJRLZwx+XO4+jbM+EgiSgnbTI2wDMILyZB7Y7oexRRDVMapF728rTlWsQF5gOiXROVa1pBcPWBvne2joiiRICFnnkOEC2lsOrsBvmHK6iLbsWA6tmUEzhkULfIn9d5mByHyPdab7DjRY9QiTm/d+ZCg2+lqZoKFFTOE+fahryFvEf6qoLi5eq8WQwsxjmrzwO2m5XVbtnl8vwGTxwzomnzE3BQBRl9hT3ske7YopOzJrV3o61XhlAf8RMvB907JL564a7MjkU6CrZm6yU/jEBDu+efG73bIuS7SK6fwwDcxwRNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k55LTBTg22UkXA+DuTEVqvu423dGP4yE1dNXe4nFM3U=; b=XyAi5nHyzJJakSMZ3noPyKkh9JtQed5tMYVlY5BG0XRI5jQuh4ubfQ1nk0gN8o6+/ALdf2OxBNPxEWZru51MYm3R55Tp3b4SJRyj1BM05dK7VL1WsvcEbn21WeO1ujIZk/Ml0s57CpJYgju0AF1xd2b4jOuuRNZcEjrhT/FpMqc= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7300.eurprd04.prod.outlook.com (2603:10a6:20b:1c7::12) by AM0PR04MB6852.eurprd04.prod.outlook.com (2603:10a6:208:18c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.24; Tue, 13 Oct 2020 09:28:25 +0000 Received: from AM8PR04MB7300.eurprd04.prod.outlook.com ([fe80::ad01:9b1c:3b4b:3a77]) by AM8PR04MB7300.eurprd04.prod.outlook.com ([fe80::ad01:9b1c:3b4b:3a77%7]) with mapi id 15.20.3455.030; Tue, 13 Oct 2020 09:28:25 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, Peter Chen Subject: [PATCH RESEND 1/2] usb: gadget: core: change the comment for usb_gadget_connect Date: Tue, 13 Oct 2020 17:27:45 +0800 Message-Id: <20201013092746.10602-1-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR04CA0192.apcprd04.prod.outlook.com (2603:1096:4:14::30) To AM8PR04MB7300.eurprd04.prod.outlook.com (2603:10a6:20b:1c7::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR04CA0192.apcprd04.prod.outlook.com (2603:1096:4:14::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Tue, 13 Oct 2020 09:28:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 26521647-f0b0-4e2c-b45d-08d86f5a55bc X-MS-TrafficTypeDiagnostic: AM0PR04MB6852: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c7dw7EIVyhTBcryIJZCT+HbgfCi9/Gctd1POLf+vRehFE6FtNKo1qU7W5B734WZZ73hZuLl49ULljNJdD7eUhsjxSYmenWU4NF3EFyveVbHxYshF6lV2UTxywDemiT5ltMBJTAhWkHBFKycaCVZvLg/BFjCw0rvb3tDo38xVU6jYFey6tdgDVo/VItrqIO/iKjTmKrVxibqQvKyUCfLAn2OvKV0LK9iBl/B8aswN8dYVE55j+yZrMxx2OJPkop8UN9W4xueyRKuwJ3XYAJZTSKIw2Kl/I4A8iDdhoJ2808SNvvL/SGKXoqEcPd9otlyIQGGv9Ln5Xjz+ir5hcq/Ahw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7300.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(136003)(366004)(376002)(39860400002)(396003)(86362001)(6916009)(44832011)(4326008)(2906002)(6506007)(26005)(8936002)(83380400001)(8676002)(66946007)(66556008)(52116002)(16526019)(5660300002)(478600001)(186003)(36756003)(1076003)(316002)(956004)(6486002)(6666004)(2616005)(66476007)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YZLeZN2ijRt74yCwIVz6IxCRMC0JG5woz43c7Kz1t0+/yVKdzzGVuvJ4c5D1yoW4nvhjFp+mr0kL7ss0VFAgHk5FbcUllCo3r6IKpolibzMi62gigBkwHMxgZro0NJbWnLQt3dpwyQyQQquL5BWN0czh73F2uHXd/dOvIqdTjS7S9f/xWP44mioCQxBw4PNn9lIprGJKJ9DViLXPCaX/U7lk0bmj7ehILGXeUCxRkbJ60okEGehCVO3VebAQ/7ANbOrXDz1ypECX3LqD+S32LB6W0jP4TyQo0YTwxoNvP8Rmaz3FX6FMrPkpw932MnEYbUo7vaH7TZiVJjGdEgJSQuDQo70OFAYcxYnczC9K0S8e5HKhXQgHd9ylcbiAJQujFH9iiuA79DIW6uKd5h5v5uP6SHIRXMz+OtowjXpK11LBla2bCypsiUY34tLk2/lJvBS6Z7TILgtvEnRSM0+al58lXlRF/u6Y/IwoDU5SrBXsBcugppvtWWX8kczhRQsBf17fizsZFbEaymmZ+zd38pv8pLZzsbmy/4Hcw1g9NUiztH83TVDRReKjTsYSU203wqSsVB4i8M8mdI7cohKGxZBx7y4kBp+vHvfV1iExTFzVG9/u2UkjyKz/9eJUMGwHxfdn5luvgUgJvuemub/Wtw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26521647-f0b0-4e2c-b45d-08d86f5a55bc X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7300.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2020 09:28:25.0489 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OsDxnbd+3SXL1w1RApLKgOF8ZUWnXrZZo1SbRm8yBsjc5Tlk1l8jR0C9A58CXLPuGyb9kv0u2EvH6WRyUEYdPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6852 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The pullup does not need to be enabled at below situations: - For platforms which the hardware pullup starts after setting register even they do not see the VBUS. If the pullup is always enabled for these platforms, it will consume more power and break the USB IF compliance tests [1]. - For platforms which need to do BC 1.2 charger detection after seeing the VBUS. Pullup D+ will break the charger detection flow. - For platforms which the system suspend is allowed when the connection with host is there but the bus is not at suspend. For these platforms, it is better to disable pullup when entering the system suspend otherwise the host may confuse the device behavior after controller is in low power mode. Disable pullup is considered as a disconnection event from host side. [1] USB-IF Full and Low Speed Compliance Test Procedure F Back-voltage Testing Section 7.2.1 of the USB specification requires that no device shall supply (source) current on VBUS at its upstream facing port at any time. From VBUS on its upstream facing port, a device may only draw (sink) current. They may not provide power to the pull-up resistor on D+/D- unless VBUS is present (see Section 7.1.5). Signed-off-by: Peter Chen --- drivers/usb/gadget/udc/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index debf54205d22..215ecbe8b692 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -659,8 +659,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_vbus_disconnect); * * Enables the D+ (or potentially D-) pullup. The host will start * enumerating this gadget when the pullup is active and a VBUS session - * is active (the link is powered). This pullup is always enabled unless - * usb_gadget_disconnect() has been used to disable it. + * is active (the link is powered). * * Returns zero on success, else negative errno. */ From patchwork Tue Oct 13 09:27:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11835253 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7B1214D5 for ; Tue, 13 Oct 2020 09:28:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE59821548 for ; Tue, 13 Oct 2020 09:28:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="BkOUXbzb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403988AbgJMJ2e (ORCPT ); Tue, 13 Oct 2020 05:28:34 -0400 Received: from mail-eopbgr10070.outbound.protection.outlook.com ([40.107.1.70]:52033 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403925AbgJMJ2d (ORCPT ); Tue, 13 Oct 2020 05:28:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nYfXff/9IL344zr5K/yKVWo5BUNmtIWEf7Z3DIo/SdZeOTVfymxE11D3Lxln7YCmXO23TlAxP2Sh7fJdWxhr4QZ3V10aheWHkKodVnoDd6KwLij9Sz84YE2B0CbUnsU4yCTYURygDXUP0/uBFhQLYB7do/xonqM9qxXzFmtebGGLEXjczx/8bfJWBkdLPRXl94ksTIhHEToTnedNuKuq9KQ7Si+LvpaahoXvo/sReVFCrSN/R89WtheR/+LXK0Q+aW3g7A5QPSGl66DqgbWdJF/o+KW/0JUhr7woD7j8BekGdncBi9hOz2D/22L0pmS18J2E6LWanPaBsD0scmAhnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HcwPu2s0ELml1pal/3f8ZsMha8SV95c+ez34nWF7IKQ=; b=imIM5QpbSQi9l98jwTdaNND1tUlJgwoIfc4l7V6/iMQD2k+E8TRdN+UAofnour/egUeXktF3Sx7itHcX+PycSxj1ba/uxAddnVo08i849PmNTG0Ed+nQQqXn/En3A0dsHfij4hSXQzw2lbnx568306LZCNjoTLGmxOKHpehYA8CQRkYeuHkWq6MElXU0Fy15YYlhkIR0zJhDJ6J4J3uP+ul+FDSwDAoGOzSXNz/dSPif7vQ9ROe1bQuhroZWbLHQLxdgu3knBvzOrt4JxkAHv7tRv+qVeMKCdDoAL1zrCM3K4ArEYafQo4r+y3x7ruroGIvNklyVW9syeEwIP/rG0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HcwPu2s0ELml1pal/3f8ZsMha8SV95c+ez34nWF7IKQ=; b=BkOUXbzbH54zCekRveN2IeerfYSOluNw7Es8D+o5GAn9DTHQYx6FkcW+o/23duYboIo6MQ9rDkR5jz/BAg6h/zQsYn+uyl3kRn2Jyp7znJ8G/7wAKxxi3IVZHUUmhPtZLhvEz3/RzK95BQucbOrzATLebAtdKOzXUgVdoFE8seg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7300.eurprd04.prod.outlook.com (2603:10a6:20b:1c7::12) by AM0PR0402MB3364.eurprd04.prod.outlook.com (2603:10a6:208:17::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.29; Tue, 13 Oct 2020 09:28:27 +0000 Received: from AM8PR04MB7300.eurprd04.prod.outlook.com ([fe80::ad01:9b1c:3b4b:3a77]) by AM8PR04MB7300.eurprd04.prod.outlook.com ([fe80::ad01:9b1c:3b4b:3a77%7]) with mapi id 15.20.3455.030; Tue, 13 Oct 2020 09:28:27 +0000 From: Peter Chen To: balbi@kernel.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, Peter Chen Subject: [PATCH RESEND 2/2] usb: gadget: core: do not try to disconnect gadget if it is not connected Date: Tue, 13 Oct 2020 17:27:46 +0800 Message-Id: <20201013092746.10602-2-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201013092746.10602-1-peter.chen@nxp.com> References: <20201013092746.10602-1-peter.chen@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR04CA0192.apcprd04.prod.outlook.com (2603:1096:4:14::30) To AM8PR04MB7300.eurprd04.prod.outlook.com (2603:10a6:20b:1c7::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.66) by SG2PR04CA0192.apcprd04.prod.outlook.com (2603:1096:4:14::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Tue, 13 Oct 2020 09:28:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 934468f7-5bd2-444a-3617-08d86f5a56d6 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3364: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pZA2XnKW7fdWn+FUv2MyjuBWwYAv6xjXVlNzy40fLDvsghI5RPUP8u5XzWGgzY9r2MCH9r4y0p5WlEKBHh/56uOH+dwY2/splubgryHsCLNEyNM/Pho5QU1EtbM6o3KFh+7di48hzq3UYckBCC+wWEMEj/LEg9+fS4a+yyCpI8DXIkQ4qABVkXcnQsVbNRutGJvAoAF7oJkGXbx4lfOCNbg/bY6zOzPOCmwv2DldBW7ptzf5Y9R0mGhyd0akCQGXYQEmShDkFC69uuiDtEHf6NZsj1xRjlWuhyJgfgmE8GFbDOnMIuywdLFIqUnD8PnOhSt3jC1hgqTZclrBXRo9bQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7300.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(316002)(4744005)(1076003)(52116002)(956004)(36756003)(66476007)(66556008)(8676002)(6486002)(44832011)(66946007)(4326008)(2616005)(6506007)(16526019)(8936002)(5660300002)(478600001)(6666004)(2906002)(6512007)(6916009)(86362001)(186003)(83380400001)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zm1sFQA0eKh4tV81pCMR1mDKCN/7AKBgXs/CAodLVHXflfCHXOWVMZOhml801XPUjSQzYytACWXn1MI0zDq5xn/AecmMyoNiWC8cdkm+ShYkDDFH8hJe3Thu7TcWV+AFo15L35U7E4XqxZSjv/qTGElQZ1XfNXmGUGujUDLNf/+rJZZgVN83HtL/IzvF78suUqA99MI4okWb2CArCV6yvFFvOR3slAJ4Tv0EucoQU526wwlRCdBrS99YbGUttHCw+Tx7fwImv9cJiQC97U3yZdvLSji2PozpWRNQv6Krf9cR8bpg93xhnOLKh3FTp6BNC/meyMQPxRqDUzVNRxLqj+E9XYLITWcjQYgoZoVHVntQm7XimDhpFZuAluoXvIwn/5O+ICw9b5tSxeSOpn6u6QVsJ+raQglHKREaZdz793GiM+Dvcvv2kepgBlSnIR01m0r5hl4aGRPgBtphZYMrY/SnJ4A+4DQ1+ZKCQG5TPAuK0ZVugd2u7mIRtO9a5nuJ6cqZLxsiEv8FmROiZrCAt65WbXfhkGY+5y3CiCgK8jcNv4BqynUF+br1MVjZklOQPmmEHHhfmeVMMI8VtaeD04iB6g+nGPoLiS14vwFFLuS+TPikg3PralvajM4BwOWhjWNfD9FPzDacxMgMTCVBOw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 934468f7-5bd2-444a-3617-08d86f5a56d6 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7300.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2020 09:28:27.0839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zQbJ87ZABDN9ZPMyFBUjWLgnN6SvVqOWqm4oJFq8mpSah26ZC8J0M/YIQ5gzWybAuPmUOiT3loo0Wb4cZsWKpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3364 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Current UDC core connects gadget during the loading gadget flow (udc_bind_to_driver->usb_udc_connect_control), but for platforms which do not connect gadget if the VBUS is not there, they call usb_gadget_disconnect, but the gadget is not connected at this time, notify disconnecton for the gadget driver is meaningless at this situation. Signed-off-by: Peter Chen --- drivers/usb/gadget/udc/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 215ecbe8b692..8ad4203dea8c 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -672,6 +672,9 @@ int usb_gadget_connect(struct usb_gadget *gadget) goto out; } + if (!gadget->connected) + goto out; + if (gadget->deactivated) { /* * If gadget is deactivated we only save new state.