All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Stefan Wahren <stefan.wahren@i2se.com>,
	stable@vger.kernel.org, Douglas Anderson <dianders@chromium.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	Ravi Chandra Sadineni <ravisadineni@chromium.org>
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	[thread overview]
Message-ID: <20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid> (raw)

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 <stefan.wahren@i2se.com>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

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,
-- 
2.39.0.314.g84b9a713c41-goog


             reply	other threads:[~2022-12-22  2:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22  2:26 Matthias Kaehlcke [this message]
2022-12-22  2:26 ` [PATCH v2 2/2] usb: misc: onboard_hub: Fail silently when there is no platform device Matthias Kaehlcke
2022-12-22  5:50   ` Greg Kroah-Hartman
2022-12-22 12:21   ` Stefan Wahren
2022-12-22  2:28 ` [PATCH v2 1/2] usb: misc: onboard_usb_hub: Don't create platform devices for DT nodes without 'vdd-supply' kernel test robot
2022-12-22  5:50 ` Greg Kroah-Hartman
2022-12-22 12:19 ` Stefan Wahren
2022-12-22 19:26 ` Doug Anderson
2022-12-23  7:46   ` Icenowy Zheng
2023-01-02  9:20     ` Alexander Stein
2023-01-02 11:44       ` Stefan Wahren
2023-01-02 14:38         ` Alexander Stein
2023-01-03 17:31           ` Matthias Kaehlcke
2023-01-03 17:24     ` Matthias Kaehlcke
2023-01-03 17:12   ` Matthias Kaehlcke
2023-01-04  9:00     ` Alexander Stein
2023-01-04 19:37       ` Matthias Kaehlcke
2023-01-05  1:42         ` Matthias Kaehlcke
2023-01-05  7:50         ` Stefan Wahren
2023-01-05 19:41           ` Matthias Kaehlcke
2023-01-05 20:45         ` Matthias Kaehlcke
2022-12-23 14:01 ` Johan Hovold
2023-01-03 17:42   ` Matthias Kaehlcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221222022605.v2.1.If5e7ec83b1782e4dffa6ea759416a27326c8231d@changeid \
    --to=mka@chromium.org \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ravisadineni@chromium.org \
    --cc=stable@vger.kernel.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.