diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2012-04-24 10:05:36 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2012-05-03 16:19:31 -0400 |
commit | e92a45868150c7c79cd1cf2fa26ef42597623a8c (patch) | |
tree | d1a4b8b7fd427dac9c666385f061888cdf0d3796 /arch/arm/mach-omap2/cpuidle34xx.c | |
parent | 6622ac55a6a15670a04b5790e7ee2778a6f8c4e0 (diff) |
ARM: OMAP3: cpuidle - simplify next_valid_state
Simplify the indentation by removing the useless 'else' statement.
Remove the first loop for the 'idx' search as we have it already
with the 'index' passed as parameter.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Jean Pihet <j-pihet@ti.com>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/cpuidle34xx.c')
-rw-r--r-- | arch/arm/mach-omap2/cpuidle34xx.c | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 242f77d57965..e7599e760aef 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
@@ -172,13 +172,12 @@ static inline int omap3_enter_idle(struct cpuidle_device *dev, | |||
172 | * if it satisfies the enable_off_mode condition. | 172 | * if it satisfies the enable_off_mode condition. |
173 | */ | 173 | */ |
174 | static int next_valid_state(struct cpuidle_device *dev, | 174 | static int next_valid_state(struct cpuidle_device *dev, |
175 | struct cpuidle_driver *drv, | 175 | struct cpuidle_driver *drv, int index) |
176 | int index) | ||
177 | { | 176 | { |
178 | struct cpuidle_state *curr = &drv->states[index]; | ||
179 | struct omap3_idle_statedata *cx = &omap3_idle_data[index]; | 177 | struct omap3_idle_statedata *cx = &omap3_idle_data[index]; |
180 | u32 mpu_deepest_state = PWRDM_POWER_RET; | 178 | u32 mpu_deepest_state = PWRDM_POWER_RET; |
181 | u32 core_deepest_state = PWRDM_POWER_RET; | 179 | u32 core_deepest_state = PWRDM_POWER_RET; |
180 | int idx; | ||
182 | int next_index = -1; | 181 | int next_index = -1; |
183 | 182 | ||
184 | if (enable_off_mode) { | 183 | if (enable_off_mode) { |
@@ -194,42 +193,28 @@ static int next_valid_state(struct cpuidle_device *dev, | |||
194 | 193 | ||
195 | /* Check if current state is valid */ | 194 | /* Check if current state is valid */ |
196 | if ((cx->mpu_state >= mpu_deepest_state) && | 195 | if ((cx->mpu_state >= mpu_deepest_state) && |
197 | (cx->core_state >= core_deepest_state)) { | 196 | (cx->core_state >= core_deepest_state)) |
198 | return index; | 197 | return index; |
199 | } else { | ||
200 | int idx = ARRAY_SIZE(omap3_idle_data) - 1; | ||
201 | |||
202 | /* Reach the current state starting at highest C-state */ | ||
203 | for (; idx >= 0; idx--) { | ||
204 | if (&drv->states[idx] == curr) { | ||
205 | next_index = idx; | ||
206 | break; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | /* Should never hit this condition */ | ||
211 | WARN_ON(next_index == -1); | ||
212 | 198 | ||
213 | /* | 199 | /* |
214 | * Drop to next valid state. | 200 | * Drop to next valid state. |
215 | * Start search from the next (lower) state. | 201 | * Start search from the next (lower) state. |
216 | */ | 202 | */ |
217 | idx--; | 203 | for (idx = index - 1; idx >= 0; idx--) { |
218 | for (; idx >= 0; idx--) { | 204 | cx = &omap3_idle_data[idx]; |
219 | cx = &omap3_idle_data[idx]; | 205 | if ((cx->mpu_state >= mpu_deepest_state) && |
220 | if ((cx->mpu_state >= mpu_deepest_state) && | 206 | (cx->core_state >= core_deepest_state)) { |
221 | (cx->core_state >= core_deepest_state)) { | 207 | next_index = idx; |
222 | next_index = idx; | 208 | break; |
223 | break; | ||
224 | } | ||
225 | } | 209 | } |
226 | /* | ||
227 | * C1 is always valid. | ||
228 | * So, no need to check for 'next_index == -1' outside | ||
229 | * this loop. | ||
230 | */ | ||
231 | } | 210 | } |
232 | 211 | ||
212 | /* | ||
213 | * C1 is always valid. | ||
214 | * So, no need to check for 'next_index == -1' outside | ||
215 | * this loop. | ||
216 | */ | ||
217 | |||
233 | return next_index; | 218 | return next_index; |
234 | } | 219 | } |
235 | 220 | ||