public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
@ 2008-08-02 19:24 Paolo Ciarrocchi
  2008-08-03  4:01 ` H. Peter Anvin
  2008-08-15 14:52 ` Ingo Molnar
  0 siblings, 2 replies; 8+ messages in thread
From: Paolo Ciarrocchi @ 2008-08-02 19:24 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: hpa, Linux Kernel, tglx

Before:
total: 5 errors, 0 warnings, 48 lines checked

After:
total: 0 errors, 0 warnings, 58 lines checked

paolo@paolo-desktop:~/linux.trees.git$ md5sum /tmp/bios_uv.o.*
9afe794594831166704744184e192ed8  /tmp/bios_uv.o.after
9afe794594831166704744184e192ed8  /tmp/bios_uv.o.before

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
---
 arch/x86/kernel/bios_uv.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
index c639bd5..100e759 100644
--- a/arch/x86/kernel/bios_uv.c
+++ b/arch/x86/kernel/bios_uv.c
@@ -25,11 +25,21 @@ x86_bios_strerror(long status)
 {
 	const char *str;
 	switch (status) {
-	case  0: str = "Call completed without error"; break;
-	case -1: str = "Not implemented"; break;
-	case -2: str = "Invalid argument"; break;
-	case -3: str = "Call completed with error"; break;
-	default: str = "Unknown BIOS status code"; break;
+	case  0:
+		str = "Call completed without error";
+		break;
+	case -1:
+		str = "Not implemented";
+		break;
+	case -2:
+		str = "Invalid argument";
+		break;
+	case -3:
+		str = "Call completed with error";
+		break;
+	default:
+		str = "Unknown BIOS status code";
+		break;
 	}
 	return str;
 }
-- 
1.5.6.rc1.21.g03300


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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-02 19:24 [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c Paolo Ciarrocchi
@ 2008-08-03  4:01 ` H. Peter Anvin
  2008-08-03 10:51   ` Stefan Richter
  2008-08-15 14:52 ` Ingo Molnar
  1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2008-08-03  4:01 UTC (permalink / raw)
  To: Paolo Ciarrocchi; +Cc: Ingo Molnar, Linux Kernel, tglx

Paolo Ciarrocchi wrote:
> 
> diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
> index c639bd5..100e759 100644
> --- a/arch/x86/kernel/bios_uv.c
> +++ b/arch/x86/kernel/bios_uv.c
> @@ -25,11 +25,21 @@ x86_bios_strerror(long status)
>  {
>  	const char *str;
>  	switch (status) {
> -	case  0: str = "Call completed without error"; break;
> -	case -1: str = "Not implemented"; break;
> -	case -2: str = "Invalid argument"; break;
> -	case -3: str = "Call completed with error"; break;
> -	default: str = "Unknown BIOS status code"; break;
> +	case  0:
> +		str = "Call completed without error";
> +		break;
> +	case -1:
> +		str = "Not implemented";
> +		break;
> +	case -2:
> +		str = "Invalid argument";
> +		break;
> +	case -3:
> +		str = "Call completed with error";
> +		break;
> +	default:
> +		str = "Unknown BIOS status code";
> +		break;
>  	}
>  	return str;
>  }

This should be an array in the first place...

	-hpa

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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-03  4:01 ` H. Peter Anvin
@ 2008-08-03 10:51   ` Stefan Richter
  2008-08-03 11:54     ` Krzysztof Halasa
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Richter @ 2008-08-03 10:51 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Paolo Ciarrocchi, Ingo Molnar, Linux Kernel, tglx

H. Peter Anvin wrote:
> Paolo Ciarrocchi wrote:
>>
>> diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
>> index c639bd5..100e759 100644
>> --- a/arch/x86/kernel/bios_uv.c
>> +++ b/arch/x86/kernel/bios_uv.c
>> @@ -25,11 +25,21 @@ x86_bios_strerror(long status)
>>  {
>>      const char *str;
>>      switch (status) {
>> -    case  0: str = "Call completed without error"; break;
>> -    case -1: str = "Not implemented"; break;
>> -    case -2: str = "Invalid argument"; break;
>> -    case -3: str = "Call completed with error"; break;
>> -    default: str = "Unknown BIOS status code"; break;
>> +    case  0:
>> +        str = "Call completed without error";
>> +        break;
>> +    case -1:
>> +        str = "Not implemented";
>> +        break;
>> +    case -2:
>> +        str = "Invalid argument";
>> +        break;
>> +    case -3:
>> +        str = "Call completed with error";
>> +        break;
>> +    default:
>> +        str = "Unknown BIOS status code";
>> +        break;
>>      }
>>      return str;
>>  }
> 
> This should be an array in the first place...

Besides, by following CodingStyle to the letter, it arguably breaks 
rather than fixes coding style.  The former code was easy enough to read.
-- 
Stefan Richter
-=====-==--- =--- ---==
http://arcgraph.de/sr/

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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-03 10:51   ` Stefan Richter
@ 2008-08-03 11:54     ` Krzysztof Halasa
  2008-08-03 12:21       ` Paolo Ciarrocchi
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Halasa @ 2008-08-03 11:54 UTC (permalink / raw)
  To: Stefan Richter
  Cc: H. Peter Anvin, Paolo Ciarrocchi, Ingo Molnar, Linux Kernel, tglx

Stefan Richter <stefanr@s5r6.in-berlin.de> writes:

>>>      const char *str;
>>>      switch (status) {
>>> -    case  0: str = "Call completed without error"; break;
>>> -    case -1: str = "Not implemented"; break;
>>> -    case -2: str = "Invalid argument"; break;
>>> -    case -3: str = "Call completed with error"; break;
>>> -    default: str = "Unknown BIOS status code"; break;
>>> +    case  0:
>>> +        str = "Call completed without error";
>>> +        break;
>>> +    case -1:
>>> +        str = "Not implemented";
>>> +        break;
>>> +    case -2:
>>> +        str = "Invalid argument";
>>> +        break;
>>> +    case -3:
>>> +        str = "Call completed with error";
>>> +        break;
>>> +    default:
>>> +        str = "Unknown BIOS status code";
>>> +        break;
>>>      }
>>>      return str;
>>>  }
>>
>> This should be an array in the first place...
>
> Besides, by following CodingStyle to the letter, it arguably breaks
> rather than fixes coding style.  The former code was easy enough to
> read.

Right. The latter is much worse. That's why nobody can trust
CodingStyle and/or checkpatch automatically. It's only sane mode
of operation is as a help tool for authors and maintainers, to
quickly locate _potential_ problems.
-- 
Krzysztof Halasa

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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-03 11:54     ` Krzysztof Halasa
@ 2008-08-03 12:21       ` Paolo Ciarrocchi
  2008-08-05  2:15         ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Ciarrocchi @ 2008-08-03 12:21 UTC (permalink / raw)
  To: Krzysztof Halasa
  Cc: Stefan Richter, H. Peter Anvin, Ingo Molnar, Linux Kernel, tglx

On Sun, Aug 3, 2008 at 1:54 PM, Krzysztof Halasa <khc@pm.waw.pl> wrote:
[...]
> Right. The latter is much worse. That's why nobody can trust
> CodingStyle and/or checkpatch automatically. It's only sane mode
> of operation is as a help tool for authors and maintainers, to
> quickly locate _potential_ problems.

_much worse_? Wow, I thought the opposite.
Anyway, that's just a coding style patch, feel free to simply not apply it as
it's really a matter of personal taste but be sure that I'm not
blindly changing the code
accordingly to checkpatch. That might be almost true when I started
doing this kind of patches months
ago but it's definitely not true anymore.

Thanks.

regards,
-- 
Paolo
http://paolo.ciarrocchi.googlepages.com/

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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-03 12:21       ` Paolo Ciarrocchi
@ 2008-08-05  2:15         ` H. Peter Anvin
  0 siblings, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2008-08-05  2:15 UTC (permalink / raw)
  To: Paolo Ciarrocchi
  Cc: Krzysztof Halasa, Stefan Richter, Ingo Molnar, Linux Kernel, tglx

Paolo Ciarrocchi wrote:
> 
> _much worse_? Wow, I thought the opposite.
> Anyway, that's just a coding style patch, feel free to simply not apply it as
> it's really a matter of personal taste but be sure that I'm not
> blindly changing the code
> accordingly to checkpatch. That might be almost true when I started
> doing this kind of patches months
> ago but it's definitely not true anymore.
> 

In this case, the real problem is that the original code used a switch 
statement where it really should have used a table.

	-hpa

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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-02 19:24 [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c Paolo Ciarrocchi
  2008-08-03  4:01 ` H. Peter Anvin
@ 2008-08-15 14:52 ` Ingo Molnar
  2008-08-16 10:30   ` Paolo Ciarrocchi
  1 sibling, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2008-08-15 14:52 UTC (permalink / raw)
  To: Paolo Ciarrocchi; +Cc: hpa, Linux Kernel, tglx


* Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:

> Before:
> total: 5 errors, 0 warnings, 48 lines checked
> 
> After:
> total: 0 errors, 0 warnings, 58 lines checked
> 
> paolo@paolo-desktop:~/linux.trees.git$ md5sum /tmp/bios_uv.o.*
> 9afe794594831166704744184e192ed8  /tmp/bios_uv.o.after
> 9afe794594831166704744184e192ed8  /tmp/bios_uv.o.before
> 
> Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
> ---
>  arch/x86/kernel/bios_uv.c |   20 +++++++++++++++-----
>  1 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
> index c639bd5..100e759 100644
> --- a/arch/x86/kernel/bios_uv.c
> +++ b/arch/x86/kernel/bios_uv.c
> @@ -25,11 +25,21 @@ x86_bios_strerror(long status)
>  {
>  	const char *str;
>  	switch (status) {
> -	case  0: str = "Call completed without error"; break;
> -	case -1: str = "Not implemented"; break;
> -	case -2: str = "Invalid argument"; break;
> -	case -3: str = "Call completed with error"; break;
> -	default: str = "Unknown BIOS status code"; break;
> +	case  0:
> +		str = "Call completed without error";
> +		break;
> +	case -1:
> +		str = "Not implemented";
> +		break;
> +	case -2:
> +		str = "Invalid argument";
> +		break;
> +	case -3:
> +		str = "Call completed with error";
> +		break;
> +	default:
> +		str = "Unknown BIOS status code";
> +		break;

hm - i changed your patch to the one below, to align the break's 
vertically, which makes the original variant a lot more readable (and 
even more readable than the new one). Checkpatch still complains about 
it but that's OK, there are always exceptions.

	Ingo

------------------->
Subject: x86: coding style fixes to arch/x86/kernel/bios_uv.c
From: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Date: Sat, 2 Aug 2008 21:24:06 +0200

paolo@paolo-desktop:~/linux.trees.git$ md5sum /tmp/bios_uv.o.*
9afe794594831166704744184e192ed8  /tmp/bios_uv.o.after
9afe794594831166704744184e192ed8  /tmp/bios_uv.o.before

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/bios_uv.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: tip/arch/x86/kernel/bios_uv.c
===================================================================
--- tip.orig/arch/x86/kernel/bios_uv.c
+++ tip/arch/x86/kernel/bios_uv.c
@@ -25,11 +25,11 @@ x86_bios_strerror(long status)
 {
 	const char *str;
 	switch (status) {
-	case  0: str = "Call completed without error"; break;
-	case -1: str = "Not implemented"; break;
-	case -2: str = "Invalid argument"; break;
-	case -3: str = "Call completed with error"; break;
-	default: str = "Unknown BIOS status code"; break;
+	case  0: str = "Call completed without error";	break;
+	case -1: str = "Not implemented";		break;
+	case -2: str = "Invalid argument";		break;
+	case -3: str = "Call completed with error";	break;
+	default: str = "Unknown BIOS status code";	break;
 	}
 	return str;
 }

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

* Re: [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c
  2008-08-15 14:52 ` Ingo Molnar
@ 2008-08-16 10:30   ` Paolo Ciarrocchi
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Ciarrocchi @ 2008-08-16 10:30 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: hpa, Linux Kernel, tglx

On 8/15/08, Ingo Molnar <mingo@elte.hu> wrote:

> hm - i changed your patch to the one below, to align the break's
> vertically, which makes the original variant a lot more readable (and
> even more readable than the new one). Checkpatch still complains about
> it but that's OK, there are always exceptions.
>

thank you Ingo.

ciao,
-- 
Paolo
http://paolo.ciarrocchi.googlepages.com/

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

end of thread, other threads:[~2008-08-16 10:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-02 19:24 [PATCH 2/5] x86: Coding style fixes to arch/x86/kernel/bios_uv.c Paolo Ciarrocchi
2008-08-03  4:01 ` H. Peter Anvin
2008-08-03 10:51   ` Stefan Richter
2008-08-03 11:54     ` Krzysztof Halasa
2008-08-03 12:21       ` Paolo Ciarrocchi
2008-08-05  2:15         ` H. Peter Anvin
2008-08-15 14:52 ` Ingo Molnar
2008-08-16 10:30   ` Paolo Ciarrocchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox