40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
From: Hans de Goede <hdegoede@redhat.com>
|
|
Date: Fri, 14 Nov 2014 13:26:52 +0100
|
|
Subject: of.h: Keep extern declaration of of_* variables when !CONFIG_OF
|
|
Origin: https://git.kernel.org/linus/6d09dc6b74caaca83e32e67f2454406041d58fb0
|
|
|
|
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>
|
|
---
|
|
include/linux/of.h | 3 +--
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
|
--- a/include/linux/of.h
|
|
+++ b/include/linux/of.h
|
|
@@ -107,14 +107,13 @@ static inline struct device_node *of_nod
|
|
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 raw_spinlock_t devtree_lock;
|
|
|
|
+#ifdef CONFIG_OF
|
|
static inline bool of_have_populated_dt(void)
|
|
{
|
|
return of_allnodes != NULL;
|