diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-01 00:13:47 +0200 |
---|---|---|
committer | Robin Randhawa <robin.randhawa@arm.com> | 2015-04-09 12:26:03 +0100 |
commit | 40e75876cab58e2089832d7eb80864e821bc33be (patch) | |
tree | 6e38cd5a1b43d1bb76ccb85dc21fba2889f16893 /drivers | |
parent | 72a1417c0d17069cc7a48e30129beb3a041f25c8 (diff) |
cpuidle: Combine cpuidle_enabled() with cpuidle_select()
Since both cpuidle_enabled() and cpuidle_select() are only called by
cpuidle_idle_call(), it is not really useful to keep them separate
and combining them will help to avoid complicating cpuidle_idle_call()
even further if governors are changed to return error codes sometimes.
This code modification shouldn't lead to any functional changes.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 52c324f8a87b336496d0f5e9d8dff1aa32bb08cd)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 166a7322a2b6..31e63f38932b 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -65,26 +65,6 @@ int cpuidle_play_dead(void) } /** - * cpuidle_enabled - check if the cpuidle framework is ready - * @dev: cpuidle device for this cpu - * @drv: cpuidle driver for this cpu - * - * Return 0 on success, otherwise: - * -NODEV : the cpuidle framework is not available - * -EBUSY : the cpuidle framework is not initialized - */ -int cpuidle_enabled(struct cpuidle_driver *drv, struct cpuidle_device *dev) -{ - if (off || !initialized) - return -ENODEV; - - if (!drv || !dev || !dev->enabled) - return -EBUSY; - - return 0; -} - -/** * cpuidle_enter_state - enter the state and update stats * @dev: cpuidle device for this cpu * @drv: cpuidle driver for this cpu @@ -137,6 +117,12 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, */ int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) { + if (off || !initialized) + return -ENODEV; + + if (!drv || !dev || !dev->enabled) + return -EBUSY; + return cpuidle_curr_governor->select(drv, dev); } |