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 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND
Date: Fri, 22 Apr 2022 15:15:54 +0200	[thread overview]
Message-ID: <20220422131555.123598-2-marex@denx.de> (raw)
In-Reply-To: <20220422131555.123598-1-marex@denx.de>

Calling device_probe() from uclass .post_bind() callback has all kinds
of odd side-effects, e.g. device instances not being available just yet.
Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances
which need to be probe()d in order to configure the LED default state
with this flag and let the DM core do the device_probe() at the right
time instead.

Fixes: 72675b063b6 ("led: Configure LED default-state on boot")
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-uclass.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 5d7bf40896b..2ce72933b6c 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -98,7 +98,9 @@ static int led_post_bind(struct udevice *dev)
 	 * In case the LED has default-state DT property, trigger
 	 * probe() to configure its default state during startup.
 	 */
-	return device_probe(dev);
+	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
+
+	return 0;
 }
 
 static int led_post_probe(struct udevice *dev)
-- 
2.35.1


  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 ` Marek Vasut [this message]
2022-04-22 13:44   ` [PATCH 2/3] led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND 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 ` [PATCH 3/3] led: gpio: Check device compatible string to determine the top level node Marek Vasut
2022-04-22 13:45   ` 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-2-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.