summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-09-05 12:35:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-09-13 12:07:55 +0200
commit8f3057d381d48adc26701231a8c78d918a91a57c (patch)
tree8cd4c50be89c77f5822190b0924c3b88ba8e586d /drivers
parentca5e915485dfe6651cc42292e27889c96c438bcc (diff)
downloadbarebox-8f3057d381d48adc26701231a8c78d918a91a57c.tar.gz
barebox-8f3057d381d48adc26701231a8c78d918a91a57c.tar.xz
of: platform: optimize of_find_device_by_node when deep probing
With deep probe enabled, we are guaranteed that struct device_node::dev is populated whenever a device had been created for a node, so in that case, skip the iteration over the linked list of registered devices. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905103546.1476277-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/platform.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index dd86667f88..a9a5d4c2da 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -28,6 +28,9 @@ struct device_d *of_find_device_by_node(struct device_node *np)
if (ret)
return NULL;
+ if (deep_probe_is_supported())
+ return np->dev;
+
for_each_device(dev)
if (dev->device_node == np)
return dev;