diff options
| author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-02-06 23:12:51 -0500 |
|---|---|---|
| committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-03-15 11:27:31 -0400 |
| commit | fa4d34ccd0914ac87336ea2c17e9370dfecef286 (patch) | |
| tree | a5929b60f6b8a52d60a91d0cf2a7e38079d57c44 /include | |
| parent | 98619dcb77d9dcbed67e39a71e4357fc99dc0f25 (diff) | |
of: introduce helper to manage boolean
of_property_read_bool
Search for a property in a device node.
Returns true if the property exist false otherwise.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/of.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index a75a831e2057..50059cf63135 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -342,6 +342,22 @@ static inline int of_machine_is_compatible(const char *compat) | |||
| 342 | #define of_match_node(_matches, _node) NULL | 342 | #define of_match_node(_matches, _node) NULL |
| 343 | #endif /* CONFIG_OF */ | 343 | #endif /* CONFIG_OF */ |
| 344 | 344 | ||
| 345 | /** | ||
| 346 | * of_property_read_bool - Findfrom a property | ||
| 347 | * @np: device node from which the property value is to be read. | ||
| 348 | * @propname: name of the property to be searched. | ||
| 349 | * | ||
| 350 | * Search for a property in a device node. | ||
| 351 | * Returns true if the property exist false otherwise. | ||
| 352 | */ | ||
| 353 | static inline bool of_property_read_bool(const struct device_node *np, | ||
| 354 | const char *propname) | ||
| 355 | { | ||
| 356 | struct property *prop = of_find_property(np, propname, NULL); | ||
| 357 | |||
| 358 | return prop ? true : false; | ||
| 359 | } | ||
| 360 | |||
| 345 | static inline int of_property_read_u32(const struct device_node *np, | 361 | static inline int of_property_read_u32(const struct device_node *np, |
| 346 | const char *propname, | 362 | const char *propname, |
| 347 | u32 *out_value) | 363 | u32 *out_value) |
