devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] Make for_each_child_of_node() reference its args when CONFIG_OF=n
@ 2014-01-03 16:07 David Howells
       [not found] ` <20140103160723.8153.14334.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2014-01-03 16:07 UTC (permalink / raw)
  To: akpm; +Cc: Grant Likely, devicetree, dhowells, Rob Herring, linux-kernel

Make for_each_child_of_node() reference its args when CONFIG_OF=n to avoid
warnings like:

	drivers/leds/leds-pwm.c:88:22: warning: unused variable 'node' [-Wunused-variable]
	  struct device_node *node = pdev->dev.of_node;
			      ^

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Grant Likely <grant.likely@linaro.org>
cc: Rob Herring <robh+dt@kernel.org>
cc: devicetree@vger.kernel.org
---

 include/linux/of.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 276c546980d8..70c64ba17fa5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -377,8 +377,13 @@ static inline bool of_have_populated_dt(void)
 	return false;
 }
 
+/* Kill an unused variable warning on a device_node pointer */
+static inline void __of_use_dn(const struct device_node *np)
+{
+}
+
 #define for_each_child_of_node(parent, child) \
-	while (0)
+	while (__of_use_dn(parent), __of_use_dn(child), 0)
 
 #define for_each_available_child_of_node(parent, child) \
 	while (0)

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

end of thread, other threads:[~2014-01-03 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-03 16:07 [PATCH 1/7] Make for_each_child_of_node() reference its args when CONFIG_OF=n David Howells
     [not found] ` <20140103160723.8153.14334.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2014-01-03 22:30   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).