Commit 0a9a94ed authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Luis Henriques

cpuidle: remove state_count field from struct cpuidle_device

commit d75e4af1 upstream.

Thomas Schlichter reports the following issue on his Samsung NC20:

"The C-states C1 and C2 to the OS when connected to AC, and additionally
 provides the C3 C-state when disconnected from AC.  However, the number
 of C-states shown in sysfs is fixed to the number of C-states present
 at boot.
   If I boot with AC connected, I always only see the C-states up to C2
   even if I disconnect AC.

   The reason is commit 130a5f69 (ACPI / cpuidle: remove dev->state_count
   setting).  It removes the update of dev->state_count, but sysfs uses
   exactly this variable to show the C-states.

   The fix is to use drv->state_count in sysfs.  As this is currently the
   last user of dev->state_count, this variable can be completely removed."

Remove dev->state_count as per the above.
Reported-by: default avatarThomas Schlichter <thomas.schlichter@web.de>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
[ rjw: Changelog ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent e5fa3f26
...@@ -289,9 +289,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev) ...@@ -289,9 +289,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
if (!dev->registered) if (!dev->registered)
return -EINVAL; return -EINVAL;
if (!dev->state_count)
dev->state_count = drv->state_count;
ret = cpuidle_add_device_sysfs(dev); ret = cpuidle_add_device_sysfs(dev);
if (ret) if (ret)
return ret; return ret;
......
...@@ -401,7 +401,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) ...@@ -401,7 +401,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device); struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
/* state statistics */ /* state statistics */
for (i = 0; i < device->state_count; i++) { for (i = 0; i < drv->state_count; i++) {
kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL); kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);
if (!kobj) if (!kobj)
goto error_state; goto error_state;
...@@ -433,9 +433,10 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) ...@@ -433,9 +433,10 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
*/ */
static void cpuidle_remove_state_sysfs(struct cpuidle_device *device) static void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
{ {
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
int i; int i;
for (i = 0; i < device->state_count; i++) for (i = 0; i < drv->state_count; i++)
cpuidle_free_state_kobj(device, i); cpuidle_free_state_kobj(device, i);
} }
......
...@@ -69,7 +69,6 @@ struct cpuidle_device { ...@@ -69,7 +69,6 @@ struct cpuidle_device {
unsigned int cpu; unsigned int cpu;
int last_residency; int last_residency;
int state_count;
struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
struct cpuidle_driver_kobj *kobj_driver; struct cpuidle_driver_kobj *kobj_driver;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment