All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Sean Anderson <seanga2@gmail.com>, Simon Glass <sjg@chromium.org>,
	Steven Lawrance <steven.lawrance@softathome.com>
Subject: [PATCH 3/3] led: gpio: Check device compatible string to determine the top level node
Date: Fri, 22 Apr 2022 15:15:55 +0200	[thread overview]
Message-ID: <20220422131555.123598-3-marex@denx.de> (raw)
In-Reply-To: <20220422131555.123598-1-marex@denx.de>

Since 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing"),
all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio")
to determine whether this is a top-level node, since it is only the top
level node which is compatible with "leds-gpio", the GPIO LEDs subnodes
are not.

Fixes: 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
---
 drivers/led/led_gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
index 958dbd31e77..23156907593 100644
--- a/drivers/led/led_gpio.c
+++ b/drivers/led/led_gpio.c
@@ -57,12 +57,11 @@ static enum led_state_t gpio_led_get_state(struct udevice *dev)
 
 static int led_gpio_probe(struct udevice *dev)
 {
-	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
 	struct led_gpio_priv *priv = dev_get_priv(dev);
 	int ret;
 
 	/* Ignore the top-level LED node */
-	if (!uc_plat->label)
+	if (device_is_compatible(dev, "gpio-leds"))
 		return 0;
 
 	ret = gpio_request_by_name(dev, "gpios", 0, &priv->gpio, GPIOD_IS_OUT);
-- 
2.35.1


  parent reply	other threads:[~2022-04-22 13:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 13:15 [PATCH 1/3] dm: core: Add DM_FLAG_PROBE_AFTER_BIND flag Marek Vasut
2022-04-22 13:15 ` [PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND Marek Vasut
2022-04-22 13:44   ` Patrice CHOTARD
2022-04-25 14:31   ` Tom Rini
2022-04-25 16:43     ` Marek Vasut
2022-04-28 19:42   ` Tom Rini
2022-04-22 13:15 ` Marek Vasut [this message]
2022-04-22 13:45   ` [PATCH 3/3] led: gpio: Check device compatible string to determine the top level node Patrice CHOTARD
2022-04-28 19:42   ` Tom Rini
2022-04-22 13:43 ` [PATCH 1/3] dm: core: Add DM_FLAG_PROBE_AFTER_BIND flag Patrice CHOTARD
2022-04-22 13:49 ` Sean Anderson
2022-04-22 13:52   ` Marek Vasut
2022-04-22 22:45     ` Sean Anderson
2022-04-22 23:07       ` Marek Vasut
2022-04-23  0:16         ` Sean Anderson
2022-04-23  2:02           ` Marek Vasut
2022-04-28 19:42 ` Tom Rini

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=20220422131555.123598-3-marex@denx.de \
    --to=marex@denx.de \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=steven.lawrance@softathome.com \
    --cc=u-boot@lists.denx.de \
    /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.