From 0db4a8a99f6a8534c526e8c9d4b13d098400d485 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Wed, 5 Mar 2008 14:20:57 -0500 Subject: [PATCH 1/4] [CPUFREQ] Fix missing cpufreq_cpu_put() call in ->show refactor to use gotos instead of explicit exit paths Signed-off-by: Dave Jones --- drivers/cpufreq/cpufreq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 89a29cd93783..6602e1d02de2 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -671,13 +671,13 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) { struct cpufreq_policy * policy = to_policy(kobj); struct freq_attr * fattr = to_attr(attr); - ssize_t ret; + ssize_t ret = -EINVAL; policy = cpufreq_cpu_get(policy->cpu); if (!policy) - return -EINVAL; + goto no_policy; if (lock_policy_rwsem_read(policy->cpu) < 0) - return -EINVAL; + goto fail; if (fattr->show) ret = fattr->show(policy, buf); @@ -685,8 +685,9 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) ret = -EIO; unlock_policy_rwsem_read(policy->cpu); - +fail: cpufreq_cpu_put(policy); +no_policy: return ret; } From a07530b44547a892dae59f4e0f141f4e6f5e2e40 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Wed, 5 Mar 2008 14:22:25 -0500 Subject: [PATCH 2/4] [CPUFREQ] Fix missing cpufreq_cpu_put() call in ->store refactor to use gotos instead of explicit exit paths Signed-off-by: Dave Jones --- drivers/cpufreq/cpufreq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6602e1d02de2..5a639b173d54 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -696,13 +696,13 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, { struct cpufreq_policy * policy = to_policy(kobj); struct freq_attr * fattr = to_attr(attr); - ssize_t ret; + ssize_t ret = -EINVAL; policy = cpufreq_cpu_get(policy->cpu); if (!policy) - return -EINVAL; + goto no_policy; if (lock_policy_rwsem_write(policy->cpu) < 0) - return -EINVAL; + goto fail; if (fattr->store) ret = fattr->store(policy, buf, count); @@ -710,8 +710,9 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, ret = -EIO; unlock_policy_rwsem_write(policy->cpu); - +fail: cpufreq_cpu_put(policy); +no_policy: return ret; } From 0e5aa8d6218f9914b23e492debf653bda5598af3 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Fri, 15 Feb 2008 18:11:14 -0500 Subject: [PATCH 3/4] [CPUFREQ] Remove debugging message from e_powersaver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need to printk a message every time we transition. Leave the code there, but ifdef'd out, as it's useful when adding support for new processors. Reported-by: Petr Titěra Signed-off-by: Dave Jones --- arch/x86/kernel/cpu/cpufreq/e_powersaver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c index 39f8cb18296c..c2f930d86640 100644 --- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c +++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c @@ -55,7 +55,6 @@ static int eps_set_state(struct eps_cpu_data *centaur, { struct cpufreq_freqs freqs; u32 lo, hi; - u8 current_multiplier, current_voltage; int err = 0; int i; @@ -95,6 +94,10 @@ postchange: rdmsr(MSR_IA32_PERF_STATUS, lo, hi); freqs.new = centaur->fsb * ((lo >> 8) & 0xff); +#ifdef DEBUG + { + u8 current_multiplier, current_voltage; + /* Print voltage and multiplier */ rdmsr(MSR_IA32_PERF_STATUS, lo, hi); current_voltage = lo & 0xff; @@ -103,7 +106,8 @@ postchange: current_multiplier = (lo >> 8) & 0xff; printk(KERN_INFO "eps: Current multiplier = %d\n", current_multiplier); - + } +#endif cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); return err; } From f6ebef30e21638417f8f5443ba393d63a0c27e2b Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 17 Feb 2008 13:22:52 +0100 Subject: [PATCH 4/4] [CPUFREQ] fix section mismatch warnings Fix the following warnings: WARNING: vmlinux.o(.text+0xfe6711): Section mismatch in reference from the function cpufreq_unregister_driver() to the variable .cpuinit.data:cpufreq_cpu_notifier WARNING: vmlinux.o(.text+0xfe68af): Section mismatch in reference from the function cpufreq_register_driver() to the variable .cpuinit.data:cpufreq_cpu_notifier WARNING: vmlinux.o(.exit.text+0xc4fa): Section mismatch in reference from the function cpufreq_stats_exit() to the variable .cpuinit.data:cpufreq_stat_cpu_notifier The warnings were casued by references to unregister_hotcpu_notifier() from normal functions or exit functions. This is flagged by modpost as a potential error because it does not know that for the non HOTPLUG_CPU scenario the unregister_hotcpu_notifier() is a nop. Silence the warning by replacing the __initdata annotation with a __refdata annotation. Signed-off-by: Sam Ravnborg Signed-off-by: Dave Jones --- drivers/cpufreq/cpufreq.c | 2 +- drivers/cpufreq/cpufreq_stats.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 5a639b173d54..35a26a3e5f68 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1777,7 +1777,7 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } -static struct notifier_block __cpuinitdata cpufreq_cpu_notifier = +static struct notifier_block __refdata cpufreq_cpu_notifier = { .notifier_call = cpufreq_cpu_callback, }; diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 1b8312b02006..070421a5480e 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -323,7 +323,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } -static struct notifier_block cpufreq_stat_cpu_notifier __cpuinitdata = +static struct notifier_block cpufreq_stat_cpu_notifier __refdata = { .notifier_call = cpufreq_stat_cpu_callback, };