diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-05-15 19:38:15 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-05-18 20:44:24 -0400 |
commit | 87e9b9f1d86c2ee9a10c2a4186a72d0af4cc963e (patch) | |
tree | d4967e50be04ffa2de19025b6c51f92284755a01 | |
parent | 671767360db8fdd1f082d15fb4b0107c1bb94a0b (diff) |
PM / sleep: Make suspend-to-idle-specific code depend on CONFIG_SUSPEND
Since idle_should_freeze() is defined to always return 'false'
for CONFIG_SUSPEND unset, all of the code depending on it in
cpuidle_idle_call() is not necessary in that case.
Make that code depend on CONFIG_SUSPEND too to avoid building it
when it is not going to be used.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 2 | ||||
-rw-r--r-- | include/linux/cpuidle.h | 16 | ||||
-rw-r--r-- | include/linux/tick.h | 12 | ||||
-rw-r--r-- | kernel/time/tick-common.c | 2 |
4 files changed, 22 insertions, 10 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 61c417b9e53f..71459f546145 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -92,6 +92,7 @@ static int find_deepest_state(struct cpuidle_driver *drv, | |||
92 | return ret; | 92 | return ret; |
93 | } | 93 | } |
94 | 94 | ||
95 | #ifdef CONFIG_SUSPEND | ||
95 | /** | 96 | /** |
96 | * cpuidle_find_deepest_state - Find the deepest available idle state. | 97 | * cpuidle_find_deepest_state - Find the deepest available idle state. |
97 | * @drv: cpuidle driver for the given CPU. | 98 | * @drv: cpuidle driver for the given CPU. |
@@ -145,6 +146,7 @@ int cpuidle_enter_freeze(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
145 | 146 | ||
146 | return index; | 147 | return index; |
147 | } | 148 | } |
149 | #endif /* CONFIG_SUSPEND */ | ||
148 | 150 | ||
149 | /** | 151 | /** |
150 | * cpuidle_enter_state - enter the state and update stats | 152 | * cpuidle_enter_state - enter the state and update stats |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 9c5e89254796..13ee266ca98c 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -151,10 +151,6 @@ extern void cpuidle_resume(void); | |||
151 | extern int cpuidle_enable_device(struct cpuidle_device *dev); | 151 | extern int cpuidle_enable_device(struct cpuidle_device *dev); |
152 | extern void cpuidle_disable_device(struct cpuidle_device *dev); | 152 | extern void cpuidle_disable_device(struct cpuidle_device *dev); |
153 | extern int cpuidle_play_dead(void); | 153 | extern int cpuidle_play_dead(void); |
154 | extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | ||
155 | struct cpuidle_device *dev); | ||
156 | extern int cpuidle_enter_freeze(struct cpuidle_driver *drv, | ||
157 | struct cpuidle_device *dev); | ||
158 | 154 | ||
159 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); | 155 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); |
160 | #else | 156 | #else |
@@ -190,14 +186,22 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev) | |||
190 | {return -ENODEV; } | 186 | {return -ENODEV; } |
191 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } | 187 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } |
192 | static inline int cpuidle_play_dead(void) {return -ENODEV; } | 188 | static inline int cpuidle_play_dead(void) {return -ENODEV; } |
189 | static inline struct cpuidle_driver *cpuidle_get_cpu_driver( | ||
190 | struct cpuidle_device *dev) {return NULL; } | ||
191 | #endif | ||
192 | |||
193 | #if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SUSPEND) | ||
194 | extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | ||
195 | struct cpuidle_device *dev); | ||
196 | extern int cpuidle_enter_freeze(struct cpuidle_driver *drv, | ||
197 | struct cpuidle_device *dev); | ||
198 | #else | ||
193 | static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | 199 | static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, |
194 | struct cpuidle_device *dev) | 200 | struct cpuidle_device *dev) |
195 | {return -ENODEV; } | 201 | {return -ENODEV; } |
196 | static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv, | 202 | static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv, |
197 | struct cpuidle_device *dev) | 203 | struct cpuidle_device *dev) |
198 | {return -ENODEV; } | 204 | {return -ENODEV; } |
199 | static inline struct cpuidle_driver *cpuidle_get_cpu_driver( | ||
200 | struct cpuidle_device *dev) {return NULL; } | ||
201 | #endif | 205 | #endif |
202 | 206 | ||
203 | #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED | 207 | #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED |
diff --git a/include/linux/tick.h b/include/linux/tick.h index f8492da57ad3..ec6e8bc992bf 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -13,8 +13,6 @@ | |||
13 | 13 | ||
14 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 14 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
15 | extern void __init tick_init(void); | 15 | extern void __init tick_init(void); |
16 | extern void tick_freeze(void); | ||
17 | extern void tick_unfreeze(void); | ||
18 | /* Should be core only, but ARM BL switcher requires it */ | 16 | /* Should be core only, but ARM BL switcher requires it */ |
19 | extern void tick_suspend_local(void); | 17 | extern void tick_suspend_local(void); |
20 | /* Should be core only, but XEN resume magic and ARM BL switcher require it */ | 18 | /* Should be core only, but XEN resume magic and ARM BL switcher require it */ |
@@ -23,14 +21,20 @@ extern void tick_handover_do_timer(void); | |||
23 | extern void tick_cleanup_dead_cpu(int cpu); | 21 | extern void tick_cleanup_dead_cpu(int cpu); |
24 | #else /* CONFIG_GENERIC_CLOCKEVENTS */ | 22 | #else /* CONFIG_GENERIC_CLOCKEVENTS */ |
25 | static inline void tick_init(void) { } | 23 | static inline void tick_init(void) { } |
26 | static inline void tick_freeze(void) { } | ||
27 | static inline void tick_unfreeze(void) { } | ||
28 | static inline void tick_suspend_local(void) { } | 24 | static inline void tick_suspend_local(void) { } |
29 | static inline void tick_resume_local(void) { } | 25 | static inline void tick_resume_local(void) { } |
30 | static inline void tick_handover_do_timer(void) { } | 26 | static inline void tick_handover_do_timer(void) { } |
31 | static inline void tick_cleanup_dead_cpu(int cpu) { } | 27 | static inline void tick_cleanup_dead_cpu(int cpu) { } |
32 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ | 28 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ |
33 | 29 | ||
30 | #if defined(CONFIG_GENERIC_CLOCKEVENTS) && defined(CONFIG_SUSPEND) | ||
31 | extern void tick_freeze(void); | ||
32 | extern void tick_unfreeze(void); | ||
33 | #else | ||
34 | static inline void tick_freeze(void) { } | ||
35 | static inline void tick_unfreeze(void) { } | ||
36 | #endif | ||
37 | |||
34 | #ifdef CONFIG_TICK_ONESHOT | 38 | #ifdef CONFIG_TICK_ONESHOT |
35 | extern void tick_irq_enter(void); | 39 | extern void tick_irq_enter(void); |
36 | # ifndef arch_needs_cpu | 40 | # ifndef arch_needs_cpu |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 80c043052487..51508465153c 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -441,6 +441,7 @@ void tick_resume(void) | |||
441 | tick_resume_local(); | 441 | tick_resume_local(); |
442 | } | 442 | } |
443 | 443 | ||
444 | #ifdef CONFIG_SUSPEND | ||
444 | static DEFINE_RAW_SPINLOCK(tick_freeze_lock); | 445 | static DEFINE_RAW_SPINLOCK(tick_freeze_lock); |
445 | static unsigned int tick_freeze_depth; | 446 | static unsigned int tick_freeze_depth; |
446 | 447 | ||
@@ -494,6 +495,7 @@ void tick_unfreeze(void) | |||
494 | 495 | ||
495 | raw_spin_unlock(&tick_freeze_lock); | 496 | raw_spin_unlock(&tick_freeze_lock); |
496 | } | 497 | } |
498 | #endif /* CONFIG_SUSPEND */ | ||
497 | 499 | ||
498 | /** | 500 | /** |
499 | * tick_init - initialize the tick control | 501 | * tick_init - initialize the tick control |