>From 5c635b3530d4f9b41811f7dde12e0d6f5f7dcc54 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Sat, 12 Jan 2013 15:30:43 +0100 Subject: [PATCH 2/2] cpuidle: Initialize power_usage for all C-states By now, only the power_usage values of currently available C-states are initialized in the function set_power_states(). But if the number of C-states increases later (e.g. when using acpi_idle and unplugging the AC power from the laptop) the power_usage values of the new C-states stay uninitialized. Fix this by initializing all CPUIDLE_STATE_MAX C-stages in the first place. Signed-off-by: Thomas Schlichter --- drivers/cpuidle/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index c2b281a..960d98d 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -37,7 +37,7 @@ static void set_power_states(struct cpuidle_driver *drv) * an power value of -1. So we use -2, -3, etc, for other * c-states. */ - for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) + for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) drv->states[i].power_usage = -1 - i; } -- 1.7.10.4