[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180424173051.15099-7-brgl@bgdev.pl>
Date: Tue, 24 Apr 2018 19:30:46 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Sekhar Nori <nsekhar@...com>, Kevin Hilman <khilman@...nel.org>,
David Lechner <david@...hnology.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
Frank Rowand <frowand.list@...il.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Arend van Spriel <aspriel@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Michal Suchanek <msuchanek@...e.de>,
Jan Kiszka <jan.kiszka@...mens.com>,
Andy Shevchenko <andy.shevchenko@...il.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH 06/11] of: provide for_each_compatible_child_node()
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
Add a variant of for_each_compatible_node() allowing to only iterate
over all compatible nodes that are children of the specified root node.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
---
include/linux/of.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/of.h b/include/linux/of.h
index 4d25e4f952d9..15e0dbf7a602 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1170,6 +1170,9 @@ static inline int of_property_read_s32(const struct device_node *np,
#define for_each_compatible_node(dn, type, compatible) \
for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
dn = of_find_compatible_node(dn, type, compatible))
+#define for_each_compatible_child_node(dn, type, compatible, root) \
+ for (dn = of_find_compatible_node(root, type, compatible); dn; \
+ dn = of_find_compatible_node(dn, type, compatible))
#define for_each_matching_node(dn, matches) \
for (dn = of_find_matching_node(NULL, matches); dn; \
dn = of_find_matching_node(dn, matches))
--
2.17.0
Powered by blists - more mailing lists