serial: jsm: Provide better code quality
Subsystems (2)
PATCH 2/5 serial: jsm: Remove unnecessary if statement
In reply to Konrad ZapalowiczThe flow of {neo,cls}_param() shows that at this stage the baud rate has a non-zero value. This fact makes the if clausule obsolete and acknowledges it's removal.
--- drivers/tty/serial/jsm/jsm_cls.c | 3 --- drivers/tty/serial/jsm/jsm_neo.c | 3 --- 2 files changed, 6 deletions(-)
drivers/tty/serial/jsm/jsm_cls.c +0 -3
@@ -767,9 +767,6 @@ static void cls_param(struct jsm_channel *ch) ier =readb (&ch->ch_cls_uart->ier); uart_lcr =readb (&ch->ch_cls_uart->lcr); -if (baud ==0 ) - baud =9600 ; - quot = ch->ch_bd->bd_dividend / baud;if (quot !=0 ) {
drivers/tty/serial/jsm/jsm_neo.c +0 -3
@@ -1037,9 +1037,6 @@ static void neo_param(struct jsm_channel *ch) ier =readb (&ch->ch_neo_uart->ier); uart_lcr =readb (&ch->ch_neo_uart->lcr); -if (baud ==0 ) - baud =9600 ; - quot = ch->ch_bd->bd_dividend / baud;if (quot !=0 ) {
Signature · 1 line
1.9.1
PATCH 3/5 serial: jsm: Fix the alignment of the switch satement
This commit fixes the alignment of the 'case's i the switch statement.
--- drivers/tty/serial/jsm/jsm_neo.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/tty/serial/jsm/jsm_neo.c +12 -12
@@ -1019,19 +1019,19 @@ static void neo_param(struct jsm_channel *ch) lcr |=UART_LCR_STOP ;switch (ch->ch_c_cflag &CSIZE ) { -case CS5 : - lcr |=UART_LCR_WLEN5 ; -break ; -case CS6 : - lcr |=UART_LCR_WLEN6 ; -break ; -case CS7 : - lcr |=UART_LCR_WLEN7 ; -break ; -case CS8 : -default : - lcr |=UART_LCR_WLEN8 ; +case CS5 : + lcr |=UART_LCR_WLEN5 ; +break ; +case CS6 : + lcr |=UART_LCR_WLEN6 ; +break ; +case CS7 : + lcr |=UART_LCR_WLEN7 ;break ; +case CS8 : +default : + lcr |=UART_LCR_WLEN8 ; +break ; } ier =readb (&ch->ch_neo_uart->ier);
Signature · 1 line
1.9.1
cover serial: jsm: Provide better code quality
This series of patches fixes a few minor issues in the jsm driver. The patches do not only address the coding style issues however none of them changes the logic.
These patches are against the current tty-next.
Konrad Zapalowicz (5):
serial: jsm: Remove unnecessary parameter from clear_break()
serial: jsm: Remove unnecessary if statement
serial: jsm: Fix the alignment of the switch satement
serial: jsm: Replace magic value with the proper define
serial: jsm: Fix unnecessary space before function ptr arguments
drivers/tty/serial/jsm/jsm.h | 30 +++++++++++++++--------------- drivers/tty/serial/jsm/jsm_cls.c | 5 +---- drivers/tty/serial/jsm/jsm_neo.c | 31 ++++++++++++++----------------- drivers/tty/serial/jsm/jsm_tty.c | 2 +- 4 files changed, 31 insertions(+), 37 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/5 serial: jsm: Remove unnecessary parameter from clear_break()
The 'force' parameter to the {cls,neo}_send_break() function has been removed because it has not been used. The client to this API (the tty code) always called this function with only one value.
--- drivers/tty/serial/jsm/jsm.h | 2 +- drivers/tty/serial/jsm/jsm_cls.c | 2 +- drivers/tty/serial/jsm/jsm_neo.c | 2 +- drivers/tty/serial/jsm/jsm_tty.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/jsm/jsm.h +1 -1
@@ -120,7 +120,7 @@ struct board_ops {void (*disable_receiver) (struct jsm_channel *ch);void (*enable_receiver) (struct jsm_channel *ch);void (*send_break) (struct jsm_channel *ch); -void (*clear_break) (struct jsm_channel *ch,int ); +void (*clear_break) (struct jsm_channel *ch);void (*send_start_character) (struct jsm_channel *ch);void (*send_stop_character) (struct jsm_channel *ch);void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
drivers/tty/serial/jsm/jsm_cls.c +1 -1
@@ -311,7 +311,7 @@ static void cls_set_no_input_flow_control(struct jsm_channel *ch)* No locks are assumed to be held when calling this function. * channel lock is held and released in this function. */ -static void cls_clear_break (struct jsm_channel *ch,int force) +static void cls_clear_break (struct jsm_channel *ch) {unsigned long lock_flags;
drivers/tty/serial/jsm/jsm_neo.c +1 -1
@@ -689,7 +689,7 @@ static void neo_flush_uart_read(struct jsm_channel *ch)/* * No locks are assumed to be held when calling this function. */ -static void neo_clear_break (struct jsm_channel *ch,int force) +static void neo_clear_break (struct jsm_channel *ch) {unsigned long lock_flags;
drivers/tty/serial/jsm/jsm_tty.c +1 -1
@@ -188,7 +188,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state)if (break_state ==-1 ) channel->ch_bd->bd_ops->send_break (channel);else - channel->ch_bd->bd_ops->clear_break (channel,0 ); + channel->ch_bd->bd_ops->clear_break (channel);spin_unlock_irqrestore (&port->lock, lock_flags); }
Signature · 1 line
1.9.1
PATCH 4/5 serial: jsm: Replace magic value with the proper define
In reply to Konrad ZapalowiczThe changed function flushes the tx UART and the '4' corresponds to the UART_FCR_CLEAR_XMIT value. This commit replaces the magic number with this define.
--- drivers/tty/serial/jsm/jsm_neo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/jsm/jsm_neo.c +1 -1
@@ -644,7 +644,7 @@ static void neo_flush_uart_write(struct jsm_channel *ch)/* Check to see if the UART feels it completely flushed the FIFO. */ tmp =readb (&ch->ch_neo_uart->isr_fcr); -if (tmp &4 ) { +if (tmp &UART_FCR_CLEAR_XMIT ) {jsm_dbg (IOCTL , &ch->ch_bd->pci_dev,"Still flushing TX UART... i: %d\n" , i);udelay (10 );
Signature · 1 line
1.9.1
PATCH 5/5 serial: jsm: Fix unnecessary space before function ptr arguments
This commit deals with the checkpatch warning "Unnecessary space before function pointer arguments".
--- drivers/tty/serial/jsm/jsm.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/tty/serial/jsm/jsm.h +15 -15
@@ -111,21 +111,21 @@ struct jsm_channel;************************************************************************/ struct board_ops {irq_handler_t intr; -void (*uart_init) (struct jsm_channel *ch); -void (*uart_off) (struct jsm_channel *ch); -void (*param) (struct jsm_channel *ch); -void (*assert_modem_signals) (struct jsm_channel *ch); -void (*flush_uart_write) (struct jsm_channel *ch); -void (*flush_uart_read) (struct jsm_channel *ch); -void (*disable_receiver) (struct jsm_channel *ch); -void (*enable_receiver) (struct jsm_channel *ch); -void (*send_break) (struct jsm_channel *ch); -void (*clear_break) (struct jsm_channel *ch); -void (*send_start_character) (struct jsm_channel *ch); -void (*send_stop_character) (struct jsm_channel *ch); -void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch); -u32 (*get_uart_bytes_left) (struct jsm_channel *ch); -void (*send_immediate_char) (struct jsm_channel *ch,unsigned char ); +void (*uart_init)(struct jsm_channel *ch); +void (*uart_off)(struct jsm_channel *ch); +void (*param)(struct jsm_channel *ch); +void (*assert_modem_signals)(struct jsm_channel *ch); +void (*flush_uart_write)(struct jsm_channel *ch); +void (*flush_uart_read)(struct jsm_channel *ch); +void (*disable_receiver)(struct jsm_channel *ch); +void (*enable_receiver)(struct jsm_channel *ch); +void (*send_break)(struct jsm_channel *ch); +void (*clear_break)(struct jsm_channel *ch); +void (*send_start_character)(struct jsm_channel *ch); +void (*send_stop_character)(struct jsm_channel *ch); +void (*copy_data_from_queue_to_uart)(struct jsm_channel *ch); +u32 (*get_uart_bytes_left)(struct jsm_channel *ch); +void (*send_immediate_char)(struct jsm_channel *ch,unsigned char ); };
Signature · 1 line
1.9.1