Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+16
+16
include/linux/of.h
··· 342 342 #define of_match_node(_matches, _node) NULL 343 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 361 static inline int of_property_read_u32(const struct device_node *np, 346 362 const char *propname, 347 363 u32 *out_value)