From cbc0753ecc3a4f80105e99e5698da0b3363866ea Mon Sep 17 00:00:00 2001 From: Eugene Seah Date: Wed, 11 Apr 2012 19:32:27 -0600 Subject: [PATCH] thermal: Don't limit CPU frequency after msm_thermal is disabled There may be an outstanding task to check for threshold crossing when msm_thermal is disabled and CPU is restored to maximum frequency. This task can get scheduled after the maximum frequency is restored, and result in another mitigation that pins CPU frequencies to 918mHz. This happens in the case that the final temperature was still above the max temperature threshold. This patch ensures any outstanding tasks are cancelled and flushed before finally restoring the CPU frequencies. CRs-fixed: 351614 Change-Id: Ifce00b379989b78856803ac09c7403207f5c998b Signed-off-by: Eugene Seah --- drivers/thermal/msm_thermal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c index c6ba24e56a7..e0d8d145ec6 100644 --- a/drivers/thermal/msm_thermal.c +++ b/drivers/thermal/msm_thermal.c @@ -117,6 +117,10 @@ static void disable_msm_thermal(void) int cpu = 0; struct cpufreq_policy *cpu_policy = NULL; + /* make sure check_temp is no longer running */ + cancel_delayed_work(&check_temp_work); + flush_scheduled_work(); + for_each_possible_cpu(cpu) { cpu_policy = cpufreq_cpu_get(cpu); if (cpu_policy) {