From patchwork Wed Apr 13 21:10:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Vacura X-Patchwork-Id: 12812668 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C228C43219 for ; Wed, 13 Apr 2022 21:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239091AbiDMVNp (ORCPT ); Wed, 13 Apr 2022 17:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239079AbiDMVN2 (ORCPT ); Wed, 13 Apr 2022 17:13:28 -0400 Received: from mail1.bemta33.messagelabs.com (mail1.bemta33.messagelabs.com [67.219.247.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEF4517DB; Wed, 13 Apr 2022 14:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; s=Selector; t=1649884264; i=@motorola.com; bh=ogcplI9Tnxc1mgIdMwyPuytn09r79YioJeB19NGtmqs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding; b=r/iTO2WaIYJBrq5ghm3qE4L2saSImIaR8HA9jZ1CGB7t3IPvkbyATHwHdHy6frlgV BJRJTmNHA00YB3ztLWHJmbP3cuSMijvt3Yt3fMV+j9li4feel4ugI/M8CR08dgzrNL ou7d8RL1Pok3wrB+S65PXWeNc1m3eLfiQ+3r8oW9bzter3EZU9t2hgiQHwhtbvEcGL HgUc445MpspoJ91gRJK9FNpAxSCzg/JeifLKsKZICf5cEfxA/Dx9vQoV0ypkQBA21K eWiAQSZbZ+luhmS7MnW3IG2r70TgLM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aKjFXFScCAArj64wRAMAAA== X-Env-Sender: w36195@motorola.com X-Msg-Ref: server-26.tower-635.messagelabs.com!1649884263!3107!1 X-Originating-IP: [104.232.228.22] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.85.8; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17649 invoked from network); 13 Apr 2022 21:11:04 -0000 Received: from unknown (HELO va32lpfpp02.lenovo.com) (104.232.228.22) by server-26.tower-635.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Apr 2022 21:11:04 -0000 Received: from ilclmmrp01.lenovo.com (ilclmmrp01.mot.com [100.65.83.165]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by va32lpfpp02.lenovo.com (Postfix) with ESMTPS id 4KdwHW5wSpz50GGs; Wed, 13 Apr 2022 21:11:03 +0000 (UTC) Received: from p1g3.. (unknown [10.45.4.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: w36195) by ilclmmrp01.lenovo.com (Postfix) with ESMTPSA id 4KdwHW3wGBzbq6Q; Wed, 13 Apr 2022 21:11:03 +0000 (UTC) From: Dan Vacura To: linux-usb@vger.kernel.org Cc: Vijayavardhan Vennapusa , Dan Vacura , Felipe Balbi , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH] usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind() Date: Wed, 13 Apr 2022 16:10:38 -0500 Message-Id: <20220413211038.72797-1-w36195@motorola.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Vijayavardhan Vennapusa If any function like UVC is deactivating gadget as part of composition switch which results in not calling pullup enablement, it is not getting enabled after switch to new composition due to this deactivation flag not cleared. This results in USB enumeration not happening after switch to new USB composition. Hence clear deactivation flag inside gadget structure in configfs_composite_unbind() before switch to new USB composition. Signed-off-by: Vijayavardhan Vennapusa Signed-off-by: Dan Vacura --- drivers/usb/gadget/configfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 1fb837d9271e..84b73cb03f87 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1438,6 +1438,8 @@ static void configfs_composite_unbind(struct usb_gadget *gadget) usb_ep_autoconfig_reset(cdev->gadget); spin_lock_irqsave(&gi->spinlock, flags); cdev->gadget = NULL; + cdev->deactivations = 0; + gadget->deactivated = false; set_gadget_data(gadget, NULL); spin_unlock_irqrestore(&gi->spinlock, flags); }