include/linux/of.h: make for_each_child_of_node() reference its args when CONFIG_OF=n
authorDavid Howells <dhowells@redhat.com>
Thu, 23 Jan 2014 23:54:02 +0000 (15:54 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Jan 2014 00:36:55 +0000 (16:36 -0800)
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/of.h

index 276c546980d81fec5867a3126cc2bb73575ed769..70c64ba17fa51f7cca0e232b8f95b7669f5a3075 100644 (file)
@@ -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)