Re: [PATCH 1/8] tty: serial: jsm: Fixed file by added more spacing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2020-12-06 at 13:09 +0530, Clement Smith wrote:
> Fixed a coding style issue

Don't send 8 identically titled patches that each change a single line.

Send one patch, with an updated title like:

	Subject: [PATCH] jsm_tty: Whitespace neatening

that changes _all_ the whitespace that you believe should be updated.

And ideally, instead of just whitespace changes, the code would be
updated to eliminate the code duplication by using temporaries and a
single line conversion.

> diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
[]
> @@ -607,7 +607,7 @@ void jsm_input(struct jsm_channel *ch)
>  				 * Give the Linux ld the flags in the
>  				 * format it likes.
>  				 */
> -				if (*(ch->ch_equeue +tail +i) & UART_LSR_BI)
> +				if (*(ch->ch_equeue + tail + i) & UART_LSR_BI)
>  					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i),  TTY_BREAK);
>  				else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE)
>  					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY);

Something like:
---
 drivers/tty/serial/jsm/jsm_tty.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 689774c073ca..b48ca17f38d3 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -607,14 +607,20 @@ void jsm_input(struct jsm_channel *ch)
 				 * Give the Linux ld the flags in the
 				 * format it likes.
 				 */
-				if (*(ch->ch_equeue +tail +i) & UART_LSR_BI)
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i),  TTY_BREAK);
-				else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE)
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY);
-				else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE)
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_FRAME);
+				u8 error = ch->ch_equeue[tail + i];
+				u8 read = ch->ch_rqueue[tail + i];
+				int type;
+
+				if (error & UART_LSR_BI)
+					type = TTY_BREAK;
+				else if (error & UART_LSR_PE)
+					type = TTY_PARITY;
+				else if (error & UART_LSR_FE)
+					type = TTY_FRAME;
 				else
-					tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
+					type = TTY_NORMAL;
+				tty_insert_flip_char(port, read, type);
+
 			}
 		} else {
 			tty_insert_flip_string(port, ch->ch_rqueue + tail, s);





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux