diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-30 18:13:47 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-30 18:13:47 -0400 |
| commit | 52c324f8a87b336496d0f5e9d8dff1aa32bb08cd (patch) | |
| tree | 5d359e67396365456f73496344e57bd2976d1c8c /drivers/cpuidle | |
| parent | d1db0eea852497762cab43b905b879dfcd3b8987 (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>
Diffstat (limited to 'drivers/cpuidle')
| -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 8236746e46bb..f38359f64cc6 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -65,26 +65,6 @@ int cpuidle_play_dead(void) | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * cpuidle_enabled - check if the cpuidle framework is ready | ||
| 69 | * @dev: cpuidle device for this cpu | ||
| 70 | * @drv: cpuidle driver for this cpu | ||
| 71 | * | ||
| 72 | * Return 0 on success, otherwise: | ||
| 73 | * -NODEV : the cpuidle framework is not available | ||
| 74 | * -EBUSY : the cpuidle framework is not initialized | ||
| 75 | */ | ||
| 76 | int cpuidle_enabled(struct cpuidle_driver *drv, struct cpuidle_device *dev) | ||
| 77 | { | ||
| 78 | if (off || !initialized) | ||
| 79 | return -ENODEV; | ||
| 80 | |||
| 81 | if (!drv || !dev || !dev->enabled) | ||
| 82 | return -EBUSY; | ||
| 83 | |||
| 84 | return 0; | ||
| 85 | } | ||
| 86 | |||
| 87 | /** | ||
| 88 | * cpuidle_enter_state - enter the state and update stats | 68 | * cpuidle_enter_state - enter the state and update stats |
| 89 | * @dev: cpuidle device for this cpu | 69 | * @dev: cpuidle device for this cpu |
| 90 | * @drv: cpuidle driver for this cpu | 70 | * @drv: cpuidle driver for this cpu |
| @@ -138,6 +118,12 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 138 | */ | 118 | */ |
| 139 | int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | 119 | int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) |
| 140 | { | 120 | { |
| 121 | if (off || !initialized) | ||
| 122 | return -ENODEV; | ||
| 123 | |||
| 124 | if (!drv || !dev || !dev->enabled) | ||
| 125 | return -EBUSY; | ||
| 126 | |||
| 141 | return cpuidle_curr_governor->select(drv, dev); | 127 | return cpuidle_curr_governor->select(drv, dev); |
| 142 | } | 128 | } |
| 143 | 129 | ||
