lkml.org 
[lkml]   [2012]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] devicetree: pull evaluation of of_address_to_resource() out of loop in of_dev_lookup()
Date
The result of_address_to_resource(np, 0, &res) is independent from the
for (; lookup->compatible != NULL; lookup++) {
}
loop evaluation. Evaluate it once before entering the loop.

Also add a space between 'for' keyword and parens.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
drivers/of/platform.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 343ad29..528405f 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -314,11 +314,12 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
if (!lookup)
return NULL;

- for(; lookup->compatible != NULL; lookup++) {
+ if (of_address_to_resource(np, 0, &res))
+ return NULL;
+
+ for (; lookup->compatible != NULL; lookup++) {
if (!of_device_is_compatible(np, lookup->compatible))
continue;
- if (of_address_to_resource(np, 0, &res))
- continue;
if (res.start != lookup->phys_addr)
continue;
pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-04-03 14:51    [W:0.100 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site