All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of: Add device_type access helper functions
@ 2018-08-30 18:52 Rob Herring
  2018-09-05  3:55 ` Frank Rowand
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2018-08-30 18:52 UTC (permalink / raw)
  To: devicetree; +Cc: linux-kernel, Frank Rowand

In preparation to remove direct access to device_node.type, add
of_node_is_type() and of_node_get_device_type() helpers to check and
retrieve the device type.

Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 include/linux/of.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/of.h b/include/linux/of.h
index a40f63a36afa..506beca9588d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -980,6 +980,18 @@ static inline struct device_node *of_find_matching_node(
 	return of_find_matching_node_and_match(from, matches, NULL);
 }
 
+static inline const char *of_node_get_device_type(const struct device_node *np)
+{
+	return of_get_property(np, "type", NULL);
+}
+
+static inline bool of_node_is_type(const struct device_node *np, const char *type)
+{
+	const char *match = of_node_get_device_type(np);
+
+	return np && match && type && !of_prop_cmp(match, type);
+}
+
 /**
  * of_property_count_u8_elems - Count the number of u8 elements in a property
  *
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-05 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 18:52 [PATCH] of: Add device_type access helper functions Rob Herring
2018-09-05  3:55 ` Frank Rowand
2018-09-05 13:17   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.