aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/cpuidle.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2013-04-23 04:54:31 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-04-23 07:45:22 -0400
commit554c06ba3ee29cf453fca17e9e61120b75aa476d (patch)
tree05633b02fbfd86872b92061d9b5c6fb38c0f6f8c /drivers/cpuidle/cpuidle.c
parent3dcb9f1b17879534c80ccbf62fd13156f83ef799 (diff)
cpuidle: remove en_core_tk_irqen flag
The en_core_tk_irqen flag is set in all the cpuidle driver which means it is not necessary to specify this flag. Remove the flag and the code related to it. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Kevin Hilman <khilman@linaro.org> # for mach-omap2/* Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/cpuidle.c')
-rw-r--r--drivers/cpuidle/cpuidle.c72
1 files changed, 18 insertions, 54 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index c50037029184..0da795b9dbbf 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -43,24 +43,6 @@ void disable_cpuidle(void)
43 43
44static int __cpuidle_register_device(struct cpuidle_device *dev); 44static int __cpuidle_register_device(struct cpuidle_device *dev);
45 45
46static inline int cpuidle_enter(struct cpuidle_device *dev,
47 struct cpuidle_driver *drv, int index)
48{
49 struct cpuidle_state *target_state = &drv->states[index];
50 return target_state->enter(dev, drv, index);
51}
52
53static inline int cpuidle_enter_tk(struct cpuidle_device *dev,
54 struct cpuidle_driver *drv, int index)
55{
56 return cpuidle_wrap_enter(dev, drv, index, cpuidle_enter);
57}
58
59typedef int (*cpuidle_enter_t)(struct cpuidle_device *dev,
60 struct cpuidle_driver *drv, int index);
61
62static cpuidle_enter_t cpuidle_enter_ops;
63
64/** 46/**
65 * cpuidle_play_dead - cpu off-lining 47 * cpuidle_play_dead - cpu off-lining
66 * 48 *
@@ -90,11 +72,27 @@ int cpuidle_play_dead(void)
90 * @next_state: index into drv->states of the state to enter 72 * @next_state: index into drv->states of the state to enter
91 */ 73 */
92int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, 74int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
93 int next_state) 75 int index)
94{ 76{
95 int entered_state; 77 int entered_state;
96 78
97 entered_state = cpuidle_enter_ops(dev, drv, next_state); 79 struct cpuidle_state *target_state = &drv->states[index];
80 ktime_t time_start, time_end;
81 s64 diff;
82
83 time_start = ktime_get();
84
85 entered_state = target_state->enter(dev, drv, index);
86
87 time_end = ktime_get();
88
89 local_irq_enable();
90
91 diff = ktime_to_us(ktime_sub(time_end, time_start));
92 if (diff > INT_MAX)
93 diff = INT_MAX;
94
95 dev->last_residency = (int) diff;
98 96
99 if (entered_state >= 0) { 97 if (entered_state >= 0) {
100 /* Update cpuidle counters */ 98 /* Update cpuidle counters */
@@ -231,37 +229,6 @@ void cpuidle_resume(void)
231 mutex_unlock(&cpuidle_lock); 229 mutex_unlock(&cpuidle_lock);
232} 230}
233 231
234/**
235 * cpuidle_wrap_enter - performs timekeeping and irqen around enter function
236 * @dev: pointer to a valid cpuidle_device object
237 * @drv: pointer to a valid cpuidle_driver object
238 * @index: index of the target cpuidle state.
239 */
240int cpuidle_wrap_enter(struct cpuidle_device *dev,
241 struct cpuidle_driver *drv, int index,
242 int (*enter)(struct cpuidle_device *dev,
243 struct cpuidle_driver *drv, int index))
244{
245 ktime_t time_start, time_end;
246 s64 diff;
247
248 time_start = ktime_get();
249
250 index = enter(dev, drv, index);
251
252 time_end = ktime_get();
253
254 local_irq_enable();
255
256 diff = ktime_to_us(ktime_sub(time_end, time_start));
257 if (diff > INT_MAX)
258 diff = INT_MAX;
259
260 dev->last_residency = (int) diff;
261
262 return index;
263}
264
265#ifdef CONFIG_ARCH_HAS_CPU_RELAX 232#ifdef CONFIG_ARCH_HAS_CPU_RELAX
266static int poll_idle(struct cpuidle_device *dev, 233static int poll_idle(struct cpuidle_device *dev,
267 struct cpuidle_driver *drv, int index) 234 struct cpuidle_driver *drv, int index)
@@ -333,9 +300,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
333 return ret; 300 return ret;
334 } 301 }
335 302
336 cpuidle_enter_ops = drv->en_core_tk_irqen ?
337 cpuidle_enter_tk : cpuidle_enter;
338
339 poll_idle_init(drv); 303 poll_idle_init(drv);
340 304
341 ret = cpuidle_add_device_sysfs(dev); 305 ret = cpuidle_add_device_sysfs(dev);