Skip to contentSkip to conversation

single-line, but KERN_WARNING message in p4-clockmod

PATCH In review Dominik Brodowski 3 participants 5 messages Feb 14, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 single-line, but KERN_WARNING message in p4-clockmod

As Pavel Machek told me, a single line warning is better, and KERN_DEBUG might be missed if reading from /var/log/messages.

 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +2 -6
diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c linux/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -181,9 +181,7 @@
 {
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
 		/* Pentium M */
-		printk(KERN_DEBUG PFX "Warning: Pentium M detected. The speedstep_centrino module\n");
-		printk(KERN_DEBUG PFX "offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use that instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. The speedstep_centrino module offers voltage scaling in addition of frequency scaling. You should use that instead of p4-clockmod, if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
 	}
 
@@ -193,9 +191,7 @@
 	}
 
 	if (speedstep_detect_processor() == SPEEDSTEP_PROCESSOR_P4M) {
-		printk(KERN_DEBUG PFX "Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq \n");
-		printk(KERN_DEBUG PFX "modules offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use either one instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq modules offers voltage scaling in addition of frequency scaling. You should use either one instead of p4-clockmod, if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_P4M);
 	}
#1 lore raw
Quoted 21 lines · Dominik Brodowski

As Pavel Machek told me, a single line warning is better, and KERN_DEBUG might be missed if reading from /var/log/messages.

 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c linux/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c

arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +1 -3
@@ -181,9 +181,7 @@
 {
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
 		/* Pentium M */
-		printk(KERN_DEBUG PFX "Warning: Pentium M detected. The speedstep_centrino module\n");
-		printk(KERN_DEBUG PFX "offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use that instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. The speedstep_centrino module offers voltage scaling in addition of frequency scaling. You should use that instead of p4-clockmod, if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
 	}
 

arch/i386/kernel/cpu/cpufreq/p4-clockmod.c line 196

Quoted 9 lines
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +1 -3
@@ -193,9 +191,7 @@
 	}
 
 	if (speedstep_detect_processor() == SPEEDSTEP_PROCESSOR_P4M) {
-		printk(KERN_DEBUG PFX "Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq \n");
-		printk(KERN_DEBUG PFX "modules offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use either one instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq modules offers voltage scaling in addition of frequency scaling. You should use either one instead of p4-clockmod, if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_P4M);
 	}

I'd rather keep them multi-line in the source. It looks a lot more readable than just one line IMHO. I've no objection to killing off the \n's though.

Dave

#2 lore raw
Quoted 2 lines · Dave Jones

I'd rather keep them multi-line in the source. It looks a lot more readable than just one line IMHO. I've no objection to killing off the \n's though.

As Pavel Machek told me, a single line warning is better, and KERN_DEBUG might be missed if reading from /var/log/messages. As Dave Jones told me, multi-line printk's are more readable, though.

 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

Dominik

arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +10 -7
diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c linux/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -181,21 +181,24 @@
 {
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
 		/* Pentium M */
-		printk(KERN_DEBUG PFX "Warning: Pentium M detected. The speedstep_centrino module\n");
-		printk(KERN_DEBUG PFX "offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use that instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. ");
+		printk("The speedstep_centrino module offers voltage scaling");
+		printk(" in addition of frequency scaling. You should use ");
+		printk("that instead of p4-clockmod, if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
 	}
 
 	if (c->x86 != 0xF) {
-		printk(KERN_DEBUG PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <[email protected]>\n");
+		printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <[email protected]>\n");
 		return 0;
 	}
 
 	if (speedstep_detect_processor() == SPEEDSTEP_PROCESSOR_P4M) {
-		printk(KERN_DEBUG PFX "Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq \n");
-		printk(KERN_DEBUG PFX "modules offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use either one instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. ");
+		printk("The speedstep-ich or acpi cpufreq modules offers ");
+		printk("voltage scaling in addition of frequency scaling. ");
+		printk("You should use either one instead of p4-clockmod, ");
+		printk("if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_P4M);
 	}
#3 lore raw

arch/i386/kernel/cpu/cpufreq/p4-clockmod.c line 187

Quoted 9 lines · Dominik Brodowski
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +4 -3
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
 		/* Pentium M */
-		printk(KERN_DEBUG PFX "Warning: Pentium M detected. The speedstep_centrino module\n");
-		printk(KERN_DEBUG PFX "offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use that instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. ");
+		printk("The speedstep_centrino module offers voltage scaling");
+		printk(" in addition of frequency scaling. You should use ");
+		printk("that instead of p4-clockmod, if possible.\n");

I think that's a lot worse for one major reason - you loose the atomicity of printk() if you do that, especially if you use serial console.

I haven't seen this done anywhere else in the kernel... lets not start doing it now.

printk(KERN_WARNING PFX "Warning: Pentium M detected. "
"The speedstep_centrino module offers voltage scaling " "in addition of frequency scaling. You should use " "that instead of p4-clockmod, if possible.\n");

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#4 lore raw
Quoted 14 lines · Russell King

Review

Quoted 9 lines · Dominik Brodowski
(quoted diff) +4 -3
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
 		/* Pentium M */
-		printk(KERN_DEBUG PFX "Warning: Pentium M detected. The speedstep_centrino module\n");
-		printk(KERN_DEBUG PFX "offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use that instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. ");
+		printk("The speedstep_centrino module offers voltage scaling");
+		printk(" in addition of frequency scaling. You should use ");
+		printk("that instead of p4-clockmod, if possible.\n");

I think that's a lot worse for one major reason - you loose the atomicity of printk() if you do that, especially if you use serial console.

Quoted 7 lines

I haven't seen this done anywhere else in the kernel... lets not start doing it now.

printk(KERN_WARNING PFX "Warning: Pentium M detected. "
"The speedstep_centrino module offers voltage scaling " "in addition of frequency scaling. You should use " "that instead of p4-clockmod, if possible.\n");

Thanks,
Dominik

Use KERN_WARNING for warning. Thanks to Dave Jones, Pavel Machel and Russell King for their help getting this patch right.

 arch/i386/kernel/cpu/cpufreq/p4-clockmod.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +10 -7
diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c linux/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -181,21 +181,24 @@
 {
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
 		/* Pentium M */
-		printk(KERN_DEBUG PFX "Warning: Pentium M detected. The speedstep_centrino module\n");
-		printk(KERN_DEBUG PFX "offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use that instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. "
+		       "The speedstep_centrino module offers voltage scaling"
+		       " in addition of frequency scaling. You should use "
+		       "that instead of p4-clockmod, if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
 	}
 
 	if (c->x86 != 0xF) {
-		printk(KERN_DEBUG PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <[email protected]>\n");
+		printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <[email protected]>\n");
 		return 0;
 	}
 
 	if (speedstep_detect_processor() == SPEEDSTEP_PROCESSOR_P4M) {
-		printk(KERN_DEBUG PFX "Warning: Pentium 4-M detected. The speedstep-ich or acpi cpufreq \n");
-		printk(KERN_DEBUG PFX "modules offers voltage scaling in addition of frequency scaling. You\n");
-		printk(KERN_DEBUG PFX "should use either one instead of p4-clockmod, if possible.\n");
+		printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. "
+		       "The speedstep-ich or acpi cpufreq modules offers "
+		       "voltage scaling in addition of frequency scaling. "
+		       "You should use either one instead of p4-clockmod, "
+		       "if possible.\n");
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_P4M);
 	}