Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e92a4586 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Kevin Hilman
Browse files

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: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: default avatarJean Pihet <j-pihet@ti.com>
Reviewed-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: default avatarKevin Hilman <khilman@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent 6622ac55
Loading
Loading
Loading
Loading
+19 −34
Original line number Diff line number Diff line
@@ -172,13 +172,12 @@ static inline int omap3_enter_idle(struct cpuidle_device *dev,
 * if it satisfies the enable_off_mode condition.
 */
static int next_valid_state(struct cpuidle_device *dev,
			struct cpuidle_driver *drv,
				int index)
			    struct cpuidle_driver *drv, int index)
{
	struct cpuidle_state *curr = &drv->states[index];
	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
	u32 mpu_deepest_state = PWRDM_POWER_RET;
	u32 core_deepest_state = PWRDM_POWER_RET;
	int idx;
	int next_index = -1;

	if (enable_off_mode) {
@@ -194,28 +193,14 @@ static int next_valid_state(struct cpuidle_device *dev,

	/* Check if current state is valid */
	if ((cx->mpu_state >= mpu_deepest_state) &&
	    (cx->core_state >= core_deepest_state)) {
	    (cx->core_state >= core_deepest_state))
		return index;
	} else {
		int idx = ARRAY_SIZE(omap3_idle_data) - 1;

		/* Reach the current state starting at highest C-state */
		for (; idx >= 0; idx--) {
			if (&drv->states[idx] == curr) {
				next_index = idx;
				break;
			}
		}

		/* Should never hit this condition */
		WARN_ON(next_index == -1);

	/*
	 * Drop to next valid state.
	 * Start search from the next (lower) state.
	 */
		idx--;
		for (; idx >= 0; idx--) {
	for (idx = index - 1; idx >= 0; idx--) {
		cx =  &omap3_idle_data[idx];
		if ((cx->mpu_state >= mpu_deepest_state) &&
		    (cx->core_state >= core_deepest_state)) {
@@ -223,12 +208,12 @@ static int next_valid_state(struct cpuidle_device *dev,
			break;
		}
	}

	/*
	 * C1 is always valid.
	 * So, no need to check for 'next_index == -1' outside
	 * this loop.
	 */
	}

	return next_index;
}