Skip to content

Commit

Permalink
ARM: EXYNOS: cpuidle: fix AFTR mode check
Browse files Browse the repository at this point in the history
The EXYNOS cpuidle driver code assumes that cpuidle core will handle
dev->state_count smaller than drv->state_count but currently this is
untrue (dev->state_count is used only for handling cpuidle state sysfs
entries and drv->state_count is used for all other cases) and will not
be fixed in the future as dev->state_count is planned to be removed.

Fix the issue by checking for the max supported idle state in AFTR
state's ->enter handler (exynos4_enter_lowpower()) and entering AFTR
mode only when cores other than CPU0 are offline.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Bartlomiej Zolnierkiewicz authored and Rafael J. Wysocki committed Jan 11, 2014
1 parent 8839099 commit 118f5c1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions arch/arm/mach-exynos/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
{
int new_index = index;

/* This mode only can be entered when other core's are offline */
if (num_online_cpus() > 1)
/* AFTR can only be entered when cores other than CPU0 are offline */
if (num_online_cpus() > 1 || dev->cpu != 0)
new_index = drv->safe_state_index;

if (new_index == 0)
Expand Down Expand Up @@ -214,10 +214,6 @@ static int exynos_cpuidle_probe(struct platform_device *pdev)
device = &per_cpu(exynos4_cpuidle_device, cpu_id);
device->cpu = cpu_id;

/* Support IDLE only */
if (cpu_id != 0)
device->state_count = 1;

ret = cpuidle_register_device(device);
if (ret) {
dev_err(&pdev->dev, "failed to register cpuidle device\n");
Expand Down

0 comments on commit 118f5c1

Please sign in to comment.