From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 7 Feb 2012 04:12:51 +0000 (+0800) Subject: of: introduce helper to manage boolean X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fa4d34ccd0914ac87336ea2c17e9370dfecef286;p=linux-beck.git 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 Acked-by: Rob Herring Acked-by: Arnd Bergmann Acked-by: Grant Likely --- 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) #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */ +/** + * of_property_read_bool - Findfrom a property + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * + * Search for a property in a device node. + * Returns true if the property exist false otherwise. + */ +static inline bool of_property_read_bool(const struct device_node *np, + const char *propname) +{ + struct property *prop = of_find_property(np, propname, NULL); + + return prop ? true : false; +} + static inline int of_property_read_u32(const struct device_node *np, const char *propname, u32 *out_value)