linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi processor: simplify needlessly complex printk
@ 2009-06-28 20:03 Frans Pop
  2009-06-28 22:02 ` Justin P. Mattock
  0 siblings, 1 reply; 4+ messages in thread
From: Frans Pop @ 2009-06-28 20:03 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel, Len Brown

Why use three printk statements if one will do?

Signed-off-by: Frans Pop <elendil@planet.nl>

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 84e0f3c..b8fb74a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -772,12 +772,11 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 	if (result)
 		printk(KERN_ERR PREFIX "Create sysfs link\n");
 
-	if (pr->flags.throttling) {
-		printk(KERN_INFO PREFIX "%s [%s] (supports",
-		       acpi_device_name(device), acpi_device_bid(device));
-		printk(" %d throttling states", pr->throttling.state_count);
-		printk(")\n");
-	}
+	if (pr->flags.throttling)
+		printk(KERN_INFO PREFIX
+			"%s [%s] (supports %d throttling states)\n",
+			acpi_device_name(device), acpi_device_bid(device),
+			pr->throttling.state_count);
 
       end:
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] acpi processor: simplify needlessly complex printk
  2009-06-28 20:03 [PATCH] acpi processor: simplify needlessly complex printk Frans Pop
@ 2009-06-28 22:02 ` Justin P. Mattock
  2009-06-28 22:28   ` Frans Pop
  0 siblings, 1 reply; 4+ messages in thread
From: Justin P. Mattock @ 2009-06-28 22:02 UTC (permalink / raw)
  To: Frans Pop; +Cc: linux-acpi, linux-kernel, Len Brown

Frans Pop wrote:
> Why use three printk statements if one will do?
>
> Signed-off-by: Frans Pop<elendil@planet.nl>
>
> diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
> index 84e0f3c..b8fb74a 100644
> --- a/drivers/acpi/processor_core.c
> +++ b/drivers/acpi/processor_core.c
> @@ -772,12 +772,11 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
>   	if (result)
>   		printk(KERN_ERR PREFIX "Create sysfs link\n");
>
> -	if (pr->flags.throttling) {
> -		printk(KERN_INFO PREFIX "%s [%s] (supports",
> -		       acpi_device_name(device), acpi_device_bid(device));
> -		printk(" %d throttling states", pr->throttling.state_count);
> -		printk(")\n");
> -	}
> +	if (pr->flags.throttling)
> +		printk(KERN_INFO PREFIX
> +			"%s [%s] (supports %d throttling states)\n",
> +			acpi_device_name(device), acpi_device_bid(device),
> +			pr->throttling.state_count);
>
>         end:
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
>    
Would it be better to capitalize the S and add a period at the
end, or does it not matter?

Justin P. Mattock

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] acpi processor: simplify needlessly complex printk
  2009-06-28 22:02 ` Justin P. Mattock
@ 2009-06-28 22:28   ` Frans Pop
  2009-06-28 22:51     ` Justin P. Mattock
  0 siblings, 1 reply; 4+ messages in thread
From: Frans Pop @ 2009-06-28 22:28 UTC (permalink / raw)
  To: Justin P. Mattock; +Cc: linux-acpi, linux-kernel, Len Brown

On Monday 29 June 2009, Justin P. Mattock wrote:
> Would it be better to capitalize the S and add a period at the
> end, or does it not matter?

Kernel messages are in general not sentences.

I thought of removing the parenteses, but if you look at the context of 
the message then that only makes sense if other messages are modified at 
the same time. The messages below appear together for my system and their 
consistency could definitely be improved, but IMO that's better done in a 
separate patch.

ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])
processor LNXCPU:00: registered as cooling_device7
ACPI: Processor [CPU0] (supports 8 throttling states)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] acpi processor: simplify needlessly complex printk
  2009-06-28 22:28   ` Frans Pop
@ 2009-06-28 22:51     ` Justin P. Mattock
  0 siblings, 0 replies; 4+ messages in thread
From: Justin P. Mattock @ 2009-06-28 22:51 UTC (permalink / raw)
  To: Frans Pop; +Cc: linux-acpi, linux-kernel, Len Brown

Frans Pop wrote:
> On Monday 29 June 2009, Justin P. Mattock wrote:
>    
>> Would it be better to capitalize the S and add a period at the
>> end, or does it not matter?
>>      
>
> Kernel messages are in general not sentences.
>
> I thought of removing the parenteses, but if you look at the context of
> the message then that only makes sense if other messages are modified at
> the same time. The messages below appear together for my system and their
> consistency could definitely be improved, but IMO that's better done in a
> separate patch.
>
> ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])
> processor LNXCPU:00: registered as cooling_device7
> ACPI: Processor [CPU0] (supports 8 throttling states)
>
>    
Cool, thanks for the info.
I found Documentation/CodingStyle
Chapter 13: Printing kernel messages
Kernel messages do not have to be terminated with a period.
(Sh^t I was going to submit some patches that made proper
some messages, and comments)
I guess I have to learn to change code, instead of messages!

Justin P. Mattock

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-28 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-28 20:03 [PATCH] acpi processor: simplify needlessly complex printk Frans Pop
2009-06-28 22:02 ` Justin P. Mattock
2009-06-28 22:28   ` Frans Pop
2009-06-28 22:51     ` Justin P. Mattock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).