Skip to content

Commit

Permalink
of.h: Keep extern declaration of of_* variables when !CONFIG_OF
Browse files Browse the repository at this point in the history
Keep the extern declaration of of_allnodes and friends, when building without
of support, this way code using them can be written like this:

	if (IS_ENABLED(CONFIG_OF_PLATFORM) && of_chosen) {
		for_each_child_of_node(of_chosen, np)
			...
	}

And rely on the compiler optimizing it away, avoiding the need for #ifdef-ery.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Hans de Goede authored and Tomi Valkeinen committed Nov 14, 2014
1 parent 9bb5b20 commit 6d09dc6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,14 @@ static inline struct device_node *of_node_get(struct device_node *node)
static inline void of_node_put(struct device_node *node) { }
#endif /* !CONFIG_OF_DYNAMIC */

#ifdef CONFIG_OF

/* Pointer for first entry in chain of all nodes. */
extern struct device_node *of_allnodes;
extern struct device_node *of_chosen;
extern struct device_node *of_aliases;
extern struct device_node *of_stdout;
extern raw_spinlock_t devtree_lock;

#ifdef CONFIG_OF
static inline bool of_have_populated_dt(void)
{
return of_allnodes != NULL;
Expand Down

0 comments on commit 6d09dc6

Please sign in to comment.