[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1333457308-6005-1-git-send-email-LW@KARO-electronics.de>
Date: Tue, 3 Apr 2012 14:48:28 +0200
From: Lothar Waßmann <LW@...O-electronics.de>
To: Grant Likely <grant.likely@...retlab.ca>
Cc: Rob Herring <rob.herring@...xeda.com>,
linux-kernel@...r.kernel.org,
Lothar Waßmann <LW@...O-electronics.de>
Subject: [PATCH] devicetree: pull evaluation of of_address_to_resource() out of loop in of_dev_lookup()
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@...O-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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists