Message ID | 20230328160756.30520-3-quic_kriskura@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2351662vqo; Tue, 28 Mar 2023 09:34:05 -0700 (PDT) X-Google-Smtp-Source: AKy350Zcdd7yW4ir0hhUYV3S5yfY+YW1mcuziCF3Pw4Zd7OIVpKFAYW21xzfFMFCpMWCO1bOMArZ X-Received: by 2002:a17:906:a887:b0:939:e7d6:7c52 with SMTP id ha7-20020a170906a88700b00939e7d67c52mr16638147ejb.20.1680021245740; Tue, 28 Mar 2023 09:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680021245; cv=none; d=google.com; s=arc-20160816; b=hgV5rfpHNeOd5KQk+StkLsBXI4W+ZiOHBnvCRwjDIEW8VzvFJ4csiF/1altnXDTVKo M/v15vjDqZrVTI+K491MutaVQucKJKt9WhMUggJHC4qvXMxS52c6ew7RcwbCuAblv+yP aSvHHLH7oU5T2lPb8fJByk2abzGcaHDI+DjDer+IscA38LLnIsjz3mnV5rDWyNEBtw4Z czxMB1CjWbkcrVEhUAdYKESDhWxDRS9nsFD+LcqglaHO+oqp7TqfG4+B5DN0UMBwFFXJ 9Hnqiw/m8pJwwgxOw6sYhkva0MiXxYTThvserS1iDXTea8Oy0oIQ7bev1ikV57x7L2+C RvCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L8rw2Her4iceF3lBbGr1llneXswMjuHwG5KiVK2xQwQ=; b=pHC82fK6ZnXmdzQM0WBwRZkW2Ewxf+sRxkvPWr14ZqLWP1YKFfV7YwE7qQzJfwAXnm Hy30xZERlG3v8r0QvrslokQDsCZThLC7jzu97WVtZYZwvRuGg49yan6L01NDtYjlFCoM INQHBzM7gid9xgXvlp4CJbfnKWw3rXrcqdWmfqzIuopKG1rZg+vggW0x5dUVgSpMBtvu k6p69JXhPZuUjUDTb5CYuXHR+nAaK/hWPXvaiwNv8QlpFzR9vVrYoS6cxYqs9p77EBl7 jYEs9yoo99Jrogy/pQA79/cbp2/xN6B4iuQnf1I0v36Kugk9p3ilYQrnAwbrzOVbA/A9 R+EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fdWmeCxI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg10-20020a170907970a00b009334769adc2si32791521ejc.457.2023.03.28.09.33.42; Tue, 28 Mar 2023 09:34:05 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fdWmeCxI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231871AbjC1QIj (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Tue, 28 Mar 2023 12:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232220AbjC1QIf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Mar 2023 12:08:35 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E665E05A; Tue, 28 Mar 2023 09:08:34 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32SE32N6022919; Tue, 28 Mar 2023 16:08:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=L8rw2Her4iceF3lBbGr1llneXswMjuHwG5KiVK2xQwQ=; b=fdWmeCxIlztEFATRJBmUvL29MT22FxDZzuBox0bmoHZKvtQHoLGdY4FgIcVDJ9QGFeSJ CTTdC54VkCvjOEPIMGE50aIzD42Q/sT9JhTD16HAH3S22GkvDZrvZJQHQlxTalpGERZi FmPS1Uixo9y1gJbdW/XHtYA7b3BR5Qmigmycq5Ai8FQM2yCwhO9m6obCbxWfYpVQKK7R bACLXHgqfVHuQH2s8x6NZowo90eMMAVwW0fsYdlRg8RKQcUsc6XYyJgW3YMSiqDIFWkX NlDITY0U7T2vWbJU3+GhUR59lz1vu4LAdnF/61nJOYvpGaCBR8qcWhbBDeeSVOoC4zUK zQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pky700vud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Mar 2023 16:08:20 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32SG8JdO028236 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Mar 2023 16:08:19 GMT Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 28 Mar 2023 09:08:15 -0700 From: Krishna Kurapati <quic_kriskura@quicinc.com> To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Alan Stern <stern@rowland.harvard.edu>, "Geert Uytterhoeven" <geert+renesas@glider.be>, Colin Ian King <colin.i.king@gmail.com>, Jiantao Zhang <water.zhangjiantao@huawei.com>, "Rafael J . Wysocki" <rafael@kernel.org> CC: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <quic_ppratap@quicinc.com>, <quic_wcheng@quicinc.com>, <quic_jackp@quicinc.com>, <quic_ugoswami@quicinc.com>, Krishna Kurapati <quic_kriskura@quicinc.com> Subject: [PATCH v2 2/2] usb: gadget: udc: Handle gadget_connect failure during bind operation Date: Tue, 28 Mar 2023 21:37:56 +0530 Message-ID: <20230328160756.30520-3-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230328160756.30520-1-quic_kriskura@quicinc.com> References: <20230328160756.30520-1-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 3_5wJH3HUWn8oAmejhv48f51nUn3TQPP X-Proofpoint-GUID: 3_5wJH3HUWn8oAmejhv48f51nUn3TQPP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-28_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 phishscore=0 impostorscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303280126 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761629957501817780?= X-GMAIL-MSGID: =?utf-8?q?1761629957501817780?= |
Series |
Handle core soft reset failure in pullup
|
|
Commit Message
Krishna Kurapati
March 28, 2023, 4:07 p.m. UTC
In the event, gadget_connect call (which invokes pullup) fails,
propagate the error to udc bind operation which inturn sends the
error to configfs. The userspace can then retry enumeartion if
it chooses to.
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
---
drivers/usb/gadget/udc/core.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
Comments
Hi Alan, Geert, Can you help review and provide comments/approval on the following patch. Regards, Krishna, On 3/28/2023 9:37 PM, Krishna Kurapati wrote: > In the event, gadget_connect call (which invokes pullup) fails, > propagate the error to udc bind operation which inturn sends the > error to configfs. The userspace can then retry enumeartion if > it chooses to. > > Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com> > --- > drivers/usb/gadget/udc/core.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > index 23b0629a8774..975205a1853f 100644 > --- a/drivers/usb/gadget/udc/core.c > +++ b/drivers/usb/gadget/udc/core.c > @@ -1051,12 +1051,16 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state); > > /* ------------------------------------------------------------------------- */ > > -static void usb_udc_connect_control(struct usb_udc *udc) > +static int usb_udc_connect_control(struct usb_udc *udc) > { > + int ret; > + > if (udc->vbus) > - usb_gadget_connect(udc->gadget); > + ret = usb_gadget_connect(udc->gadget); > else > - usb_gadget_disconnect(udc->gadget); > + ret = usb_gadget_disconnect(udc->gadget); > + > + return ret; > } > > /** > @@ -1500,11 +1504,19 @@ static int gadget_bind_driver(struct device *dev) > if (ret) > goto err_start; > usb_gadget_enable_async_callbacks(udc); > - usb_udc_connect_control(udc); > + ret = usb_udc_connect_control(udc); > + if (ret) > + goto err_connect_control; > > kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); > return 0; > > + err_connect_control: > + usb_gadget_disable_async_callbacks(udc); > + if (gadget->irq) > + synchronize_irq(gadget->irq); > + usb_gadget_udc_stop(udc); > + > err_start: > driver->unbind(udc->gadget); >
Hi Krishna, On Wed, Apr 26, 2023 at 3:17 AM Krishna Kurapati PSSNV <quic_kriskura@quicinc.com> wrote: > Hi Alan, Geert, > > Can you help review and provide comments/approval on the following patch. I don't know why you are addressing me, as I never touched the affected file, am not listed as its maintainer, and don't know much about USB UDC. Gr{oetje,eeting}s, Geert
Hi Krishna, CC Joe and lkml On Thu, Apr 27, 2023 at 10:44 AM Krishna Kurapati PSSNV <quic_kriskura@quicinc.com> wrote: > On 4/27/2023 1:23 PM, Geert Uytterhoeven wrote: > > On Thu, Apr 27, 2023 at 5:49 AM Krishna Kurapati PSSNV > > <quic_kriskura@quicinc.com> wrote: > >> On 4/26/2023 2:48 PM, Geert Uytterhoeven wrote: > >>> On Wed, Apr 26, 2023 at 3:17 AM Krishna Kurapati PSSNV > >>> <quic_kriskura@quicinc.com> wrote: > >>>> Hi Alan, Geert, > >>>> > >>>> Can you help review and provide comments/approval on the following patch. > >>> > >>> I don't know why you are addressing me, as I never touched the affected > >>> file, am not listed as its maintainer, and don't know much about USB UDC. > > > >> Apologies. I must have caused some confusion because of same name. I > >> must have specified clearly whom I was referring to. > >> > >> I CC'd and was referring to Geert Uytterhoeven <geert+renesas@glider.be> > >> for comments. > > > > That's actually me, too ;-) > > > >> As per the output of get_maintainer.pl > >> > >> ./scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c > >> > >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB > >> SUBSYSTEM,commit_signer:6/6=100%,authored:1/6=17%,removed_lines:2/26=8%) > >> Alan Stern <stern@rowland.harvard.edu> > >> (commit_signer:4/6=67%,authored:3/6=50%,added_lines:36/45=80%,removed_lines:17/26=65%) > >> TaoXue <xuetao09@huawei.com> (commit_signer:1/6=17%) > >> "Rafael J. Wysocki" <rafael@kernel.org> (commit_signer:1/6=17%) > >> Geert Uytterhoeven <geert+renesas@glider.be> (commit_signer:1/6=17%) > >> Colin Ian King <colin.i.king@gmail.com> (authored:1/6=17%) > >> Jiantao Zhang <water.zhangjiantao@huawei.com> > >> (authored:1/6=17%,added_lines:6/45=13%,removed_lines:6/26=23%) > > > > Interesting, I don't see me listed when running that command (on v6.3 and > > next-20230425), and I never authored any change to that file. > > What is the tree (commit sha1) you are running ./scripts/get_maintainer.pl on? > > I checked it on linux-next a couple of weeks back and it showed me this. > But when I synced latest linux kernel, it didn't show it today 😅 > Not sure, what is the diff here. Interesting: $ git checkout next-20230425 Updating files: 100% (7386/7386), done. Previous HEAD position was 198925fae644b009 Add linux-next specific files for 20230329 HEAD is now at f600e0bbde8562a0 Add linux-next specific files for 20230425 $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB SUBSYSTEM,commit_signer:11/11=100%,authored:3/11=27%,removed_lines:5/73=7%) Alan Stern <stern@rowland.harvard.edu> (commit_signer:4/11=36%,authored:3/11=27%,added_lines:36/182=20%,removed_lines:17/73=23%) Badhri Jagan Sridharan <badhri@google.com> (commit_signer:2/11=18%,authored:2/11=18%,added_lines:107/182=59%,removed_lines:44/73=60%) Elson Roy Serrao <quic_eserrao@quicinc.com> (commit_signer:1/11=9%,added_lines:27/182=15%) Sebastian Reichel <sre@kernel.org> (commit_signer:1/11=9%) Colin Ian King <colin.i.king@gmail.com> (authored:1/11=9%) Jiantao Zhang <water.zhangjiantao@huawei.com> (authored:1/11=9%,removed_lines:6/73=8%) linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) linux-kernel@vger.kernel.org (open list) $ git checkout next-20230329 Updating files: 100% (7386/7386), done. Previous HEAD position was f600e0bbde8562a0 Add linux-next specific files for 20230425 HEAD is now at 198925fae644b009 Add linux-next specific files for 20230329 $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB SUBSYSTEM,commit_signer:8/8=100%,authored:3/8=38%,added_lines:5/48=10%,removed_lines:5/29=17%) Alan Stern <stern@rowland.harvard.edu> (commit_signer:3/8=50%,authored:3/8=38%,added_lines:36/48=75%,removed_lines:17/29=59%) Geert Uytterhoeven <geert+renesas@glider.be> (commit_signer:1/8=12%) Sebastian Reichel <sre@kernel.org> (commit_signer:1/8=12%) Heikki Krogerus <heikki.krogerus@linux.intel.com> (commit_signer:1/8=12%) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I, Sebastian, and Heikki never touched this file... Jiantao Zhang <water.zhangjiantao@huawei.com> (authored:1/8=12%,added_lines:6/48=12%,removed_lines:6/29=21%) Colin Ian King <colin.i.king@gmail.com> (authored:1/8=12%) linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) linux-kernel@vger.kernel.org (open list) $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB SUBSYSTEM,commit_signer:8/8=100%,authored:3/8=38%,added_lines:5/48=10%,removed_lines:5/29=17%) Alan Stern <stern@rowland.harvard.edu> (commit_signer:4/8=50%,authored:3/8=38%,added_lines:36/48=75%,removed_lines:17/29=59%) "Rafael J. Wysocki" <rafael@kernel.org> (commit_signer:1/8=12%) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Heikki and I are gone, but Rafael is new and also hasn't touched this file? Colin Ian King <colin.i.king@gmail.com> (commit_signer:1/8=12%,authored:1/8=12%) Sebastian Reichel <sre@kernel.org> (commit_signer:1/8=12%) Jiantao Zhang <water.zhangjiantao@huawei.com> (authored:1/8=12%,added_lines:6/48=12%,removed_lines:6/29=21%) linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) linux-kernel@vger.kernel.org (open list) You can see the differences when running the following multiple times: $ diff <(scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c) <(scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c) Looks like scripts/get_maintainer.pl (a) shows wrong committers (they did provide other e.g. Reviewed-by tags), and (b) is not deterministic? Thanks! Gr{oetje,eeting}s, Geert
On Apr 27 2023, Geert Uytterhoeven wrote: > $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB > SUBSYSTEM,commit_signer:8/8=100%,authored:3/8=38%,added_lines:5/48=10%,removed_lines:5/29=17%) > Alan Stern <stern@rowland.harvard.edu> > (commit_signer:3/8=50%,authored:3/8=38%,added_lines:36/48=75%,removed_lines:17/29=59%) > Geert Uytterhoeven <geert+renesas@glider.be> (commit_signer:1/8=12%) > Sebastian Reichel <sre@kernel.org> (commit_signer:1/8=12%) > Heikki Krogerus <heikki.krogerus@linux.intel.com> (commit_signer:1/8=12%) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > I, Sebastian, and Heikki never touched this file... If you look at 'git log drivers/usb/gadget/udc/core.c', you see commits touching scripts/get_maintainer.pl.
Please ignore that, typo on my side.
On Wed, Apr 26, 2023 at 06:47:13AM +0530, Krishna Kurapati PSSNV wrote: > Hi Alan, Geert, > > Can you help review and provide comments/approval on the following patch. > > Regards, > Krishna, Sorry this took so long to review; I've been quite busy. The patch is good except for one stylistic thing... > On 3/28/2023 9:37 PM, Krishna Kurapati wrote: > > In the event, gadget_connect call (which invokes pullup) fails, > > propagate the error to udc bind operation which inturn sends the > > error to configfs. The userspace can then retry enumeartion if > > it chooses to. > > > > Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com> > > --- > > drivers/usb/gadget/udc/core.c | 20 ++++++++++++++++---- > > 1 file changed, 16 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > > index 23b0629a8774..975205a1853f 100644 > > --- a/drivers/usb/gadget/udc/core.c > > +++ b/drivers/usb/gadget/udc/core.c > > @@ -1051,12 +1051,16 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state); > > /* ------------------------------------------------------------------------- */ > > -static void usb_udc_connect_control(struct usb_udc *udc) > > +static int usb_udc_connect_control(struct usb_udc *udc) > > { > > + int ret; > > + > > if (udc->vbus) > > - usb_gadget_connect(udc->gadget); > > + ret = usb_gadget_connect(udc->gadget); > > else > > - usb_gadget_disconnect(udc->gadget); > > + ret = usb_gadget_disconnect(udc->gadget); > > + > > + return ret; > > } > > /** > > @@ -1500,11 +1504,19 @@ static int gadget_bind_driver(struct device *dev) > > if (ret) > > goto err_start; > > usb_gadget_enable_async_callbacks(udc); > > - usb_udc_connect_control(udc); > > + ret = usb_udc_connect_control(udc); > > + if (ret) > > + goto err_connect_control; > > kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); > > return 0; > > + err_connect_control: For consistency with the other error-handling statement labels in this routine, there should be a blank line immediately before this label. > > + usb_gadget_disable_async_callbacks(udc); > > + if (gadget->irq) > > + synchronize_irq(gadget->irq); > > + usb_gadget_udc_stop(udc); > > + > > err_start: > > driver->unbind(udc->gadget); Everything else looks okay. Acked-by: Alan Stern <stern@rowland.harvard.edu> Alan Stern
On Thu, 2023-04-27 at 11:09 +0200, Geert Uytterhoeven wrote: > Hi Krishna, > > CC Joe and lkml get_maintainer is sometimes non deterministic. When adding maintainers from git commit logs (and btw, it's not just nominal maintainers, it's any signers), if the same number of signature names are read from the commit logs the selection of the listed entries _is_ random. see: https://lore.kernel.org/lkml/1499984554.4457.64.camel@perches.com/ > > On Thu, Apr 27, 2023 at 10:44 AM Krishna Kurapati PSSNV > <quic_kriskura@quicinc.com> wrote: > > On 4/27/2023 1:23 PM, Geert Uytterhoeven wrote: > > > On Thu, Apr 27, 2023 at 5:49 AM Krishna Kurapati PSSNV > > > <quic_kriskura@quicinc.com> wrote: > > > > On 4/26/2023 2:48 PM, Geert Uytterhoeven wrote: > > > > > On Wed, Apr 26, 2023 at 3:17 AM Krishna Kurapati PSSNV to l > > > > > <quic_kriskura@quicinc.com> wrote: > > > > > > Hi Alan, Geert, > > > > > > > > > > > > Can you help review and provide comments/approval on the following patch. > > > > > > > > > > I don't know why you are addressing me, as I never touched the affected > > > > > file, am not listed as its maintainer, and don't know much about USB UDC. > > > > > > > Apologies. I must have caused some confusion because of same name. I > > > > must have specified clearly whom I was referring to. > > > > > > > > I CC'd and was referring to Geert Uytterhoeven <geert+renesas@glider.be> > > > > for comments. > > > > > > That's actually me, too ;-) > > > > > > > As per the output of get_maintainer.pl > > > > > > > > ./scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c > > > > > > > > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB > > > > SUBSYSTEM,commit_signer:6/6=100%,authored:1/6=17%,removed_lines:2/26=8%) > > > > Alan Stern <stern@rowland.harvard.edu> > > > > (commit_signer:4/6=67%,authored:3/6=50%,added_lines:36/45=80%,removed_lines:17/26=65%) > > > > TaoXue <xuetao09@huawei.com> (commit_signer:1/6=17%) > > > > "Rafael J. Wysocki" <rafael@kernel.org> (commit_signer:1/6=17%) > > > > Geert Uytterhoeven <geert+renesas@glider.be> (commit_signer:1/6=17%) > > > > Colin Ian King <colin.i.king@gmail.com> (authored:1/6=17%) > > > > Jiantao Zhang <water.zhangjiantao@huawei.com> > > > > (authored:1/6=17%,added_lines:6/45=13%,removed_lines:6/26=23%) > > > > > > Interesting, I don't see me listed when running that command (on v6.3 and > > > next-20230425), and I never authored any change to that file. > > > What is the tree (commit sha1) you are running ./scripts/get_maintainer.pl on? > > > > I checked it on linux-next a couple of weeks back and it showed me this. > > But when I synced latest linux kernel, it didn't show it today 😅 > > Not sure, what is the diff here. > > Interesting: > > $ git checkout next-20230425 > Updating files: 100% (7386/7386), done. > Previous HEAD position was 198925fae644b009 Add linux-next > specific files for 20230329 > HEAD is now at f600e0bbde8562a0 Add linux-next specific files for 20230425 > $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB > SUBSYSTEM,commit_signer:11/11=100%,authored:3/11=27%,removed_lines:5/73=7%) > Alan Stern <stern@rowland.harvard.edu> > (commit_signer:4/11=36%,authored:3/11=27%,added_lines:36/182=20%,removed_lines:17/73=23%) > Badhri Jagan Sridharan <badhri@google.com> > (commit_signer:2/11=18%,authored:2/11=18%,added_lines:107/182=59%,removed_lines:44/73=60%) > Elson Roy Serrao <quic_eserrao@quicinc.com> > (commit_signer:1/11=9%,added_lines:27/182=15%) > Sebastian Reichel <sre@kernel.org> (commit_signer:1/11=9%) > Colin Ian King <colin.i.king@gmail.com> (authored:1/11=9%) > Jiantao Zhang <water.zhangjiantao@huawei.com> > (authored:1/11=9%,removed_lines:6/73=8%) > linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) > linux-kernel@vger.kernel.org (open list) > $ git checkout next-20230329 > Updating files: 100% (7386/7386), done. > Previous HEAD position was f600e0bbde8562a0 Add linux-next > specific files for 20230425 > HEAD is now at 198925fae644b009 Add linux-next specific files for 20230329 > $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB > SUBSYSTEM,commit_signer:8/8=100%,authored:3/8=38%,added_lines:5/48=10%,removed_lines:5/29=17%) > Alan Stern <stern@rowland.harvard.edu> > (commit_signer:3/8=50%,authored:3/8=38%,added_lines:36/48=75%,removed_lines:17/29=59%) > Geert Uytterhoeven <geert+renesas@glider.be> (commit_signer:1/8=12%) > Sebastian Reichel <sre@kernel.org> (commit_signer:1/8=12%) > Heikki Krogerus <heikki.krogerus@linux.intel.com> (commit_signer:1/8=12%) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > I, Sebastian, and Heikki never touched this file... > > Jiantao Zhang <water.zhangjiantao@huawei.com> > (authored:1/8=12%,added_lines:6/48=12%,removed_lines:6/29=21%) > Colin Ian King <colin.i.king@gmail.com> (authored:1/8=12%) > linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) > linux-kernel@vger.kernel.org (open list) > $ scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (supporter:USB > SUBSYSTEM,commit_signer:8/8=100%,authored:3/8=38%,added_lines:5/48=10%,removed_lines:5/29=17%) > Alan Stern <stern@rowland.harvard.edu> > (commit_signer:4/8=50%,authored:3/8=38%,added_lines:36/48=75%,removed_lines:17/29=59%) > "Rafael J. Wysocki" <rafael@kernel.org> (commit_signer:1/8=12%) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Heikki and I are gone, but Rafael is new and also hasn't touched this file? > > Colin Ian King <colin.i.king@gmail.com> > (commit_signer:1/8=12%,authored:1/8=12%) > Sebastian Reichel <sre@kernel.org> (commit_signer:1/8=12%) > Jiantao Zhang <water.zhangjiantao@huawei.com> > (authored:1/8=12%,added_lines:6/48=12%,removed_lines:6/29=21%) > linux-usb@vger.kernel.org (open list:USB SUBSYSTEM) > linux-kernel@vger.kernel.org (open list) > > You can see the differences when running the following multiple times: > > $ diff <(scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c) > <(scripts/get_maintainer.pl drivers/usb/gadget/udc/core.c) > > Looks like scripts/get_maintainer.pl (a) shows wrong committers (they > did provide other e.g. Reviewed-by tags), and (b) is not deterministic? > > Thanks! > > Gr{oetje,eeting}s, > > Geert >
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 23b0629a8774..975205a1853f 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1051,12 +1051,16 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state); /* ------------------------------------------------------------------------- */ -static void usb_udc_connect_control(struct usb_udc *udc) +static int usb_udc_connect_control(struct usb_udc *udc) { + int ret; + if (udc->vbus) - usb_gadget_connect(udc->gadget); + ret = usb_gadget_connect(udc->gadget); else - usb_gadget_disconnect(udc->gadget); + ret = usb_gadget_disconnect(udc->gadget); + + return ret; } /** @@ -1500,11 +1504,19 @@ static int gadget_bind_driver(struct device *dev) if (ret) goto err_start; usb_gadget_enable_async_callbacks(udc); - usb_udc_connect_control(udc); + ret = usb_udc_connect_control(udc); + if (ret) + goto err_connect_control; kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); return 0; + err_connect_control: + usb_gadget_disable_async_callbacks(udc); + if (gadget->irq) + synchronize_irq(gadget->irq); + usb_gadget_udc_stop(udc); + err_start: driver->unbind(udc->gadget);