Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

include/linux/of.h: make for_each_child_of_node() reference its args when CONFIG_OF=n

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>

authored by

David Howells and committed by
Linus Torvalds
00b2c76a 04f9b74e

+6 -1
+6 -1
include/linux/of.h
··· 377 377 return false; 378 378 } 379 379 380 + /* Kill an unused variable warning on a device_node pointer */ 381 + static inline void __of_use_dn(const struct device_node *np) 382 + { 383 + } 384 + 380 385 #define for_each_child_of_node(parent, child) \ 381 - while (0) 386 + while (__of_use_dn(parent), __of_use_dn(child), 0) 382 387 383 388 #define for_each_available_child_of_node(parent, child) \ 384 389 while (0)