aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-05-15 19:38:15 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-05-18 20:44:24 -0400
commit87e9b9f1d86c2ee9a10c2a4186a72d0af4cc963e (patch)
treed4967e50be04ffa2de19025b6c51f92284755a01
parent671767360db8fdd1f082d15fb4b0107c1bb94a0b (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.c2
-rw-r--r--include/linux/cpuidle.h16
-rw-r--r--include/linux/tick.h12
-rw-r--r--kernel/time/tick-common.c2
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);
151extern int cpuidle_enable_device(struct cpuidle_device *dev); 151extern int cpuidle_enable_device(struct cpuidle_device *dev);
152extern void cpuidle_disable_device(struct cpuidle_device *dev); 152extern void cpuidle_disable_device(struct cpuidle_device *dev);
153extern int cpuidle_play_dead(void); 153extern int cpuidle_play_dead(void);
154extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
155 struct cpuidle_device *dev);
156extern int cpuidle_enter_freeze(struct cpuidle_driver *drv,
157 struct cpuidle_device *dev);
158 154
159extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 155extern 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; }
191static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 187static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
192static inline int cpuidle_play_dead(void) {return -ENODEV; } 188static inline int cpuidle_play_dead(void) {return -ENODEV; }
189static 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)
194extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
195 struct cpuidle_device *dev);
196extern int cpuidle_enter_freeze(struct cpuidle_driver *drv,
197 struct cpuidle_device *dev);
198#else
193static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, 199static 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; }
196static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv, 202static 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; }
199static 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
15extern void __init tick_init(void); 15extern void __init tick_init(void);
16extern void tick_freeze(void);
17extern 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 */
19extern void tick_suspend_local(void); 17extern 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);
23extern void tick_cleanup_dead_cpu(int cpu); 21extern void tick_cleanup_dead_cpu(int cpu);
24#else /* CONFIG_GENERIC_CLOCKEVENTS */ 22#else /* CONFIG_GENERIC_CLOCKEVENTS */
25static inline void tick_init(void) { } 23static inline void tick_init(void) { }
26static inline void tick_freeze(void) { }
27static inline void tick_unfreeze(void) { }
28static inline void tick_suspend_local(void) { } 24static inline void tick_suspend_local(void) { }
29static inline void tick_resume_local(void) { } 25static inline void tick_resume_local(void) { }
30static inline void tick_handover_do_timer(void) { } 26static inline void tick_handover_do_timer(void) { }
31static inline void tick_cleanup_dead_cpu(int cpu) { } 27static 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)
31extern void tick_freeze(void);
32extern void tick_unfreeze(void);
33#else
34static inline void tick_freeze(void) { }
35static inline void tick_unfreeze(void) { }
36#endif
37
34#ifdef CONFIG_TICK_ONESHOT 38#ifdef CONFIG_TICK_ONESHOT
35extern void tick_irq_enter(void); 39extern 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
444static DEFINE_RAW_SPINLOCK(tick_freeze_lock); 445static DEFINE_RAW_SPINLOCK(tick_freeze_lock);
445static unsigned int tick_freeze_depth; 446static 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