Skip to contentSkip to conversation

drivers/char/[ac]*.c: coding style changes

PATCH Superseded Patrik Kullman 2 participants 2 messages Aug 10, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/char/[ac]*.c: coding style changes

Patch against 2.6.18-rc4 to make drivers/char/[ac]*.c apply to CodingStyle

Also to get an ack that I understand the coding style ;)

If this is ACKed I'll probably go recursively through the entire drivers/char/ to make it conform.

Because if this isn't janitoring....

I'll do something else.. ;)

drivers/char/amiserial.c +11 -11
diff -rup linux-2.6.18-rc4/drivers/char/amiserial.c linux-2.6.18-rc4-codingstyle/drivers/char/amiserial.c
@@ -270,9 +270,9 @@ static void receive_chars(struct async_s
 	custom.intreq = IF_RBF;
 	mb();
 
-	if((serdatr & 0x1ff) = 0)
+	if ((serdatr & 0x1ff) = 0)
 	    status |= UART_LSR_BI;
-	if(serdatr & SDR_OVRUN)
+	if (serdatr & SDR_OVRUN)
 	    status |= UART_LSR_OE;
 
 	ch = serdatr & 0xff;
@@ -466,7 +466,7 @@ static irqreturn_t ser_vbl_int( int irq,
 	 * TBD - is it better to unregister from this interrupt or to
 	 * ignore it if MSI is clear ?
 	 */
-	if(info->IER & UART_IER_MSI)
+	if (info->IER & UART_IER_MSI)
 	  check_modem_status(info);
 	return IRQ_HANDLED;
 }
@@ -834,7 +834,7 @@ static void change_speed(struct async_st
 
 	/* Enable or disable parity bit */
 
-	if(cval & UART_LCR_PARITY)
+	if (cval & UART_LCR_PARITY)
 	  serper |= (SERPER_PARENB);
 
 	custom.serper = serper;
@@ -1001,7 +1001,7 @@ static void rs_send_xchar(struct tty_str
 
 	        /* Check this ! */
 	        local_irq_save(flags);
-		if(!(custom.intenar & IF_TBE)) {
+		if (!(custom.intenar & IF_TBE)) {
 		    custom.intena = IF_SETCLR | IF_TBE;
 		    mb();
 		    /* set a pending Tx Interrupt, transmitter should restart now */
@@ -1119,7 +1119,7 @@ static int set_serial_info(struct async_
   
 	change_irq = new_serial.irq != state->irq;
 	change_port = (new_serial.port != state->port);
-	if(change_irq || change_port || (new_serial.xmit_fifo_size != state->xmit_fifo_size))
+	if (change_irq || change_port || (new_serial.xmit_fifo_size != state->xmit_fifo_size))
 	  return -EINVAL;
   
 	if (!serial_isroot()) {
@@ -1878,15 +1878,15 @@ static inline int line_info(char *buf, s
 
 	stat_buf[0] = 0;
 	stat_buf[1] = 0;
-	if(!(control & SER_RTS))
+	if (!(control & SER_RTS))
 		strcat(stat_buf, "|RTS");
-	if(!(status & SER_CTS))
+	if (!(status & SER_CTS))
 		strcat(stat_buf, "|CTS");
-	if(!(control & SER_DTR))
+	if (!(control & SER_DTR))
 		strcat(stat_buf, "|DTR");
-	if(!(status & SER_DSR))
+	if (!(status & SER_DSR))
 		strcat(stat_buf, "|DSR");
-	if(!(status & SER_DCD))
+	if (!(status & SER_DCD))
 		strcat(stat_buf, "|CD");
 
 	if (info->quot) {
drivers/char/applicom.c +9 -9
diff -rup linux-2.6.18-rc4/drivers/char/applicom.c linux-2.6.18-rc4-codingstyle/drivers/char/applicom.c
@@ -133,7 +133,7 @@ static int ac_register_board(unsigned lo
 {
 	volatile unsigned char byte_reset_it;
 
-	if((readb(loc + CONF_END_TEST)     != 0x00) ||
+	if ((readb(loc + CONF_END_TEST)    != 0x00) ||
 	   (readb(loc + CONF_END_TEST + 1) != 0x55) ||
 	   (readb(loc + CONF_END_TEST + 2) != 0xAA) ||
 	   (readb(loc + CONF_END_TEST + 3) != 0xFF))
@@ -379,10 +379,10 @@ static ssize_t ac_write(struct file *fil
 		return -EINVAL;
 	}
 
-	if(copy_from_user(&st_loc, buf, sizeof(struct st_ram_io))) 
+	if (copy_from_user(&st_loc, buf, sizeof(struct st_ram_io)))
 		return -EFAULT;
 	
-	if(copy_from_user(&tmpmailbox, &buf[sizeof(struct st_ram_io)],
+	if (copy_from_user(&tmpmailbox, &buf[sizeof(struct st_ram_io)],
 			  sizeof(struct mailbox))) 
 		return -EFAULT;
 
@@ -390,7 +390,7 @@ static ssize_t ac_write(struct file *fil
 	TicCard = st_loc.tic_des_from_pc;	/* tic number to send            */
 	IndexCard = NumCard - 1;
 
-	if((NumCard < 1) || (NumCard > MAX_BOARD) || !apbs[IndexCard].RamIO)
+	if ((NumCard < 1) || (NumCard > MAX_BOARD) || !apbs[IndexCard].RamIO)
 		return -EINVAL;
 
 #ifdef DEBUG
@@ -422,7 +422,7 @@ static ssize_t ac_write(struct file *fil
 	spin_lock_irqsave(&apbs[IndexCard].mutex, flags);
 
 	/* Test octet ready correct */
-	if(readb(apbs[IndexCard].RamIO + DATA_FROM_PC_READY) > 2) { 
+	if (readb(apbs[IndexCard].RamIO + DATA_FROM_PC_READY) > 2) {
 		Dummy = readb(apbs[IndexCard].RamIO + VERS);
 		spin_unlock_irqrestore(&apbs[IndexCard].mutex, flags);
 		printk(KERN_WARNING "APPLICOM driver write error board %d, DataFromPcReady = %d\n",
@@ -639,7 +639,7 @@ static irqreturn_t ac_interrupt(int vec,
 			spin_lock(&apbs[i].mutex);
 
 			/* Skip if this board doesn't want attention */
-			if(readb(apbs[i].RamIO + RAM_IT_TO_PC) = 0) {
+			if (readb(apbs[i].RamIO + RAM_IT_TO_PC) = 0) {
 				spin_unlock(&apbs[i].mutex);
 				continue;
 			}
@@ -654,7 +654,7 @@ static irqreturn_t ac_interrupt(int vec,
 				DeviceErrorCount++;
 			}
 
-			if((readb(apbs[i].RamIO + DATA_FROM_PC_READY) > 2) && 
+			if ((readb(apbs[i].RamIO + DATA_FROM_PC_READY) > 2) &&
 			   (readb(apbs[i].RamIO + DATA_FROM_PC_READY) != 6)) {
 				
 				printk(KERN_WARNING "APPLICOM driver interrupt err board %d, DataFromPcReady = %d\n",
@@ -675,7 +675,7 @@ static irqreturn_t ac_interrupt(int vec,
 			}
 			Dummy = readb(apbs[i].RamIO + VERS);
 
-			if(readb(apbs[i].RamIO + RAM_IT_TO_PC)) {
+			if (readb(apbs[i].RamIO + RAM_IT_TO_PC)) {
 				/* There's another int waiting on this card */
 				spin_unlock(&apbs[i].mutex);
 				i--;
@@ -718,7 +718,7 @@ static int ac_ioctl(struct inode *inode,
 	
 	IndexCard = adgl->num_card-1;
 	 
-	if(cmd != 0 && cmd != 6 &&
+	if (cmd != 0 && cmd != 6 &&
 	   ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
 		static int warncount = 10;
 		if (warncount) {
drivers/char/consolemap.c +2 -3
diff -rup linux-2.6.18-rc4/drivers/char/consolemap.c linux-2.6.18-rc4-codingstyle/drivers/char/consolemap.c
@@ -282,11 +282,10 @@ int con_get_trans_old(unsigned char __us
 	if (!access_ok(VERIFY_WRITE, arg, E_TABSZ))
 		return -EFAULT;
 
-	for (i=0; i<E_TABSZ ; i++)
-	  {
+	for (i=0; i<E_TABSZ ; i++) {
 	    ch = conv_uni_to_pc(vc_cons[fg_console].d, p[i]);
 	    __put_user((ch & ~0xff) ? 0 : ch, arg+i);
-	  }
+	}
 	return 0;
 }
 
drivers/char/cs5535_gpio.c +1 -1
diff -rup linux-2.6.18-rc4/drivers/char/cs5535_gpio.c linux-2.6.18-rc4-codingstyle/drivers/char/cs5535_gpio.c
@@ -59,8 +59,7 @@ struct gpio_regmap {
 	char	on;
 	char	off;
 };
-static struct gpio_regmap rm[] -{
+static struct gpio_regmap rm[] = {
 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
drivers/char/cyclades.c +174 -185

1,147 lines not on this page · raw message

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

#1 lore raw
Quoted 3 lines · Patrik Kullman

Patch against 2.6.18-rc4 to make drivers/char/[ac]*.c apply to CodingStyle

Also to get an ack that I understand the coding style ;)

Part of it is definitely undestood. ;-)

Quoted 3 lines

If this is ACKed I'll probably go recursively through the entire drivers/char/ to make it conform.

Because if this isn't janitoring....

It is.

drivers/char/amiserial.c

Quoted 4 lines

I'll do something else.. ;)

drivers/char/amiserial.c +0 -0

OK, this one has relative few CS problems. See below.

drivers/char/amiserial.c static void receive_chars(struct async_s · line 273

Quoted 6 lines
drivers/char/amiserial.c +1 -1
@@ -270,9 +270,9 @@ static void receive_chars(struct async_s
 	custom.intreq = IF_RBF;
 	mb();
 
-	if((serdatr & 0x1ff) = 0)
+	if ((serdatr & 0x1ff) = 0)

OK.

drivers/char/amiserial.c static void receive_chars(struct async_s · line 274

Quoted 1 line
drivers/char/amiserial.c +0 -0
 	    status |= UART_LSR_BI;

This line is badly indented. It should be:

	if ((serdatr & 0x1ff) = 0)
		status |= UART_LSR_BI;

Tab-Tab. Ditto all other chunks.

drivers/char/applicom.c static int ac_register_board(unsigned lo · line 139

Quoted 11 lines
drivers/char/applicom.c +1 -1
@@ -133,7 +133,7 @@ static int ac_register_board(unsigned lo
 {
 	volatile unsigned char byte_reset_it;
 
-	if((readb(loc + CONF_END_TEST)     != 0x00) ||
+	if ((readb(loc + CONF_END_TEST)    != 0x00) ||
 	   (readb(loc + CONF_END_TEST + 1) != 0x55) ||
 	   (readb(loc + CONF_END_TEST + 2) != 0xAA) ||
 	   (readb(loc + CONF_END_TEST + 3) != 0xFF))

Dunno. Notice all readb's were lined up.

drivers/char/consolemap.c int con_get_trans_old(unsigned char __us · line 288

Quoted 10 lines
drivers/char/consolemap.c +2 -3
 
-	for (i=0; i<E_TABSZ ; i++)
-	  {
+	for (i=0; i<E_TABSZ ; i++) {
 	    ch = conv_uni_to_pc(vc_cons[fg_console].d, p[i]);
 	    __put_user((ch & ~0xff) ? 0 : ch, arg+i);
-	  }
+	}
	for (i = 0; i < E_TABSZ; i++) {
		ch = conv_uni_to_pc(vc_cons[fg_console].d, p[i]);
		__put_user((ch & ~0xff) ? 0 : ch, arg + i);
	}

drivers/char/cs5535_gpio.c

Quoted 5 lines
drivers/char/cs5535_gpio.c +1 -1
 
-static struct gpio_regmap rm[] > -{
+static struct gpio_regmap rm[] = {

OK.

drivers/char/cyclades.c

Quoted 6 lines
drivers/char/cs5535_gpio.c +0 -0
 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
drivers/char/cyclades.c +0 -0

Here we have totally different beast. Driver full of 2- and 4-space indentation. Such things should be done with Lindent as found in kernel tarball. And maintainter agreement, indeed.

One caveat: GNU indent will sometimes do stupid things with almost correctly formatted code. So. you can either a) Lindent, then strip out broken changes, or b) do it by hand. You can feel how things should be done by reading core kernel code. It's almost in perfect shape.

The trick is to do CS changes one time and never return to them.

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