[PATCH 5/8] of: When checking for existing devices also check resource end

Sascha Hauer s.hauer at pengutronix.de
Mon May 20 10:14:17 EDT 2013


When registering devices from the devicetree we check if these
devices already exist. When doing this not only check the resource
start but also the resource end.
This helps with the probing of simple buses for which child nodes
often begin at the very same address as the parents.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/of/base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8383549..ef97a15 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -970,7 +970,8 @@ static int add_of_device_resource(struct device_node *node)
 	for_each_device(dev) {
 		if (!dev->resource)
 			continue;
-		if (dev->resource->start == address) {
+		if (dev->resource->start == res->start &&
+				dev->resource->end == res->end) {
 			debug("connecting %s to %s\n", node->name, dev_name(dev));
 			node->device = dev;
 			dev->device_node = node;
-- 
1.8.2.rc2




More information about the barebox mailing list