Skip to contentSkip to conversation

switch identation was: Re: [Kernel-janitors] [PATCH] Fix

DISCUSSION Randy.Dunlap 3 participants 7 messages Jan 8, 2004 – Jan 12, 2004 Kernel janitors

lore
Share & tools
lore
#0 lore raw

On 24 Dec 2003 01:44:25 -0000 "Luiz Capitulino" <[email protected]> wrote:

| 
| On 12/24/2003, "Arnaldo Carvalho de Melo" <[email protected]> wrote:
| 
| >Em Wed, Dec 24, 2003 at 01:29:15AM -0000, Luiz Capitulino escreveu:
| >>
| >> Hi Arnaldo,
| >>
| >> On 12/23/2003, "Arnaldo Carvalho de Melo" <[email protected]> wrote:
| >>
| >> >Em Tue, Dec 23, 2003 at 10:43:16AM -0200, Luiz Fernando Capitulino escreveu:
| >> >> +		switch(clocking) {
| >> >> +			case 0x03: printk("DISABLED !\n"); break;
| >> >> +			case 0x02: printk("= 2X PCI \n"); break;
| >> >> +			case 0x01: printk("= 133 \n"); break;
| >> >> +			case 0x00: printk("= 100 \n"); break;
| >> >> +		}
| >> >
| >> >May I suggest that we use:
| >> >
| >> >		switch(clocking) {
| >> >		case 0x03: printk("DISABLED !\n");	break;
| >> >		case 0x02: printk("= 2X PCI \n");	break;
| >> >		case 0x01: printk("= 133 \n");		break;
| >> >		case 0x00: printk("= 100 \n");		break;
| >> >		}
| >> >
| >> >That is how it is done in the networking code and most of the core (fs/,
| >> >kernel/) I've seen.
| >>
| >>  I can rediff, but the problem is that all the switch()s in siimage.c
| >> have the indention which I did.
| >>
| >>  Should I rediff ?

No. But that
+ if(! pdev_is_sata(dev)) {
is really ugly (the spacing in "if(! " part of it).

And all this warning needs to fix it is an additional semi-colon, like:

-sata_skip:
+sata_skip:;

although I don't disapprove of the intent of your patch.

| >Ah, indeed having different styles in the same file is something awkward...
| >Perhaps you rediff and later submit a coding style patch converting the other
| >switches?
| 
|  I think is better let this patch with the some style of the file, and
| later I do a new patch which change all the switch()s (is what you
| said? :-))
| 
|  Should it be a new janitor task ?
| 
|  Add this rule to CodingStyle should be good too.

I prefer to use switch() formatting as acme has suggested, but changing it in source files that are currently maintained should go thru their maintainer(s) IMO.

For source files that are basically unmaintained, I don't mind pushing formatting changes.

--
~Randy
MOTD: Always include version info.

--
~Randy
MOTD: Always include version info.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Hi Randy,

Em Qua, 2004-01-07 às 22:45, Randy.Dunlap escreveu:

Quoted 11 lines

| >> Should I rediff ?

No. But that

(quoted diff) +1 -0
+	if(! pdev_is_sata(dev)) {

is really ugly (the spacing in "if(! " part of it).

And all this warning needs to fix it is an additional semi-colon, like:

(quoted diff) +1 -1
-sata_skip:
+sata_skip:;
Quoted 1 line

although I don't disapprove of the intent of your patch.

So, I will rediff only for the "if(! ". Ok ?

Quoted 6 lines

I prefer to use switch() formatting as acme has suggested, but changing it in source files that are currently maintained should go thru their maintainer(s) IMO.

For source files that are basically unmaintained, I don't mind pushing formatting changes.

Should it go to TODO file ?

Signature · 9 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>


_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#2 lore raw
In reply to Randy.Dunlap

On Thu, 08 Jan 2004 05:36:20 -0200 Luiz Fernando Capitulino <[email protected]> wrote:

| 
| Hi Randy,
| 
| Em Qua, 2004-01-07 às 22:45, Randy.Dunlap escreveu:
| 
| > | >>  Should I rediff ?
| > 
| > No.  But that
| > +	if(! pdev_is_sata(dev)) {
| > is really ugly (the spacing in "if(! " part of it).
| > 
| > And all this warning needs to fix it is an additional semi-colon, like:
| > 
| > -sata_skip:
| > +sata_skip:;
| > 
| > although I don't disapprove of the intent of your patch.
| 
|  So, I will rediff only for the "if(! ". Ok ?

OK, I'll merge that, except that if and switch are not functions, so we usually put a space after them and before the opening '(' [yes, I'm slightly disagreeing with acme's proposed switch formatting].

| 
| > I prefer to use switch() formatting as acme has suggested, but
| > changing it in source files that are currently maintained should go
| > thru their maintainer(s) IMO.
| > 
| > For source files that are basically unmaintained, I don't mind
| > pushing formatting changes.
| 
|  Should it go to TODO file ?

Sure, I'll add that.

--
~Randy

--
~Randy
MOTD: Always include version info.

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

Re: switch identation was: Re: [Kernel-janitors] [PATCH] Fix warning

In reply to Randy.Dunlap

Em Thu, Jan 08, 2004 at 11:40:04AM -0800, Randy.Dunlap escreveu:

Quoted 22 lines · On Thu, 08 Jan 2004 05:36:20 -0200 Luiz Fernando Capitulino…
| 
| Hi Randy,
| 
| Em Qua, 2004-01-07 às 22:45, Randy.Dunlap escreveu:
| 
| > | >>  Should I rediff ?
| > 
| > No.  But that
| > +	if(! pdev_is_sata(dev)) {
| > is really ugly (the spacing in "if(! " part of it).
| > 
| > And all this warning needs to fix it is an additional semi-colon, like:
| > 
| > -sata_skip:
| > +sata_skip:;
| > 
| > although I don't disapprove of the intent of your patch.
| 
|  So, I will rediff only for the "if(! ". Ok ?
Quoted 3 lines

OK, I'll merge that, except that if and switch are not functions, so we usually put a space after them and before the opening '(' [yes, I'm slightly disagreeing with acme's proposed switch formatting].

not at all, if I proposed something like:

	switch(foo) {

.
.
.

I'd be nuts 8)

	switch (foo) {
	case bar:
		__bar();
		break;
	case baz:
		__baz();
		break;
	default:
		printk(KERN_ERR "whatever\n");
		break;
	}

Is how I write my code and fix other's :)

- Arnaldo

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw

Re: switch identation was: Re: [Kernel-janitors] [PATCH] Fix warning

In reply to Randy.Dunlap

Em Tue, Dec 23, 2003 at 03:18:50PM -0200, Arnaldo C. Melo escreveu:

Quoted 11 lines

Em Tue, Dec 23, 2003 at 10:43:16AM -0200, Luiz Fernando Capitulino escreveu:

Review

Quoted 6 lines
(quoted diff) +6 -0
+		switch(clocking) {
+			case 0x03: printk("DISABLED !\n"); break;
+			case 0x02: printk("= 2X PCI \n"); break;
+			case 0x01: printk("= 133 \n"); break;
+			case 0x00: printk("= 100 \n"); break;
+		}

May I suggest that we use:

		switch(clocking) {

I was nuts ;(

- Arnaldo
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#5 lore raw
In reply to Randy.Dunlap

Hi Randy,

Em Qui, 2004-01-08 às 17:40, Randy.Dunlap escreveu:

Quoted 2 lines

OK, I'll merge that, except that if and switch are not functions, so we usually put a space after them and before the opening '('

Oh yes, I use that too (I think this way comes from K&R), but in this
patch I'm following the function formatting (as you can see in the lines which was removed).

Actually, Alan (I think him wrote the code) are using the two ways
in the siimage.c code!

Signature · 9 lines
Luiz Fernando N. Capitulino
<[email protected]>
<http://www.telecentros.sp.gov.br>


_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#6 lore raw
In reply to Randy.Dunlap

On Thu, 08 Jan 2004 05:36:20 -0200 Luiz Fernando Capitulino <[email protected]> wrote:

| 
| > I prefer to use switch() formatting as acme has suggested, but
| > changing it in source files that are currently maintained should go
| > thru their maintainer(s) IMO.
| > 
| > For source files that are basically unmaintained, I don't mind
| > pushing formatting changes.
| 
|  Should it go to TODO file ?

Added to KJ TODO file.

--
~Randy
MOTD: Always include version info.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors