Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2625673rwd; Fri, 19 May 2023 08:08:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4cyQp4vkG0KYlXD81nCyEcvxhW6W7XM7pUYU0Vse5+pFCkKT06l8na8f2ZV+Nbzamf8G1K X-Received: by 2002:a17:902:bf06:b0:1ae:2e0f:1cf6 with SMTP id bi6-20020a170902bf0600b001ae2e0f1cf6mr3100930plb.36.1684508908518; Fri, 19 May 2023 08:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684508908; cv=none; d=google.com; s=arc-20160816; b=lDqAQ907ownNQ6P9Rk10kmsqT2AIENTsMKUvlbJqdRjsDps3lAJubIjVZyHLYgIcE8 mnHdUlGUxxgiS6xXu7Tu1wY7WrdsiD3cyv277bWA6va0u5+kYFO1BaglwlmPoAHlwn6z uTPlUy4tAd3IXi8d8CwhFkEYI36LVQj6gaoKZrlmvx/BSRHivWqqx4mee0d9h21mslBq zVf4PU61xeWu9elyPNk6s3sKxp2El5oLv5UEBw8hTHVyb3IpFI7v7tUuaRmdOAF/1vFR QVP0CxcbPFIlwsIBrLRTm7EKQ7/8+eORWSXJ4w3C4mX8UsxV7h03d05Cy5xjrzLnwPhb qPPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=lsr2HTrGZjgBaM5G3PDKZJYa6WAbub8OYz221+zt0xg=; b=zATqvvI3DaYr36M31fHindCOixAZik+jD84p8o47NuNUH+Q5BVeQfp53n0AvQepj1o 5L/pRm7JjnA1F4kxNYJLGaoXbrp6ZZpJlH3grjqCUSHP0sean+3g1XdbT/p+uxWquFgV HaGPkGOPltJLCiy3DOzR7ELsHAQVA7r3ly81ExXGgzp+U7Ch3/5OYNsLIL2X+vNGLaGP mF0UKx+DllWn/5ivNqenf6MHyKkxbVvwl5W8Tlx0nerbC8+2zzRTug0qXMTE1DOSRriI +AYJEqpcOFHN8ainn8wDZXc7mQ+xg+wBQLLC5jSKtzaqgRTOml9wEGVb6dOLGWGm6cFI J41A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a1709026b8900b00199200945a3si3578590plk.74.2023.05.19.08.08.12; Fri, 19 May 2023 08:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229546AbjESOuB (ORCPT + 99 others); Fri, 19 May 2023 10:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbjESOt7 (ORCPT ); Fri, 19 May 2023 10:49:59 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 46A07E7C for ; Fri, 19 May 2023 07:49:49 -0700 (PDT) Received: (qmail 40001 invoked by uid 1000); 19 May 2023 10:49:49 -0400 Date: Fri, 19 May 2023 10:49:49 -0400 From: Alan Stern To: Badhri Jagan Sridharan Cc: gregkh@linuxfoundation.org, colin.i.king@gmail.com, xuetao09@huawei.com, quic_eserrao@quicinc.com, water.zhangjiantao@huawei.com, peter.chen@freescale.com, balbi@ti.com, francesco@dolcini.it, alistair@alistair23.me, stephan@gerhold.net, bagasdotme@gmail.com, luca@z3ntu.xyz, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Francesco Dolcini Subject: Re: [PATCH v2] usb: gadget: udc: core: Offload usb_udc_vbus_handler processing Message-ID: References: <20230519043041.1593578-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230519043041.1593578-1-badhri@google.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 19, 2023 at 04:30:41AM +0000, Badhri Jagan Sridharan wrote: > chipidea udc calls usb_udc_vbus_handler from udc_start gadget > ops causing a deadlock. Avoid this by offloading usb_udc_vbus_handler > processing. Look, this is way overkill. usb_udc_vbus_handler() has only two jobs to do: set udc->vbus and call usb_udc_connect_control(). Furthermore, it gets called from only two drivers: chipidea and max3420. Why not have the callers set udc->vbus themselves and then call usb_gadget_{dis}connect() directly? Then we could eliminate usb_udc_vbus_handler() entirely. And the unnecessary calls -- the ones causing deadlocks -- from within udc_start() and udc_stop() handlers can be removed with no further consequence. This approach simplifies and removes code. Whereas your approach complicates and adds code for no good reason. Alan Stern