[PATCH 1/5] of: platform: return early when deep probe is not supported

Sascha Hauer s.hauer at pengutronix.de
Tue Mar 8 03:50:59 PST 2022


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 at 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




More information about the barebox mailing list