aboutsummaryrefslogtreecommitdiff
path: root/drivers/of/selftest.c
AgeCommit message (Collapse)Author
2013-02-13of: Create function for counting number of phandles in a propertyGrant Likely
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>
2013-02-13of/selftest: Use selftest() macro throughoutGrant Likely
Some of the selftests are open-coded. Others use the selftest() macro defined in drivers/of/selftest.c. The macro makes for cleaner selftest code, so refactor the of_parse_phandle_with_args() tests to use it. Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-13of/selftest: Fix GPIOs selftest to cover the 7th caseGrant Likely
The of_gpio_named_count() self test doesn't hit the out-of-range condition even though it is coded. Fix the bug by increasing the for loop range by one. Reported-by: Andreas Larsson <andreas@gaisler.com> Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2012-01-28of: Add of_property_match_string() to find index into a string listGrant Likely
Add a helper function for finding the index of a string in a string list property. This helper is useful for bindings that use a separate *-name property for attaching names to tuples in another property such as 'reg' or 'gpios'. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-12-12of: Add device tree selftestsGrant Likely
Add some runtime test cases for the library of device tree parsing functions. v2: - Add testcase for phandle with 0 args - Don't run testcases if testcase data isn't present in device tree Signed-off-by: Grant Likely <grant.likely@secretlab.ca>