Staging: Dgnc: Remove unnecessary comments around control statements.
PATCH 1/1 Staging: Dgnc: Remove unnecessary comments around control statements.
Remove Un necessary comments around control statements
Checked with checkpatch.pl.
With this changes, I am also able to compile the code.
--- drivers/staging/dgnc/dgnc_cls.c | 16 ++++++++-------- drivers/staging/dgnc/dgnc_neo.c | 22 +++++++++++----------- drivers/staging/dgnc/dgnc_tty.c | 34 +++++++++++++++++----------------- 3 files changed, 36 insertions(+), 36 deletions(-)
drivers/staging/dgnc/dgnc_cls.c +8 -8
@@ -706,7 +706,7 @@ static void cls_param(struct tty_struct *tty)* unit is NOT open */ if (!(ch->ch_tun.un_flags &UN_ISOPEN ) && - (un->un_type ==DGNC_PRINT )) + un->un_type ==DGNC_PRINT ) baud =C_BAUD (ch->ch_pun.un_tty) &0xff ;else baud =C_BAUD (ch->ch_tun.un_tty) &0xff ;
@@ -719,8 +719,8 @@ static void cls_param(struct tty_struct *tty) jindex = baud; -if ((iindex >=0 ) && (iindex <4 ) && (jindex >=0 ) && - (jindex <16 )) { +if (iindex >=0 && iindex <4 && jindex >=0 && + jindex <16 ) { baud = bauds[iindex][jindex]; }else { baud =0 ;
@@ -820,8 +820,8 @@ static void cls_param(struct tty_struct *tty)if (ch->ch_digi.digi_flags &CTSPACE || ch->ch_c_cflag &CRTSCTS ) {cls_set_cts_flow_control (ch); }else if (ch->ch_c_iflag &IXON ) { -if ((ch->ch_startc == _POSIX_VDISABLE) || - (ch->ch_stopc == _POSIX_VDISABLE)) +if (ch->ch_startc == _POSIX_VDISABLE || + ch->ch_stopc == _POSIX_VDISABLE)cls_set_no_output_flow_control (ch);else cls_set_ixon_flow_control (ch);
@@ -832,8 +832,8 @@ static void cls_param(struct tty_struct *tty)if (ch->ch_digi.digi_flags &RTSPACE || ch->ch_c_cflag &CRTSCTS ) {cls_set_rts_flow_control (ch); }else if (ch->ch_c_iflag &IXOFF ) { -if ((ch->ch_startc == _POSIX_VDISABLE) || - (ch->ch_stopc == _POSIX_VDISABLE)) +if (ch->ch_startc == _POSIX_VDISABLE || + ch->ch_stopc == _POSIX_VDISABLE)cls_set_no_input_flow_control (ch);else cls_set_ixoff_flow_control (ch);
@@ -870,7 +870,7 @@ static void cls_tasklet(unsigned long data)*/ spin_lock_irqsave (&bd->bd_intr_lock, flags); -if ((state ==BOARD_READY ) && (ports >0 )) { +if (state ==BOARD_READY && ports >0 ) {for (i =0 ; i < ports; i++) { ch = bd->channels[i];
drivers/staging/dgnc/dgnc_neo.c +11 -11
@@ -651,7 +651,7 @@ static void neo_param(struct tty_struct *tty)* is NOT open */ if (!(ch->ch_tun.un_flags &UN_ISOPEN ) && - (un->un_type ==DGNC_PRINT )) + un->un_type ==DGNC_PRINT ) baud =C_BAUD (ch->ch_pun.un_tty) &0xff ;else baud =C_BAUD (ch->ch_tun.un_tty) &0xff ;
@@ -664,8 +664,8 @@ static void neo_param(struct tty_struct *tty) jindex = baud; -if ((iindex >=0 ) && (iindex <4 ) && - (jindex >=0 ) && (jindex <16 )) +if (iindex >=0 && iindex <4 && + jindex >=0 && jindex <16 ) baud = bauds[iindex][jindex];else baud =0 ;
@@ -767,8 +767,8 @@ static void neo_param(struct tty_struct *tty)if (ch->ch_digi.digi_flags &CTSPACE || ch->ch_c_cflag &CRTSCTS ) {neo_set_cts_flow_control (ch); }else if (ch->ch_c_iflag &IXON ) { -if ((ch->ch_startc == _POSIX_VDISABLE) || - (ch->ch_stopc == _POSIX_VDISABLE)) +if (ch->ch_startc == _POSIX_VDISABLE || + ch->ch_stopc == _POSIX_VDISABLE)neo_set_no_output_flow_control (ch);else neo_set_ixon_flow_control (ch);
@@ -779,8 +779,8 @@ static void neo_param(struct tty_struct *tty)if (ch->ch_digi.digi_flags &RTSPACE || ch->ch_c_cflag &CRTSCTS ) {neo_set_rts_flow_control (ch); }else if (ch->ch_c_iflag &IXOFF ) { -if ((ch->ch_startc == _POSIX_VDISABLE) || - (ch->ch_stopc == _POSIX_VDISABLE)) +if (ch->ch_startc == _POSIX_VDISABLE || + ch->ch_stopc == _POSIX_VDISABLE)neo_set_no_input_flow_control (ch);else neo_set_ixoff_flow_control (ch);
@@ -827,7 +827,7 @@ static void neo_tasklet(unsigned long data)*/ spin_lock_irqsave (&bd->bd_intr_lock, flags); -if ((state ==BOARD_READY ) && (ports >0 )) { +if (state ==BOARD_READY && ports >0 ) {for (i =0 ; i < ports; i++) { ch = bd->channels[i];if (!ch)
@@ -1680,9 +1680,9 @@ static void neo_vpd(struct dgnc_board *brd)* 0x10 : long resource name tage (PCI-66 files) * 0x7F : small resource end tag */ -if (((brd->vpd[0x08 ] !=0x82 ) && - (brd->vpd[0x10 ] !=0x82 )) || - (brd->vpd[0x7F ] !=0x78 )) { +if ((brd->vpd[0x08 ] !=0x82 && + brd->vpd[0x10 ] !=0x82 ) || + brd->vpd[0x7F ] !=0x78 ) {memset (brd->vpd,'\0' ,NEO_VPD_IMAGESIZE ); }else {/* Search for the serial number */
drivers/staging/dgnc/dgnc_tty.c +17 -17
@@ -525,7 +525,7 @@ void dgnc_carrier(struct channel_t *ch)/* Test for a VIRTUAL carrier transition to HIGH. */ -if (((ch->ch_flags &CH_FCAR ) ==0 ) && (virt_carrier ==1 )) { +if (((ch->ch_flags &CH_FCAR ) ==0 ) && virt_carrier ==1 ) {/* * When carrier rises, wake any threads waiting * for carrier in the open routine.
@@ -536,7 +536,7 @@ void dgnc_carrier(struct channel_t *ch)/* Test for a PHYSICAL carrier transition to HIGH. */ -if (((ch->ch_flags &CH_CD ) ==0 ) && (phys_carrier ==1 )) { +if (((ch->ch_flags &CH_CD ) ==0 ) && phys_carrier ==1 ) {/* * When carrier rises, wake any threads waiting * for carrier in the open routine.
@@ -554,8 +554,8 @@ void dgnc_carrier(struct channel_t *ch)* matter... it really only means "ignore carrier state", not * "make pretend that carrier is there". */ -if ((virt_carrier ==0 ) && ((ch->ch_flags &CH_CD ) !=0 ) && - (phys_carrier ==0 )) { +if (virt_carrier ==0 && ((ch->ch_flags &CH_CD ) !=0 ) && + phys_carrier ==0 ) {/* * When carrier drops: *
@@ -759,7 +759,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)* the queue AND FIFO are both empty. */ if (ch->ch_tun.un_flags &UN_EMPTY ) { -if ((qlen ==0 ) && +if (qlen ==0 && (ch->ch_bd->bd_ops->get_uart_bytes_left (ch) ==0 )) { ch->ch_tun.un_flags &= ~(UN_EMPTY );
@@ -790,7 +790,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)* the queue AND FIFO are both empty. */ if (ch->ch_pun.un_flags &UN_EMPTY ) { -if ((qlen ==0 ) && +if (qlen ==0 && (ch->ch_bd->bd_ops->get_uart_bytes_left (ch) ==0 )) ch->ch_pun.un_flags &= ~(UN_EMPTY ); }
@@ -1162,7 +1162,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)* Determine if this is the last close or not - and if we agree about * which type of close it is with the Line Discipline */ -if ((tty->count ==1 ) && (un->un_open_count !=1 )) { +if (tty->count ==1 && un->un_open_count !=1 ) {/* * Uh, oh. tty->count is 1, which means that the tty * structure will be freed. un_open_count should always
@@ -1199,13 +1199,13 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)* Only officially close channel if count is 0 and * DIGI_PRINTER bit is not set. */ -if ((ch->ch_open_count ==0 ) && +if (ch->ch_open_count ==0 && !(ch->ch_digi.digi_flags &DIGI_PRINTER )) { ch->ch_flags &= ~(CH_STOPI |CH_FORCED_STOPI );/* turn off print device when closing print device. */ -if ((un->un_type ==DGNC_PRINT ) && (ch->ch_flags &CH_PRON )) { +if (un->un_type ==DGNC_PRINT && (ch->ch_flags &CH_PRON )) {dgnc_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); ch->ch_flags &= ~CH_PRON ;
@@ -1250,7 +1250,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file) }else {/* turn off print device when closing print device. */ -if ((un->un_type ==DGNC_PRINT ) && (ch->ch_flags &CH_PRON )) { +if (un->un_type ==DGNC_PRINT && (ch->ch_flags &CH_PRON )) {dgnc_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); ch->ch_flags &= ~CH_PRON ;
@@ -1474,7 +1474,7 @@ static int dgnc_tty_write(struct tty_struct *tty,* Output the printer ON string, if we are in terminal mode, but * need to be in printer mode. */ -if ((un->un_type ==DGNC_PRINT ) && !(ch->ch_flags &CH_PRON )) { +if (un->un_type ==DGNC_PRINT && !(ch->ch_flags &CH_PRON )) {dgnc_wmove (ch, ch->ch_digi.digi_onstr, (int )ch->ch_digi.digi_onlen); head = (ch->ch_w_head) & tmask;
@@ -1485,7 +1485,7 @@ static int dgnc_tty_write(struct tty_struct *tty,* On the other hand, output the printer OFF string, if we are * currently in printer mode, but need to output to the terminal. */ -if ((un->un_type !=DGNC_PRINT ) && (ch->ch_flags &CH_PRON )) { +if (un->un_type !=DGNC_PRINT && (ch->ch_flags &CH_PRON )) {dgnc_wmove (ch, ch->ch_digi.digi_offstr, (int )ch->ch_digi.digi_offlen); head = (ch->ch_w_head) & tmask;
@@ -1521,8 +1521,8 @@ static int dgnc_tty_write(struct tty_struct *tty, }/* Update printer buffer empty time. */ -if ((un->un_type ==DGNC_PRINT ) && (ch->ch_digi.digi_maxcps >0 ) && - (ch->ch_digi.digi_bufsize >0 )) { +if ((un->un_type ==DGNC_PRINT && ch->ch_digi.digi_maxcps >0 ) && + ch->ch_digi.digi_bufsize >0 ) { ch->ch_cpstime += (HZ * count) / ch->ch_digi.digi_maxcps; }
@@ -2221,7 +2221,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,spin_lock_irqsave (&ch->ch_lock, flags); -if (((cmd ==TCSBRK ) && (!arg)) || (cmd ==TCSBRKP )) +if ((cmd ==TCSBRK && !arg) || cmd ==TCSBRKP ) ch_bd_ops->send_break (ch,250 );spin_unlock_irqrestore (&ch->ch_lock, flags);
@@ -2323,14 +2323,14 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,if (rc) goto err_unlock; -if ((arg ==TCIFLUSH ) || (arg ==TCIOFLUSH )) { +if (arg ==TCIFLUSH || arg ==TCIOFLUSH ) { ch->ch_r_head = ch->ch_r_tail; ch_bd_ops->flush_uart_read (ch);/* Force queue flow control to be released, if needed */ dgnc_check_queue_flow_control (ch); } -if ((arg ==TCOFLUSH ) || (arg ==TCIOFLUSH )) { +if (arg ==TCOFLUSH || arg ==TCIOFLUSH ) {if (!(un->un_type ==DGNC_PRINT )) { ch->ch_w_head = ch->ch_w_tail; ch_bd_ops->flush_uart_write (ch);
Signature · 1 line
2.7.4
Greg KH
maintainerQuoted 1 line · Keerthi Reddy
Remove Un necessary comments around control statements
"comments"? That's not what this patch does at all :(
Quoted 4 lines
Checked with checkpatch.pl.
With this changes, I am also able to compile the code.
That should always be the case, no need to ever say that :)
Quoted 22 lines
Signed-off-by Keerthi Reddy <[email protected]>--- drivers/staging/dgnc/dgnc_cls.c | 16 ++++++++-------- drivers/staging/dgnc/dgnc_neo.c | 22 +++++++++++----------- drivers/staging/dgnc/dgnc_tty.c | 34 +++++++++++++++++----------------- 3 files changed, 36 insertions(+), 36 deletions(-)drivers/staging/dgnc/dgnc_cls.c +1
-1@@ -706,7 +706,7 @@ static void cls_param(struct tty_struct *tty)* unit is NOT open */ if (!(ch->ch_tun.un_flags &UN_ISOPEN ) && - (un->un_type ==DGNC_PRINT )) + un->un_type ==DGNC_PRINT ) baud =C_BAUD (ch->ch_pun.un_tty) &0xff ;else baud =C_BAUD (ch->ch_tun.un_tty) &0xff ;
drivers/staging/dgnc/dgnc_cls.c static void cls_param(struct tty_struct *tty) · line 723
Quoted 7 lines
drivers/staging/dgnc/dgnc_cls.c +2
-2@@ -719,8 +719,8 @@ static void cls_param(struct tty_struct *tty) jindex = baud; -if ((iindex >=0 ) && (iindex <4 ) && (jindex >=0 ) && - (jindex <16 )) { +if (iindex >=0 && iindex <4 && jindex >=0 && + jindex <16 ) {
This is harder to read now, don't you think? And yes, it might be "correct", but it is good to keep () around things like this so you don't have to go look up the order-of-operations to ensure that the developer got it correct.
thanks,
greg k-h
That make more sense. Plese don't consider this patch.
Keerthi.
Quoted 5 lines · Greg KH
it is good to keep () around things like this so you don't have to go look up the order-of-operations to ensure that the developer got it correct.