Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3824498rwd; Mon, 29 May 2023 17:59:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ce41zJsv28XefSHL5Cd38Fi416fBPT2F/V4o71TUKH/9kyhpQZejeCfd54zK3+7sA4NcY X-Received: by 2002:a17:902:708a:b0:1b0:4883:2e03 with SMTP id z10-20020a170902708a00b001b048832e03mr724120plk.40.1685408392668; Mon, 29 May 2023 17:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685408392; cv=none; d=google.com; s=arc-20160816; b=cc8UtKa/NmptFK0mf9yBKf8iW6WkJ4vhESXUuBJGD91+QIKhtGfjuP3NdPWAXV1RzP OokEqPIgvvIXi0DO1CE1cFCAauaYrEbYX5Zphp+MT7mroOF0zRaGXkccW9UgdEzYv/r0 dXhHyp34C/s8jNs+5KrnaOQV3d0DSgcq6mm4kLGxOSpCdfLGjXG/EXaCECvKbzokSok7 LY18GG0mmECOmi9gZ8ZnM8GkP4D0BXe/Bit6VBn70s5vMtx3iARJxGfbDFe5lPz/8zRq UcoE746C84pqgLZ2CbxoA8tMX65OuhnT2cBA2XGe/7aXj4H9cuEdW3g2LjDda6GwxvuH LZxA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=I8p5L85DZK+ShrGG3Zj8bCM/8EWHSUiXcvr+n45ITvw=; b=EKglJAgMc52IFIhEqypSZ3//PFb7Lr07bPD4e7llUv11ink5wbjVgkyEBNmp8X6lBD xCWMLX5FK/eXsqXfQajkl52iYZb9vQT+L841tu5H64QxZpxQO5FjWki6bLz+E96UTr7P vi2LxPZOruf08VROpooJwTAecyO0bfWBdx+3gdcuWw1QCSQ8x+eJDTmaSA11OMA+5ZpU HKMOw1a7yLqhUnhtwQjD/acDgPHhnunEAtFAZfs5eVbvzoj2xHPQvw63dCrGRDJJV2qT v42BFCk2Vyw0ivdsZhkkZCisuuXAMam1fR7/Yn9gu962K7li0bJgQAH9RZp0oaC2nqmS ZrPQ== 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 k13-20020a170902c40d00b001ae59169f18si12005864plk.414.2023.05.29.17.59.36; Mon, 29 May 2023 17:59:52 -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 S229614AbjE3Ame (ORCPT + 99 others); Mon, 29 May 2023 20:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjE3Amd (ORCPT ); Mon, 29 May 2023 20:42:33 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 4EDEDDB for ; Mon, 29 May 2023 17:42:32 -0700 (PDT) Received: (qmail 389153 invoked by uid 1000); 29 May 2023 20:42:31 -0400 Date: Mon, 29 May 2023 20:42:31 -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, 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, Francesco Dolcini Subject: Re: [PATCH v2] usb: gadget: udc: core: Offload usb_udc_vbus_handler processing Message-ID: <56f54ab7-4c4a-45fc-9d43-c15c1ac07fd9@rowland.harvard.edu> References: <20230519043041.1593578-1-badhri@google.com> <547ecbb2-921d-4714-82b7-066202ccf292@rowland.harvard.edu> <406371f0-db48-4195-b85d-b75ce83e738b@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Mon, May 29, 2023 at 04:32:29PM -0700, Badhri Jagan Sridharan wrote: > On Sat, May 27, 2023 at 9:36 AM Alan Stern wrote: > > > > I think it would be better just to merge the new material into > > usb_gadget_connect() and usb_gadget_disconnect(). > > I ended up merging them into usb_gadget_pullup_update_locked() so that > each of the individual helper function can call > usb_gadget_pullup_update_locked() while holding the connect_lock. I > actually had usb_gadget_(dis)connect() set udc->vbus. What? No, that's not right. They are two completely separate concepts. The host controls VBUS and the gadget controls the pullup. > It appears to me > that both usb_gadget_(dis)connect() and usb_udc_vbus_handler() are > meant to be called based on vbus presence and hence seem to be > redundant. They are not. We need to support turning off the pullup while VBUS is on. > Wondering if we could get rid of usb_gadget_(dis)connect() > given that drivers/power/supply/isp1704_charger.c is only call it and > instead make it call usb_udc_vbus_handler() instead ? In short, no. Alan Stern