Skip to contentSkip to conversation

of: introduce helper to manage boolean

PATCH Superseded Jean-Christophe PLAGNIOL-VILLARD 2 participants 2 messages Mar 13, 2012 Device tree

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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.

---
v3:

include Grant comment

Grant can I get the go please?

Best Regards,
J.

 include/linux/of.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
include/linux/of.h +16 -0
index a75a831..a992cdf 100644
@@ -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 ? false : true;
+}
+
 static inline int of_property_read_u32(const struct device_node *np,
 				       const char *propname,
 				       u32 *out_value)
Signature · 1 line
1.7.7