diff options
| author | Hans de Goede <hdegoede@redhat.com> | 2014-11-14 07:26:52 -0500 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-11-14 08:28:58 -0500 |
| commit | 6d09dc6b74caaca83e32e67f2454406041d58fb0 (patch) | |
| tree | a96dc8eb8653bf0636807988878d5fc396227c21 /include/linux/of.h | |
| parent | 9bb5b20f5d983e98d9a1cc7b7af5877b0f1c791b (diff) | |
of.h: Keep extern declaration of of_* variables when !CONFIG_OF
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>
Diffstat (limited to 'include/linux/of.h')
| -rw-r--r-- | include/linux/of.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 6545e7aec7bb..f83ca9dddcba 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -105,8 +105,6 @@ static inline struct device_node *of_node_get(struct device_node *node) | |||
| 105 | static inline void of_node_put(struct device_node *node) { } | 105 | static inline void of_node_put(struct device_node *node) { } |
| 106 | #endif /* !CONFIG_OF_DYNAMIC */ | 106 | #endif /* !CONFIG_OF_DYNAMIC */ |
| 107 | 107 | ||
| 108 | #ifdef CONFIG_OF | ||
| 109 | |||
| 110 | /* Pointer for first entry in chain of all nodes. */ | 108 | /* Pointer for first entry in chain of all nodes. */ |
| 111 | extern struct device_node *of_allnodes; | 109 | extern struct device_node *of_allnodes; |
| 112 | extern struct device_node *of_chosen; | 110 | extern struct device_node *of_chosen; |
| @@ -114,6 +112,7 @@ extern struct device_node *of_aliases; | |||
| 114 | extern struct device_node *of_stdout; | 112 | extern struct device_node *of_stdout; |
| 115 | extern raw_spinlock_t devtree_lock; | 113 | extern raw_spinlock_t devtree_lock; |
| 116 | 114 | ||
| 115 | #ifdef CONFIG_OF | ||
| 117 | static inline bool of_have_populated_dt(void) | 116 | static inline bool of_have_populated_dt(void) |
| 118 | { | 117 | { |
| 119 | return of_allnodes != NULL; | 118 | return of_allnodes != NULL; |
