Skip to contentSkip to conversation

serial:blackfin: Correct coding style in bfin serial driver.

PATCH In review Sonic Zhang 4 participants 5 messages Jul 19, 2011 – Jul 20, 2011 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 serial:blackfin: Correct coding style in bfin serial driver.

From: Sonic Zhang <[email protected]>

---
 drivers/tty/serial/bfin_5xx.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
drivers/tty/serial/bfin_5xx.c +16 -9
index 9b1ff2b..6981e2a 100644
@@ -234,8 +234,8 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
 	status = UART_GET_LSR(uart);
 	UART_CLEAR_LSR(uart);
 
- 	ch = UART_GET_CHAR(uart);
- 	uart->port.icount.rx++;
+	ch = UART_GET_CHAR(uart);
+	uart->port.icount.rx++;
 
 #if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
 	defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
@@ -739,9 +739,8 @@ static int bfin_serial_startup(struct uart_port *port)
 			pr_info("Unable to attach BlackFin UART CTS interrupt. So, disable it.\n");
 		}
 	}
-	if (uart->rts_pin >= 0) {
+	if (uart->rts_pin >= 0)
 		gpio_direction_output(uart->rts_pin, 0);
-	}
 #endif
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
 	if (uart->cts_pin >= 0 && request_irq(uart->status_irq,
@@ -1091,10 +1090,18 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
 				*parity = 'o';
 		}
 		switch (lcr & 0x03) {
-			case 0:	*bits = 5; break;
-			case 1:	*bits = 6; break;
-			case 2:	*bits = 7; break;
-			case 3:	*bits = 8; break;
+		case 0:
+			*bits = 5;
+			break;
+		case 1:
+			*bits = 6;
+			break;
+		case 2:
+			*bits = 7;
+			break;
+		case 3:
+			*bits = 8;
+			break;
 		}
 		/* Set DLAB in LCR to Access DLL and DLH */
 		UART_SET_DLAB(uart);
@@ -1183,7 +1190,7 @@ static struct console bfin_serial_console = {
 	.index		= -1,
 	.data		= &bfin_serial_reg,
 };
-#define BFIN_SERIAL_CONSOLE	&bfin_serial_console
+#define BFIN_SERIAL_CONSOLE	(&bfin_serial_console)
 #else
 #define BFIN_SERIAL_CONSOLE	NULL
 #endif /* CONFIG_SERIAL_BFIN_CONSOLE */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 serial:blackfin: rename Blackfin serial driver to bfin_uart.c

From: Sonic Zhang <[email protected]>

bfin_5xx.c is not a general name for all Blackfin chips.

---
 drivers/tty/serial/Kconfig     |    2 +-
 drivers/tty/serial/Makefile    |    2 +-
 drivers/tty/serial/bfin_5xx.c  | 1604 ----------------------------------------
 drivers/tty/serial/bfin_uart.c | 1604 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1606 insertions(+), 1606 deletions(-)
 delete mode 100644 drivers/tty/serial/bfin_5xx.c
 create mode 100644 drivers/tty/serial/bfin_uart.c
drivers/tty/serial/Kconfig +1 -1
index 636144c..d98d3d0 100644
@@ -737,7 +737,7 @@ config SERIAL_BFIN
 	  Add support for the built-in UARTs on the Blackfin.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called bfin_5xx.
+	  module is named bfin_uart.ko.
 
 config SERIAL_BFIN_CONSOLE
 	bool "Console on Blackfin serial port"
drivers/tty/serial/Makefile +1 -1
index cb2628f..7ac8dc6 100644
@@ -35,7 +35,7 @@ obj-$(CONFIG_SERIAL_PXA) += pxa.o
 obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o
 obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
 obj-$(CONFIG_SERIAL_BCM63XX) += bcm63xx_uart.o
-obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o
+obj-$(CONFIG_SERIAL_BFIN) += bfin_uart.o
 obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o
 obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o
 obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o
drivers/tty/serial/bfin_5xx.c deleted +0 -1604

1,604 lines not on this page · raw message

drivers/tty/serial/bfin_uart.c new file +1604 -0

1,380 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#3 lore raw
In reply to Sonic Zhang
Quoted 1 line · Sonic Zhang

From: Sonic Zhang <[email protected]>

[]

Quoted 11 lines
drivers/tty/serial/bfin_5xx.c +3 -4
@@ -1091,10 +1090,18 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
 				*parity = 'o';
 		}
 		switch (lcr & 0x03) {
-			case 0:	*bits = 5; break;
-			case 1:	*bits = 6; break;
-			case 2:	*bits = 7; break;
-			case 3:	*bits = 8; break;
+		case 0:
+			*bits = 5;
+			break;

drivers/tty/serial/bfin_5xx.c bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, · line 1105

Quoted 10 lines
drivers/tty/serial/bfin_5xx.c +9 -0
+		case 1:
+			*bits = 6;
+			break;
+		case 2:
+			*bits = 7;
+			break;
+		case 3:
+			*bits = 8;
+			break;
 		}

Maybe just:

	*bits = 5 + (lcr & 3);
#4 lore raw
In reply to Joe Perches
Quoted 38 lines

-----Original Message-----
From: Joe Perches [mailto:[email protected]]
Sent: Tuesday, July 19, 2011 11:29 PM
To: Sonic Zhang
Cc: Alan Cox; [email protected]; [email protected]; Zhang, Sonic
Subject: Re: [PATCH 1/2] serial:blackfin: Correct coding style in bfin serial driver.

Quoted 1 line · Sonic Zhang

From: Sonic Zhang <[email protected]>

[]

Review

Quoted 1 line
(quoted diff) +0 -0
@@ -1091,10 +1090,18 @@

bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,

Quoted 10 lines
drivers/tty/serial/bfin_5xx.c +3 -4
                             *parity = 'o';
             }
             switch (lcr & 0x03) {
-                    case 0: *bits = 5; break;
-                    case 1: *bits = 6; break;
-                    case 2: *bits = 7; break;
-                    case 3: *bits = 8; break;
+            case 0:
+                    *bits = 5;
+                    break;

drivers/tty/serial/bfin_5xx.c bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, · line 1105

Quoted 10 lines
drivers/tty/serial/bfin_5xx.c +9 -0
+            case 1:
+                    *bits = 6;
+                    break;
+            case 2:
+                    *bits = 7;
+                    break;
+            case 3:
+                    *bits = 8;
+                    break;
             }
Quoted 3 lines

Maybe just:

      *bits = 5 + (lcr & 3);

Could be a new patch.

Sonic

Quoted 2 lines