]> git.karo-electronics.de Git - karo-tx-linux.git/commit
dt: add property iteration helpers
authorStephen Warren <swarren@nvidia.com>
Wed, 4 Apr 2012 15:27:46 +0000 (09:27 -0600)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 10 Apr 2012 08:15:40 +0000 (10:15 +0200)
commit650ae0f8387f650f1e4d32430602835dbc86e7c2
tree599cba221055da432a91dc8027b59f07e691f630
parent5106d0c655596585086c39feb366a60434e37f83
dt: add property iteration helpers

This patch adds macros of_property_for_each_u32() and
of_property_for_each_string(), which iterate over an array of values
within a device-tree property. Usage is for example:

struct property *prop;
const __be32 *p;
u32 u;
of_property_for_each_u32(np, "propname", prop, p, u)
printk("U32 value: %x\n", u);

struct property *prop;
const char *s;
of_property_for_each_string(np, "propname", prop, s)
printk("String value: %s\n", s);

Based on work by Rob Herring <robherring2@gmail.com>

Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/of/base.c
include/linux/of.h