cpuidle.c (82ffd0454bd9bd57780966d47bfd56d579dd4fb3) cpuidle.c (6f9b83ac877fb5558d76b9f78590f3afd1bdf421)
1/*
2 * cpuidle.c - core cpuidle infrastructure
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.

--- 314 unchanged lines hidden (view full) ---

323 * @index: the index in the idle state table
324 *
325 * Returns the index in the idle state, < 0 in case of error.
326 * The error code depends on the backend driver
327 */
328int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev,
329 int index)
330{
1/*
2 * cpuidle.c - core cpuidle infrastructure
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.

--- 314 unchanged lines hidden (view full) ---

323 * @index: the index in the idle state table
324 *
325 * Returns the index in the idle state, < 0 in case of error.
326 * The error code depends on the backend driver
327 */
328int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev,
329 int index)
330{
331 int ret = 0;
332
333 /*
334 * Store the next hrtimer, which becomes either next tick or the next
335 * timer event, whatever expires first. Additionally, to make this data
336 * useful for consumers outside cpuidle, we rely on that the governor's
337 * ->select() callback have decided, whether to stop the tick or not.
338 */
339 WRITE_ONCE(dev->next_hrtimer, tick_nohz_get_next_hrtimer());
340
331 if (cpuidle_state_is_coupled(drv, index))
341 if (cpuidle_state_is_coupled(drv, index))
332 return cpuidle_enter_state_coupled(dev, drv, index);
333 return cpuidle_enter_state(dev, drv, index);
342 ret = cpuidle_enter_state_coupled(dev, drv, index);
343 else
344 ret = cpuidle_enter_state(dev, drv, index);
345
346 WRITE_ONCE(dev->next_hrtimer, 0);
347 return ret;
334}
335
336/**
337 * cpuidle_reflect - tell the underlying governor what was the state
338 * we were in
339 *
340 * @dev : the cpuidle device
341 * @index: the index in the idle state table

--- 164 unchanged lines hidden (view full) ---

506
507 dev->registered = 0;
508}
509
510static void __cpuidle_device_init(struct cpuidle_device *dev)
511{
512 memset(dev->states_usage, 0, sizeof(dev->states_usage));
513 dev->last_residency = 0;
348}
349
350/**
351 * cpuidle_reflect - tell the underlying governor what was the state
352 * we were in
353 *
354 * @dev : the cpuidle device
355 * @index: the index in the idle state table

--- 164 unchanged lines hidden (view full) ---

520
521 dev->registered = 0;
522}
523
524static void __cpuidle_device_init(struct cpuidle_device *dev)
525{
526 memset(dev->states_usage, 0, sizeof(dev->states_usage));
527 dev->last_residency = 0;
528 dev->next_hrtimer = 0;
514}
515
516/**
517 * __cpuidle_register_device - internal register function called before register
518 * and enable routines
519 * @dev: the cpu
520 *
521 * cpuidle_lock mutex must be held before this is called

--- 214 unchanged lines hidden ---
529}
530
531/**
532 * __cpuidle_register_device - internal register function called before register
533 * and enable routines
534 * @dev: the cpu
535 *
536 * cpuidle_lock mutex must be held before this is called

--- 214 unchanged lines hidden ---