diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2013-02-11 02:57:21 +0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-02-13 14:09:31 +0400 |
commit | bd69f73f2c81eed9a398708b8c4bb3409ba1b0f9 (patch) | |
tree | 0be6f0ee561d13d01b6c44478b693cc60453ff6d /include/linux/of.h | |
parent | 23ce04c0734e33b1042273b0ed11a8e4f7f988ca (diff) | |
download | linux-bd69f73f2c81eed9a398708b8c4bb3409ba1b0f9.tar.xz |
of: Create function for counting number of phandles in a property
This patch creates of_count_phandle_with_args(), a new function for
counting the number of phandle+argument tuples in a given property. This
is better than the existing method of parsing each phandle individually
until parsing fails which is a horribly slow way to do the count.
Tested on ARM using the selftest code.
v3: - Rebased on top of selftest code cleanup patch
v2: - fix bug where of_parse_phandle_with_args() could behave like _count_.
- made of_gpio_named_count() into a static inline regardless of CONFIG_OF_GPIO
Tested-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index b9e1b911f0eb..a0f129284948 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -277,6 +277,8 @@ extern struct device_node *of_parse_phandle(const struct device_node *np, extern int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name, int index, struct of_phandle_args *out_args); +extern int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, const char *cells_name); extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); extern int of_alias_get_id(struct device_node *np, const char *stem); @@ -467,6 +469,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np, return -ENOSYS; } +static inline int of_count_phandle_with_args(struct device_node *np, + const char *list_name, + const char *cells_name) +{ + return -ENOSYS; +} + static inline int of_alias_get_id(struct device_node *np, const char *stem) { return -ENOSYS; |