From patchwork Thu Dec 22 02:26:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 13079332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8261C4332F for ; Thu, 22 Dec 2022 02:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbiLVC0v (ORCPT ); Wed, 21 Dec 2022 21:26:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbiLVC0u (ORCPT ); Wed, 21 Dec 2022 21:26:50 -0500 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 592826562 for ; Wed, 21 Dec 2022 18:26:49 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id d123so363570iof.6 for ; Wed, 21 Dec 2022 18:26:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=t6eb2QLxGLA5nQWox1Il1mb2LunPDzmdoel/IXxPIUE=; b=lqFalmTuR89YV96zutl+2zViNboGd6NP7NUPn24Jfc7wEe13OpK7k5Yxw9oFR1VCVJ EjwSUfnQ3groAx71Zed974hxE8G6xpMMpnyHXDlfog3zBI2HFPe66EEt37PzVnkEgs2p VSfhsC/OWfr7Kuu7VUfS5etJaDVBJXAEoMcyc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t6eb2QLxGLA5nQWox1Il1mb2LunPDzmdoel/IXxPIUE=; b=FxMtzsjyiioBDtAMMGYTHuiwyxqfhd2HiSNpqYNlm+cgHOcV47fEc2nAybNP/nKeHN hzOUMWBKYR5JHYpTWJbmrvpBv6yg1/DbZuISmMQePzZsSmissjwekDBhD4lKDCBIctVy V/0GlcUvT43C9o0bpD4K8aYA5XzjMmHGnkPAVB+sFA+L36Wjn7lqdzmpDrQfYquYqMTb LqKZYnNswA+iAdJ0ecM9TcT45WBh7V1soMtoass4YvfCShsfa5eDHEspODTPJHGlZFW7 LJ0YZvVwc70+enXoOxNlzd7Fwki7chNz2WKcaKPHvcIaaV5Fq9mkM83ryvWHyl6CkXrH hT6w== X-Gm-Message-State: AFqh2koUuQy3lGXSWOM2OQW4yHUoZlNa8+7x7TSLhoCtSKgfvyk8KYij vBhJk/Lt0OyiHxd361P33TG0Tg== X-Google-Smtp-Source: AMrXdXuJdoc6h1EjuJLY3ZLbT/1BvUU+55g84Ob7FJSai4KIMVeLOP7kr2txXkL2JF10O5AQfLYhIA== X-Received: by 2002:a5d:9347:0:b0:6de:acb8:636d with SMTP id i7-20020a5d9347000000b006deacb8636dmr2382046ioo.19.1671676008773; Wed, 21 Dec 2022 18:26:48 -0800 (PST) Received: from localhost (30.23.70.34.bc.googleusercontent.com. [34.70.23.30]) by smtp.gmail.com with UTF8SMTPSA id i1-20020a056602134100b006a129b10229sm6812507iov.31.2022.12.21.18.26.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 18:26:48 -0800 (PST) From: Matthias Kaehlcke To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Stefan Wahren , stable@vger.kernel.org, Douglas Anderson , Matthias Kaehlcke , Ravi Chandra Sadineni Subject: [PATCH v2 1/2] usb: misc: onboard_usb_hub: Don't create platform devices for DT nodes without 'vdd-supply' Date: Thu, 22 Dec 2022 02:26:44 +0000 Message-Id: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Tested-by: Stefan Wahren --- 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(+) 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; + pdev = of_platform_device_create(np, NULL, &parent_hub->dev); if (!pdev) { dev_err(&parent_hub->dev,