Skip to content

Commit

Permalink
include/linux/of.h: make for_each_child_of_node() reference its args …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
David Howells authored and Linus Torvalds committed Jan 24, 2014
1 parent 04f9b74 commit 00b2c76
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 00b2c76

Please sign in to comment.