Skip to content

Commit

Permalink
of: introduce helper to manage boolean
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean-Christophe PLAGNIOL-VILLARD committed Mar 15, 2012
1 parent 98619dc commit fa4d34c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fa4d34c

Please sign in to comment.