Messages in this thread Patch in this message | | | From | Lothar Waßmann <> | Subject | [PATCH] devicetree: pull evaluation of of_address_to_resource() out of loop in of_dev_lookup() | Date | Tue, 3 Apr 2012 14:48:28 +0200 |
| |
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/
| |