diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-07-05 10:15:36 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-07-06 15:42:10 -0400 |
commit | 84774e615749acfce6b2f679b95924dffb5f5de1 (patch) | |
tree | b1a89607c0bff651296f8217f4b242c139bdd548 /drivers/of/platform.c | |
parent | 6887a4131da3adaab011613776d865f4bcfb5678 (diff) |
of: address: Don't fail a lookup just because a node has no reg property
Sometimes it doesn't make any sense for a node to have an address.
In this case device lookup will always be unsuccessful because we
currently assume every node will have a reg property. This patch
changes the semantics so that the resource address and the lookup
address will only be compared if one exists.
Things like AUXDATA() rely on of_dev_lookup to return the lookup
entry of a particular device in order to do things like apply
platform_data to a device. However, this is currently broken for
nodes which do not have a reg property, meaning that platform_data
can not be passed in those cases.
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r-- | drivers/of/platform.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 343ad29e211c..96004807dd28 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -317,10 +317,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l | |||
317 | for(; lookup->compatible != NULL; lookup++) { | 317 | for(; lookup->compatible != NULL; lookup++) { |
318 | if (!of_device_is_compatible(np, lookup->compatible)) | 318 | if (!of_device_is_compatible(np, lookup->compatible)) |
319 | continue; | 319 | continue; |
320 | if (of_address_to_resource(np, 0, &res)) | 320 | if (!of_address_to_resource(np, 0, &res)) |
321 | continue; | 321 | if (res.start != lookup->phys_addr) |
322 | if (res.start != lookup->phys_addr) | 322 | continue; |
323 | continue; | ||
324 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); | 323 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); |
325 | return lookup; | 324 | return lookup; |
326 | } | 325 | } |