mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/5] of: platform: return early when deep probe is not supported
Date: Tue,  8 Mar 2022 12:50:59 +0100	[thread overview]
Message-ID: <20220308115103.3664883-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20220308115103.3664883-1-s.hauer@pengutronix.de>

When deep probe is not supported we can bail out early from the
of_devices_ensure_probed_by_* functions. This saves us from iterating
over the whole device tree and then doing nothing on the found nodes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/platform.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 0e718469db..5a05001213 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -455,6 +455,9 @@ int of_device_ensure_probed_by_alias(const char *alias)
 {
 	struct device_node *dev_node;
 
+	if (!deep_probe_is_supported())
+		return 0;
+
 	dev_node = of_find_node_by_alias(NULL, alias);
 	if (!dev_node)
 		return -EINVAL;
@@ -480,6 +483,9 @@ int of_devices_ensure_probed_by_dev_id(const struct of_device_id *ids)
 	struct device_node *np;
 	int err, ret = 0;
 
+	if (!deep_probe_is_supported())
+		return 0;
+
 	for_each_matching_node(np, ids) {
 		if (!of_device_is_available(np))
 			continue;
@@ -509,6 +515,9 @@ int of_devices_ensure_probed_by_property(const char *property_name)
 {
 	struct device_node *node;
 
+	if (!deep_probe_is_supported())
+		return 0;
+
 	for_each_node_with_property(node, property_name) {
 		int ret;
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-03-08 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 11:50 [PATCH 0/5] of: platform: deep probe updates Sascha Hauer
2022-03-08 11:50 ` Sascha Hauer [this message]
2022-03-08 11:51 ` [PATCH 2/5] of: rename of_find_node_by_name() to of_find_node_by_name_address() Sascha Hauer
2022-03-08 11:51 ` [PATCH 3/5] of: Add of_find_node_by_name() with Linux semantics Sascha Hauer
2022-03-08 11:51 ` [PATCH 4/5] of: platform: Change of_devices_ensure_probed_by_property() return value Sascha Hauer
2022-03-08 11:51 ` [PATCH 5/5] of: platform: Ensure timers are probed early Sascha Hauer

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=20220308115103.3664883-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox