Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10521562rwl; Mon, 2 Jan 2023 04:08:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXuGHMFT6n9yimhi4EdnRNRTpfILTr590PGg0PAtwKhO1K0TDupoPnFkbLzwRmT/oHJXOoxQ X-Received: by 2002:a17:906:265a:b0:7ad:9893:ff40 with SMTP id i26-20020a170906265a00b007ad9893ff40mr40297321ejc.27.1672661314805; Mon, 02 Jan 2023 04:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672661314; cv=none; d=google.com; s=arc-20160816; b=H9qrJaJoIPqyEB5IroCQLL9EzO29Xb2MPr6LDtgOeZTuFYE3uBnIVL4347aXJGniZa MlRrIcpkSGCKVAeclc0OopUjU0FbCw9gZaQvS8xrJJiwrnCGSeE5Ky58mMBsj3kmZ7lh oe1x0egHUjSMYxrlU/WSXHJot1WuBzV7FY3yOcDTEhUwrDhb1GlqElgaSDjC0zyNPays 3ml06hdz4qsfLucZEMpKojpj0BRN5OKVT6eC1q2XVz7vOY9tzyxSObwKAM0v78Wc/a6+ 5FmMQl2nYuehrw+VPZtVeIAjmLByVByQdm6nPTecaExpGh+s4HzVzxy/dwPjmxreMTVR KoQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id; bh=c6SyCddchyAZhQ53MH5nbIvcB6Qp8nI9FHLYbhJYS34=; b=CzdaoYzqnJ66X2KO+x4wTYB3pnkypQudf5fk/Xcbr/9eKgasnb5jzyhS6MwgBN+mHH BM8/m0zcLG8u2xIuVt57Icvym6Qw4hRM+C+ttUWie+L1cqjkXbXTYxf+iA9z8BGYAt1U 7zitednzHx147w6jNnqIVAGMj4S/TaHowuwf7/wAWxa/p+QjnrP/W/HLsitOMRqt0wvp pUi41LrSa0BjjSpimFd37uElj16MLrV3wAK5+Xr8f9vkk1c5NfAhcCwy/LOw7vNkUQS6 WUaTokgfI1xOeLOBgIXIrSDhugCd14+rjC5390ZAMj7hBBNzuhBbBg91mwbjDYerPRHb Ql6w== 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 i35-20020a0564020f2300b0048eabb81616si271122eda.387.2023.01.02.04.08.17; Mon, 02 Jan 2023 04:08:34 -0800 (PST) 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 S232103AbjABLt4 (ORCPT + 60 others); Mon, 2 Jan 2023 06:49:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbjABLts (ORCPT ); Mon, 2 Jan 2023 06:49:48 -0500 X-Greylist: delayed 306 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 02 Jan 2023 03:49:46 PST Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29FC010AA; Mon, 2 Jan 2023 03:49:45 -0800 (PST) Received: from [192.168.1.139] ([37.4.248.41]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N9dg5-1oijbD07Bl-015aNV; Mon, 02 Jan 2023 12:44:34 +0100 Message-ID: Date: Mon, 2 Jan 2023 12:44:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 1/2] usb: misc: onboard_usb_hub: Don't create platform devices for DT nodes without 'vdd-supply' To: Alexander Stein , Doug Anderson , Matthias Kaehlcke , Icenowy Zheng Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, stable@vger.kernel.org, Ravi Chandra Sadineni References: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> <3724284.kQq0lBPeGt@steina-w> Content-Language: en-US From: Stefan Wahren In-Reply-To: <3724284.kQq0lBPeGt@steina-w> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:8H+d7hWesExJl4kSwA6nWmwGDR2OGL48FFwKuGrTC9dYxMS7eA+ 0MIf8ChqjS40OU28w9dpUwHTjN4MaX04QHiCLC1uv41EdlZs/90KEb9XdfwMN9PQONT92tc dnZXthXgVruaA9EYuQlVCatMkCI+MdSz2uleZAIXSiRoEXl2rxiBv9oSQkXC3aTMW/0vUHn /OrxlEYUzYrYd2ajBsqNA== UI-OutboundReport: notjunk:1;M01:P0:tYGoUjyvkw0=;f2l2XlgSgtAduqMOWaKN9HvdtXM AhQt8sS4YPTFpa5YCkp//cMSKWHQb11Xw073mmPeOTwDsElXMVssdoWeyXq9GG64GMEn7Eyyt St13qc/kWToWP4sHpOpaA0m/pb3emfkbv6pVfze/acHmPxYsmBDiLDl/jcyXZHhSOjYNpq2Tk Qdj1QtQas4gYML9TtGp3OmT4VKpDBs/cklrRAHW5ekpXUER6GUniB0iNZ2zjEOw4mk/KyE4P0 M+UIwvSuuqjo4JBz+CVgYlCa2w+B7dZtIKtYkZOS5Ah8V+snoJMVVLuXNEuX6QNe2BaQjSpwj vVfybHq/YP2kc2OWj28r8kmsN8hKF1RaLIvC76ZUNijt2HEVO5h0GWo1gJZxY07jcyLZo+8Hh wtqyW2tGNBSTRA2t6teLhOvSIgjGMwCBt7xZASWPQJw48+/MJxElyNG9lvXkwHEb9iUWNYXf5 IRbaEX+zP9N/+TqDCwIj9jpBIYcvZcSHbVkDsw7C0aR3Mvnc++1A4Ur+JJzdfGV96tziWuW3P rJoSj+V45HkbhYLpi29VzGj23Vyn5HSJfAWaLg8Trdjzp6GostEzARnv/Ar1Wx+M7M9iDAeIl pqR19xEH5/XXJyzk/ReUiOLs0Sv5Tbb08otxF3L0nVKbldtoIoIs4jMtHhkuz7CmsxDqcEOlv toeJsTOowifGGZCXj2eWbF0FYG787OVv6QIEBn8EiA== X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hello Alexander, Am 02.01.23 um 10:20 schrieb Alexander Stein: > Hi everybody, > > Am Freitag, 23. Dezember 2022, 08:46:45 CET schrieb Icenowy Zheng: >> 在 2022-12-22星期四的 11:26 -0800,Doug Anderson写道: >> >>> Hi, >>> >>> On Wed, Dec 21, 2022 at 6:26 PM Matthias Kaehlcke >>> >>> wrote: >>>> The primary task of the onboard_usb_hub driver is to control the >>>> power of an onboard USB hub. The driver gets the regulator from the >>>> device tree property "vdd-supply" of the hub's DT node. Some boards >>>> have device tree nodes for USB hubs supported by this driver, but >>>> don't specify a "vdd-supply". This is not an error per se, it just >>>> means that the onboard hub driver can't be used for these hubs, so >>>> don't create platform devices for such nodes. >>>> >>>> This change doesn't completely fix the reported regression. It >>>> should fix it for the RPi 3 B Plus and boards with similar hub >>>> configurations (compatible DT nodes without "vdd-supply"), boards >>>> that actually use the onboard hub driver could still be impacted >>>> by the race conditions discussed in that thread. Not creating the >>>> platform devices for nodes without "vdd-supply" is the right >>>> thing to do, independently from the race condition, which will >>>> be fixed in future patch. >>>> >>>> Fixes: 8bc063641ceb ("usb: misc: Add onboard_usb_hub driver") >>>> Link: >>>> https://lore.kernel.org/r/d04bcc45-3471-4417-b30b-5cf9880d785d@i2se.com/ >>>> Reported-by: Stefan Wahren >>>> Signed-off-by: Matthias Kaehlcke >>>> --- >>>> >>>> Changes in v2: >>>> - don't create platform devices when "vdd-supply" is missing, >>>> rather than returning an error from _find_onboard_hub() >>>> - check for "vdd-supply" not "vdd" (Johan) >>>> - updated subject and commit message >>>> - added 'Link' tag (regzbot) >>>> >>>> drivers/usb/misc/onboard_usb_hub_pdevs.c | 13 +++++++++++++ >>>> 1 file changed, 13 insertions(+) >>> I'm a tad bit skeptical. >>> >>> It somehow feels a bit too much like "inside knowledge" to add this >>> here. I guess the "onboard_usb_hub_pdevs.c" is already pretty >>> entangled with "onboard_usb_hub.c", but I'd rather the "pdevs" file >>> keep the absolute minimum amount of stuff in it and all of the >>> details >>> be in the other file. >>> >>> If this was the only issue though, I'd be tempted to let it slide. As >>> it is, I'm kinda worried that your patch will break Alexander Stein, >>> who should have been CCed (I've CCed him now) or Icenowy Zheng (also >>> CCed now). I believe those folks are using the USB hub driver >>> primarily to drive a reset GPIO. Looking at the example in the >>> bindings for one of them (genesys,gl850g.yaml), I even see that the >>> reset-gpio is specified but not a vdd-supply. I think you'll break >>> that? >> Well technically in my final DT a regulator is included (to have the >> Vbus enabled when enabling the hub), however I am still against this >> patch, because the driver should work w/o vdd-supply (or w/o reset- >> gpios), and changing this behavior is a DT binding stability breakage. > I second that. The bindings don't require neither vdd-supply nor reset-gpios. > > But I have to admit I lack to understand the purpose of this series in the > first place. What is the benefit or fix? did you followed the provided link from the patch? Best regards > > Best regards, > Alexader > >> In addition the kernel never fails because of a lacking regulator >> unless explicitly forbid dummy regulators. >> >> BTW USB is a discoverable bus, and if a hub do not need special >> handlement, it just does not need to appear in the DT, thus no onboard >> hub DT node. >> >>> In general, it feels like it should actually be fine to create the >>> USB >>> hub driver even if vdd isn't supplied. Sure, it won't do a lot, but >>> it >>> shouldn't actively hurt anything. You'll just be turning off and on >>> bogus regulators and burning a few CPU cycles. I guess the problem is >>> some race condition that you talk about in the commit message. I'd >>> rather see that fixed... That being said, if we want to be more >>> efficient and not burn CPU cycles and memory in Stefan Wahren's case, >>> maybe the USB hub driver itself could return a canonical error value >>> from its probe when it detects that it has no useful job and then >>> "onboard_usb_hub_pdevs" could just silently bail out? >> I agree. > > >