diff options
author | Afzal Mohammed <afzal@ti.com> | 2012-01-04 10:52:31 +0530 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2012-01-06 10:10:53 -0500 |
commit | 226dd0193f9b8524789a86505ba05b1a74d916c1 (patch) | |
tree | 3a3024b8b507defa98f5f704618327a4dcfbc6e4 /drivers/cpufreq | |
parent | 21f2e3c86b3746aaa462f9a2734363f4f41a641c (diff) | |
download | kernel-common-226dd0193f9b8524789a86505ba05b1a74d916c1.tar.gz kernel-common-226dd0193f9b8524789a86505ba05b1a74d916c1.tar.bz2 kernel-common-226dd0193f9b8524789a86505ba05b1a74d916c1.zip |
[CPUFREQ] cpufreq:userspace: fix cpu_cur_freq updation
CPU frequency is guranteed to be changed on notifier callback with
CPUFREQ_POSTCHANGE. Notifier callback with CPUFREQ_PRECHANGE does
not gurantee a change in frequency; after it, if cpufreq driver is
unable to change CPU to new frequency. This results in wrong
information being fed to user (if setting CPU frequency fails)
upon doing like,
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
Hence in userspace governer update cpu_cur_freq only if notifier
has been called with POSTCHANGE.
Signed-off-by: Afzal Mohammed <afzal@ti.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq_userspace.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index f231015904c0..bedac1aa9be3 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c @@ -47,9 +47,11 @@ userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val, if (!per_cpu(cpu_is_managed, freq->cpu)) return 0; - pr_debug("saving cpu_cur_freq of cpu %u to be %u kHz\n", - freq->cpu, freq->new); - per_cpu(cpu_cur_freq, freq->cpu) = freq->new; + if (val == CPUFREQ_POSTCHANGE) { + pr_debug("saving cpu_cur_freq of cpu %u to be %u kHz\n", + freq->cpu, freq->new); + per_cpu(cpu_cur_freq, freq->cpu) = freq->new; + } return 0; } |