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: 35576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp95437wrn; Wed, 21 Dec 2022 18:28:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXsW89yYrj0pY31/KRvLK2L+mqAF5Y2v+cWjVYr/eROhkWeERNrhqDiUzXy6Z40K0jNXWiIJ X-Received: by 2002:a17:907:c92a:b0:7c1:6344:840 with SMTP id ui42-20020a170907c92a00b007c163440840mr2663790ejc.24.1671676129880; Wed, 21 Dec 2022 18:28:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671676129; cv=none; d=google.com; s=arc-20160816; b=iEGVxvBnpH8mGz+k2aIQcKv5wxqxjvDjiz66j3a2QXQnv9CqKVkT1r7/s53TcA9Ukq 6A8T7M5l7hw4S9OKdZEhVKY66zgtxzU0IUSw/IILR7ewnNN4nmdHGAYzUxawoEG7m4rf 168JVy6QvXNPB2/8MLwPiXmYs94aW1rstOJPxO45hUbi9yMX5GbEnJTcBvlyXeS7gX3Y FA3b2D4ZPhbWvmN03/4MK1TrV9q73sboHuP7Zdk0F7pWfPI3YkUtG8qPr3mUL7Lpyna2 2WHydh2TlbxiwfldhK/32XwnEZeMMPP/6bs6ioALdG3qrShD2KR71H2AQTpkrvbqlGsp hhhQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=t6eb2QLxGLA5nQWox1Il1mb2LunPDzmdoel/IXxPIUE=; b=IZYKdh26DmrXuz32MEO6p5FmZZQj6dU0y0aUhaHyP7t0QJCmoRnZvctNHnPU1JpEkU 1de9r68sokfnm17GUkK148X01kUhiPbt2MjTAM3mRf1v4LoT6ROmJXqrcEHjBSiX5zWC Di+bxMw8pGA79x6/DVJaGCdcwaD7J57ll3dzrOxJzsyC51SCbmJVHZffMmgUjpo1qz7P K/BYJ1GjpdmaP4/2BVpRvjAks89AmPBORx1hv8m0henX5GiBZk30NwWAlKsNJ6ACQfkS ctb98doCehrFp4DyZTQMuU2BoW930Jc88L//N+QBQJZikVOTNyP5hFp+mtEG8kSRRlvi RtzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lqFalmTu; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr18-20020a170907721200b0084514612c2asi210561ejc.609.2022.12.21.18.28.26; Wed, 21 Dec 2022 18:28:49 -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=@chromium.org header.s=google header.b=lqFalmTu; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229726AbiLVC0w (ORCPT + 99 others); Wed, 21 Dec 2022 21:26:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiLVC0u (ORCPT ); Wed, 21 Dec 2022 21:26:50 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5936265F1 for ; Wed, 21 Dec 2022 18:26:49 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id v2so368946ioe.4 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=GeUntvzOsxx5WEnjPESdjJ1ubP0E/KtfE3LzFL9wJM5PSjocZFyBAW85iHcvp2p1KZ z6yLtfF98JQHgzVLVQdgpvPda4ddO11jNQLpuBr00St3DE7bRy52zZEBNR/7RQ8CGc1J OqNVkxHs433lD5xjJEV76hfpMwdN2y8pnrfLu1vLPJFdl7OVsxBHRPlAh+SGhmW65nkB cryXRNrYuGzEDhoJCzXjc3qdbptkBLjSMabMy7Ap5X1fjwUDnt1XAqr2SlP2sKxSgO/u JdfBEI+5oUj1TzNGqOVL1JVWVMw4ov+copd+hxGAhLYIw2Slbq33zkHZgU/urQMMGOjT PwxA== X-Gm-Message-State: AFqh2kp/FllM5lkXwZcZvJzYlW5IG+VFXlnQlUVZYaCoFmG5+KoNFpbD EbHcn46q/hYfTuVMjgakz40p9w== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752879469853521143?= X-GMAIL-MSGID: =?utf-8?q?1752879469853521143?= 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, From patchwork Thu Dec 22 02:26:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 35577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp96454wrn; Wed, 21 Dec 2022 18:31:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXtAymJnItnTFymz/gYkiZfCJhM2AfN9dvXRdTeroYrSvAkZVDoKvyNlSYybsWzngOeIG60n X-Received: by 2002:aa7:c69a:0:b0:46d:e3f8:4ed4 with SMTP id n26-20020aa7c69a000000b0046de3f84ed4mr3636033edq.21.1671676318539; Wed, 21 Dec 2022 18:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671676318; cv=none; d=google.com; s=arc-20160816; b=ICbHyu53qmhCx/Dq2VG1OTVedJejHEQ9P0aMexphemnUzLB3dL1j4+ZHhddyoHD35l r8Ku3MEmP2PPe3sjuAXjtHN//Q07KKOF75GwctVoR3Wj7VLyJ8RDMbBtVwowVWf3NCxL NlxaGeUaHPX+YhT228CJND/M3W5eKRt5TdQEfDGkxFdctTLk42qqV9jDm/LUITgNh4SU pz1Le1GCp3Cb3LLKpSzdR1J6GtAfXIvbEPYk8SONNg8nF7q1B/mzX0XzVC8pR/+VQ9qm U8XtT78oQ+vC/SBsRJLfI8j3QSXTcwOtxK41SrMxIKPBATP3omoqxVZhvIAUd37r3onb hfeQ== 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=fVWA7/D2KvjMyMicmKIzWkp9wEe3Q6Twufyriuc4mnk=; b=LhwiAsto9LAzt2xQr/vcLmUyFO5nEykAgeBIKG0pmP5xUkISZgMbPsvyDjMzGKMWn2 9pEZsIv5euCXJh4YXCUcksnFUupRyDVBk241EaQOtXJSyagzDNMv9zTfMfwKRLprI6oT kAVZ07oxaoRioOHab0Aq64cGz5kuFVGrzEn95GEFXHLYC52s9GSHvR85RxtsU8MPPDTL SIQr7YZfqR5I2Gj0zLPYSBxrz8oxZOMCy1NJMsR5p9Q1ZnWLeESdVR0ZJkd9/hSO+4cg cy3Pvqsa2OMdHh2bzuGHIzgbzMkWPGi6SrWJvyigvNFP20zVuAYFGj9TxWzjbwDxVz4d 6KnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=F+cvtx7S; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s24-20020a056402037800b0046187ab5c1bsi14303555edw.512.2022.12.21.18.31.34; Wed, 21 Dec 2022 18:31:58 -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=@chromium.org header.s=google header.b=F+cvtx7S; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234914AbiLVC04 (ORCPT + 99 others); Wed, 21 Dec 2022 21:26:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbiLVC0u (ORCPT ); Wed, 21 Dec 2022 21:26:50 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E2E10069 for ; Wed, 21 Dec 2022 18:26:50 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id z144so372617iof.3 for ; Wed, 21 Dec 2022 18:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fVWA7/D2KvjMyMicmKIzWkp9wEe3Q6Twufyriuc4mnk=; b=F+cvtx7SUTBiDbyXWwC1K3FSy9wvZ3+6N3Ol2twXHs8J8w4KDcC3F1O1+gSzcMeK3X Aj4VfFDE8EzvrmHmiq0I9CxoJZAMmE+mYUaWWJzu6CNM+4jWd/SyDIjcr/BmG40Sdr3s e+ao1Efe1LBSnUNdNyzTedN629/nEG+bd9ZuU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fVWA7/D2KvjMyMicmKIzWkp9wEe3Q6Twufyriuc4mnk=; b=h8qo7OobuWl/xxKscfXgIbwS6SburtcGO8LcMx0iK1ZgRSCfwE3ZjGPPqYYVHwVguF lLVTE1/5sg7+eJiXWFk5V5YmdJRoDHwa29538czAfr364lXIgtn4hdQFgMi7DW500uuU nshP3s6TUU2kZwCvIGyFa0CHF0IercaylnK2tYSOQicXCxYQdGpXuARy9bWS24KqmsGb gQk/EBqARHUGvNnd2n8AChDQJC7IEQVlDaRarYyCbQEpxDWsQbLvKoTTfygRbsyyhRVE HAkQFEvUjxVpFaesgrBWfQJBYO526+54viVzwOq4wubgDpnCDVzcPNsyDmnGWCYRNPln O1rA== X-Gm-Message-State: AFqh2kqpYAfjaZy/2ixF1++fTIQZ4ydv/LKHCm9+cqfM42U5JvPZQ8hS 1wXaaPbanbrKZvXp3ABBg0lCZw== X-Received: by 2002:a6b:dc02:0:b0:6e2:d3fa:76eb with SMTP id s2-20020a6bdc02000000b006e2d3fa76ebmr2618945ioc.20.1671676009612; Wed, 21 Dec 2022 18:26:49 -0800 (PST) Received: from localhost (30.23.70.34.bc.googleusercontent.com. [34.70.23.30]) by smtp.gmail.com with UTF8SMTPSA id x43-20020a0294ae000000b00375783003fcsm5994321jah.136.2022.12.21.18.26.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 18:26:49 -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 2/2] usb: misc: onboard_hub: Fail silently when there is no platform device Date: Thu, 22 Dec 2022 02:26:45 +0000 Message-Id: <20221222022605.v2.2.I0c5ce35d591fa1f405f213c444522585be5601f0@changeid> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> References: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752879667577092501?= X-GMAIL-MSGID: =?utf-8?q?1752879667577092501?= Some boards with an onboard USB hub supported by the onboard_hub driver have a device tree node for the hub, but the node doesn't specify all properties needed by the driver (which is not a DT error per se). For such a hub no onboard_hub platform device is created. However the USB portion of the onboard hub driver still probes and uses _find_onboard_hub() to find the platform device that corresponds to the hub. If the DT node of the hub doesn't have an associated platform device the function looks for a "peer-hub" node (to get the platform device from there), if that doesn't exist either it logs an error and returns -EINVAL. The absence of a platform device is expected in some configurations, so drop the error log and fail silently with -ENODEV. Fixes: 8bc063641ceb ("usb: misc: Add onboard_usb_hub driver") Signed-off-by: Matthias Kaehlcke Tested-by: Stefan Wahren --- Changes in v2: - patch added to the series drivers/usb/misc/onboard_usb_hub.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/onboard_usb_hub.c b/drivers/usb/misc/onboard_usb_hub.c index d63c63942af1..44a0b0ddee55 100644 --- a/drivers/usb/misc/onboard_usb_hub.c +++ b/drivers/usb/misc/onboard_usb_hub.c @@ -348,10 +348,8 @@ static struct onboard_hub *_find_onboard_hub(struct device *dev) pdev = of_find_device_by_node(dev->of_node); if (!pdev) { np = of_parse_phandle(dev->of_node, "peer-hub", 0); - if (!np) { - dev_err(dev, "failed to find device node for peer hub\n"); - return ERR_PTR(-EINVAL); - } + if (!np) + return ERR_PTR(-ENODEV); pdev = of_find_device_by_node(np); of_node_put(np);