aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-02-07 12:12:51 +0800
committerBen Hutchings <ben@decadent.org.uk>2013-04-25 20:25:40 +0100
commit2930913e3d0c2cf88c635063af8a4fc721d6e31a (patch)
tree9440a12d9b7ee0725e4ae5f0e995e431902d59f4 /include
parentadd02e682081ecdf0ee4eaf9d10dc6ef6235789d (diff)
of: introduce helper to manage boolean
commit fa4d34ccd0914ac87336ea2c17e9370dfecef286 upstream. 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> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/of.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 4948552d60f..9bf9611878a 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -336,6 +336,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)