Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp670557rwj; Fri, 23 Dec 2022 06:42:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtvLTeDp5aIvcgUzSBNhHjsK6mRib0I5BZyff5tvGuR8jyoQ3uz9O9haZbaabmB2lIcuj7y X-Received: by 2002:a05:6a21:c08d:b0:af:f1d1:6f7f with SMTP id bn13-20020a056a21c08d00b000aff1d16f7fmr13544385pzc.31.1671806529978; Fri, 23 Dec 2022 06:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671806529; cv=none; d=google.com; s=arc-20160816; b=hHPli/2Uvttn4wx4gJliSO8jN0Xi+FxntfRxLZCFMTAL26kFE7GksnHEOr699UVc0J E5+r/pVh1qoSmYqTDZv5Ur35yKh1aHsLk8iRxhbZjECh1PA/slGZUuM1KMsrAOm81N6a NgHO1N4Sc3h8fkn+lVKCl8fwGuMRFMmfhvKelSwLznaOzcwTdZhrMJDIKIR1IosgXf79 aO3Jlhj2+SsW433rKiqQ5DQrKWq2HDu9hL35T5trnxNfAXTL9g7usx8Xzit55cden/5y nlcmtuFFXo3aRpyS91QDHYfjinLTJsqNd6Fb0bZXNDwHAa6sn4p7xP+zLs+RKZwwP4VJ tmhQ== 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:dkim-signature; bh=+cdRpVHHE1m3iK8Nxl7uJ/hYy2tcfs+oAAdZGmGLuTo=; b=G9W55lopgRWNR6gXlXUBaaZV55IvAOVV0IjiCJcGEaQxNhWTIeej4EMpI0DtiElr6l PmAehDyoIZNse/7u8KAJVT/2N7Pr7jjpdhNRs/lxo30dIbzkJx9nyuxHOKcEYKs5pufu LP3NWK7QHR4TEmHhLPyJ/FMvF+bhb9zbwcNFlDdJhscJOxkzawPjtIB0+3xznxkW3Cii CrRXLqCmPZEtOmTP8JWIqHgIsBzkmUO4nhCsJyxh4kj2ymVhswYPkXcyF1on3M6pMvOF VVt7JTVCXQUKyvLh7WeFCge3CiNZp7xnzASoXrBbeWY0qQDvkCekIwrTjLKb5VMFMGNx MV6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LUZztam9; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf17-20020a656d11000000b004629ce15656si3921082pgb.196.2022.12.23.06.42.00; Fri, 23 Dec 2022 06:42:09 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LUZztam9; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236260AbiLWOBI (ORCPT + 65 others); Fri, 23 Dec 2022 09:01:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbiLWOBF (ORCPT ); Fri, 23 Dec 2022 09:01:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CE6F6300; Fri, 23 Dec 2022 06:01:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 087B0B81F79; Fri, 23 Dec 2022 14:01:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0253C433EF; Fri, 23 Dec 2022 14:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671804060; bh=AJ6hHUXccdAnIHM+TsMt4CJZeVcaFow5vwyGrPBRFhE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LUZztam9jZfDWWYubVcqtjHZEtiebuyncHyEL2rqdaxgiyJDv90q7RWXmOBJPR/qs euWOMpLmkhrNdJv3nxm2GyHiStAzBe2xsD4AAx7gKiqLEfv25c5G613PpEjFtfsRnu zgBFoDnVDeqtHsKnhdXT32pjZDZBH5CKKhoRq1nUBaF5M6oA1pccRJVhoROrfbnEFX pF2HNBb0alV4jXC4feUr+Kn1/J/Q+qxVkU5zXz4Iv6blp6i3dajOGVYrLtnNcBjJtf sSjA3xwU/o2Be/uhxlhwZ8DV/b0hN7GzEO7CbczGqitD+8A12Klb1dcSTENBaGa3F6 IRM3SRxVaTi3A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1p8icU-0000ES-KX; Fri, 23 Dec 2022 15:01:54 +0100 Date: Fri, 23 Dec 2022 15:01:54 +0100 From: Johan Hovold To: Matthias Kaehlcke Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Stefan Wahren , stable@vger.kernel.org, Douglas Anderson , Ravi Chandra Sadineni Subject: Re: [PATCH v2 1/2] usb: misc: onboard_usb_hub: Don't create platform devices for DT nodes without 'vdd-supply' Message-ID: References: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Thu, Dec 22, 2022 at 02:26:44AM +0000, 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) Please try to remember to CC people providing feedback on your patches. > - updated subject and commit message > - added 'Link' tag (regzbot) > > drivers/usb/misc/onboard_usb_hub_pdevs.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/usb/misc/onboard_usb_hub_pdevs.c b/drivers/usb/misc/onboard_usb_hub_pdevs.c > index ed22a18f4ab7..8cea53b0907e 100644 > --- a/drivers/usb/misc/onboard_usb_hub_pdevs.c > +++ b/drivers/usb/misc/onboard_usb_hub_pdevs.c > @@ -101,6 +101,19 @@ void onboard_hub_create_pdevs(struct usb_device *parent_hub, struct list_head *p > } > } > > + /* > + * The primary task of the onboard_usb_hub driver is to control > + * the power of an USB onboard hub. Some boards have device tree > + * nodes for USB hubs supported by this driver, but don't > + * specify a "vdd-supply", which is needed by the driver. This is > + * not a DT error per se, it just means that the onboard hub > + * driver can't be used with these nodes, so don't create a > + * a platform device for such a node. > + */ > + if (!of_get_property(np, "vdd-supply", NULL) && > + !of_get_property(npc, "vdd-supply", NULL)) > + goto node_put; So as I mentioned elsewhere, this doesn't look right. It is the responsibility of the platform driver to manage its resources and it may not even need a supply. I see now that you have already matched on the compatible property above so that you only create the platform device for the devices that (may) need it. It seems the assumptions that this driver was written under needs to be revisited. > + > pdev = of_platform_device_create(np, NULL, &parent_hub->dev); > if (!pdev) { > dev_err(&parent_hub->dev, Johan