[PATCH] cpufreq: change print_once to printk_once

From: H Hartley Sweeten
Date: Wed May 20 2009 - 14:10:08 EST


Replace the print_once code blocks with the printk_once macro.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>

---

diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 4709ead..1ac90c8 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1221,7 +1221,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
struct powernow_k8_data *data;
cpumask_t oldmask;
int rc;
- static int print_once;

if (!cpu_online(pol->cpu))
return -ENODEV;
@@ -1244,19 +1243,12 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
* an UP version, and is deprecated by AMD.
*/
if (num_online_cpus() != 1) {
- /*
- * Replace this one with print_once as soon as such a
- * thing gets introduced
- */
- if (!print_once) {
- WARN_ONCE(1, KERN_ERR FW_BUG PFX "Your BIOS "
+ printk_once(KERN_ERR FW_BUG PFX "Your BIOS "
"does not provide ACPI _PSS objects "
"in a way that Linux understands. "
"Please report this to the Linux ACPI"
" maintainers and complain to your "
"BIOS vendor.\n");
- print_once++;
- }
goto err_out;
}
if (pol->cpu != 0) {
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 2ecd95e..909a2ef 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -179,26 +179,18 @@ static struct notifier_block dbs_cpufreq_notifier_block = {
/************************** sysfs interface ************************/
static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
{
- static int print_once;
-
- if (!print_once) {
- printk(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
+ printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
"sysfs file is deprecated - used by: %s\n",
current->comm);
- print_once = 1;
- }
+
return sprintf(buf, "%u\n", MAX_SAMPLING_RATE);
}

static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
{
- static int print_once;
-
- if (!print_once) {
- printk(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
+ printk_once(KERN_INFO "CPUFREQ: conservative sampling_rate_max "
"sysfs file is deprecated - used by: %s\n", current->comm);
- print_once = 1;
- }
+
return sprintf(buf, "%u\n", MIN_SAMPLING_RATE);
}

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 338f428..3430cdd 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -216,27 +216,19 @@ static void ondemand_powersave_bias_init(void)
/************************** sysfs interface ************************/
static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
{
- static int print_once;
-
- if (!print_once) {
- printk(KERN_INFO "CPUFREQ: ondemand sampling_rate_max "
+ printk_once(KERN_INFO "CPUFREQ: ondemand sampling_rate_max "
"sysfs file is deprecated - used by: %s\n",
current->comm);
- print_once = 1;
- }
+
return sprintf(buf, "%u\n", MAX_SAMPLING_RATE);
}

static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
{
- static int print_once;
-
- if (!print_once) {
- printk(KERN_INFO "CPUFREQ: ondemand sampling_rate_min "
+ printk_once(KERN_INFO "CPUFREQ: ondemand sampling_rate_min "
"sysfs file is deprecated - used by: %s\n",
current->comm);
- print_once = 1;
- }
+
return sprintf(buf, "%u\n", MIN_SAMPLING_RATE);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/