summaryrefslogtreecommitdiff
path: root/include/linux/property.h
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-09-19 12:39:12 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-09 00:17:23 +0100
commit5e4b1b707b7ed795585b8ee28c44ce692aa8dfef (patch)
tree0a978b135e6711712fb3d0506a6a03eda0fcbe23 /include/linux/property.h
parentcf89a31ca55272e1dfb9527b5a61eee4d417747a (diff)
device property: Add a macro for interating over graph endpoints
Add a convenience macro for iterating over graph endpoints. Iterating over graph endpoints using fwnode_graph_get_next_endpoint() is a recurring pattern, and this macro allows calling that function in a slightly more convenient way. For instance, for (child = NULL; (child = fwnode_graph_get_next_endpoint(fwnode, child)); ) becomes fwnode_graph_for_each_endpoint(fwnode, child) Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/property.h')
-rw-r--r--include/linux/property.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/property.h b/include/linux/property.h
index 42069c20caee..f6189a3ac63c 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -293,6 +293,10 @@ struct fwnode_handle *
fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
u32 endpoint);
+#define fwnode_graph_for_each_endpoint(fwnode, child) \
+ for (child = NULL; \
+ (child = fwnode_graph_get_next_endpoint(fwnode, child)); )
+
int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint);