Skip to contentSkip to conversation

staging: dgnc: Break line after boolean operator

PATCH In review Rehas Sachdeva 2 participants 2 messages Feb 25, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: dgnc: Break line after boolean operator

The preferred way to break up long math lines is to break after an arthimetic or boolean operator.
This patch fixes the checkpatch.pl warning:
Logical continuations should be on the previous line.

---
 drivers/staging/dgnc/dgnc_neo.c | 12 +++++++-----
 drivers/staging/dgnc/dgnc_tty.c |  4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +7 -5
index ee3155b..b68b758 100644
@@ -351,8 +351,8 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
 
 	/* Turn break off, and unset some variables */
 	if (ch->ch_flags & CH_BREAK_SENDING) {
-		if (time_after_eq(jiffies, ch->ch_stop_sending_break)
-		    || force) {
+		if (time_after_eq(jiffies, ch->ch_stop_sending_break) ||
+		    force) {
 			unsigned char temp = readb(&ch->ch_neo_uart->lcr);
 
 			writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -1783,9 +1783,11 @@ static void neo_vpd(struct dgnc_board *brd)
 		brd->vpd[(i * 2) + 1] = (a >> 8) & 0xff;
 	}
 
-	if  (((brd->vpd[0x08] != 0x82)	   /* long resource name tag */
-		&&  (brd->vpd[0x10] != 0x82))   /* long resource name tag (PCI-66 files)*/
-		||  (brd->vpd[0x7F] != 0x78)) { /* small resource end tag */
+	if (((brd->vpd[0x08] != 0x82) && /* long resource name tag */
+	    (brd->vpd[0x10] != 0x82)) || /* long resource name tag
+					  *  (PCI-66 files)
+					  */
+	    (brd->vpd[0x7F] != 0x78)) {  /* small resource end tag */
 
 		memset(brd->vpd, '\0', NEO_VPD_IMAGESIZE);
 	} else {
drivers/staging/dgnc/dgnc_tty.c +2 -2
index 8a7508a..320ef25 100644
@@ -1800,8 +1800,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;
 	}
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 16 lines · Rehas Sachdeva

The preferred way to break up long math lines is to break after an arthimetic or boolean operator.
This patch fixes the checkpatch.pl warning:
Logical continuations should be on the previous line.

---
 drivers/staging/dgnc/dgnc_neo.c | 12 +++++++-----
 drivers/staging/dgnc/dgnc_tty.c |  4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/staging/dgnc/dgnc_neo.c +0 -0
index ee3155b..b68b758 100644

drivers/staging/dgnc/dgnc_neo.c static inline void neo_clear_break(struct channel_t *ch, int force) · line 355

Quoted 7 lines
drivers/staging/dgnc/dgnc_neo.c +2 -2
@@ -351,8 +351,8 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
 
 	/* Turn break off, and unset some variables */
 	if (ch->ch_flags & CH_BREAK_SENDING) {
-		if (time_after_eq(jiffies, ch->ch_stop_sending_break)
-		    || force) {
+		if (time_after_eq(jiffies, ch->ch_stop_sending_break) ||
+		    force) {

Actually, this doesn't look so nice to me, probably because force is so short.

Quoted 5 lines
drivers/staging/dgnc/dgnc_neo.c +0 -0
 			unsigned char temp = readb(&ch->ch_neo_uart->lcr);
 
 			writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
@@ -1783,9 +1783,11 @@ static void neo_vpd(struct dgnc_board *brd)
 		brd->vpd[(i * 2) + 1] = (a >> 8) & 0xff;

drivers/staging/dgnc/dgnc_neo.c static void neo_vpd(struct dgnc_board *brd) · line 1790

Quoted 10 lines
drivers/staging/dgnc/dgnc_neo.c +5 -3
 	}
 
-	if  (((brd->vpd[0x08] != 0x82)	   /* long resource name tag */
-		&&  (brd->vpd[0x10] != 0x82))   /* long resource name tag (PCI-66 files)*/
-		||  (brd->vpd[0x7F] != 0x78)) { /* small resource end tag */
+	if (((brd->vpd[0x08] != 0x82) && /* long resource name tag */
+	    (brd->vpd[0x10] != 0x82)) || /* long resource name tag
+					  *  (PCI-66 files)
+					  */
+	    (brd->vpd[0x7F] != 0x78)) {  /* small resource end tag */

This one doesn't either. Maybe there could be a single line comment, above the tested expression.

Quoted 8 lines
drivers/staging/dgnc/dgnc_neo.c +0 -0
 		memset(brd->vpd, '\0', NEO_VPD_IMAGESIZE);
 	} else {
drivers/staging/dgnc/dgnc_tty.c +0 -0
index 8a7508a..320ef25 100644

drivers/staging/dgnc/dgnc_tty.c static int dgnc_tty_write(struct tty_struct *tty, · line 1805

Quoted 8 lines
drivers/staging/dgnc/dgnc_tty.c +2 -2
@@ -1800,8 +1800,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;

This one looks fine.

julia

Quoted 12 lines
drivers/staging/dgnc/dgnc_tty.c +0 -0
 	}
 
Signature · 8 lines
2.1.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160225204443.GA29868%40Toblerone.
For more options, visit https://groups.google.com/d/optout.