Skip to content

Commit

Permalink
cpufreq: Acquire the lock in cpufreq_policy_restore() for reading
Browse files Browse the repository at this point in the history
In cpufreq_policy_restore() before system suspend policy is read from
percpu's cpufreq_cpu_data_fallback.  It's a read operation rather
than a write one, so take the lock for reading in there.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lan Tianyu authored and Rafael J. Wysocki committed Sep 11, 2013
1 parent cb38ed5 commit 44871c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,11 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
struct cpufreq_policy *policy;
unsigned long flags;

write_lock_irqsave(&cpufreq_driver_lock, flags);
read_lock_irqsave(&cpufreq_driver_lock, flags);

policy = per_cpu(cpufreq_cpu_data_fallback, cpu);

write_unlock_irqrestore(&cpufreq_driver_lock, flags);
read_unlock_irqrestore(&cpufreq_driver_lock, flags);

return policy;
}
Expand Down

0 comments on commit 44871c9

Please sign in to comment.