kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@drive
@ 2020-06-07 22:41 Rodolfo C. Villordo
  2020-06-08  5:15 ` Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rodolfo C. Villordo @ 2020-06-07 22:41 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, kernel-janitors, linux-kernel
  Cc: rodolfovillordo

Multiple line over 80 characters fixes by splitting in multiple lines.
Warning found by checkpatch.pl

Signed-off-by: Rodolfo C. Villordo <rodolfovillordo@gmail.com>
---
 drivers/staging/vt6655/rxtx.c | 225 ++++++++++++++++++++++++----------
 1 file changed, 162 insertions(+), 63 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index cfab64d2b312..30ea29ea70cf 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -165,7 +165,8 @@ s_uGetTxRsvTime(
 {
 	unsigned int uDataTime, uAckTime;
 
-	uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, cbFrameLength, wRate);
+	uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+				      cbFrameLength, wRate);
 
 	if (!bNeedAck)
 		return uDataTime;
@@ -206,28 +207,39 @@ s_uGetRTSCTSRsvTime(
 	unsigned int uAckTime = 0;
 	unsigned int uDataTime = 0;
 
-	uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate);
+	uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+				      cbFrameLength, wCurrentRate);
 	if (byRTSRsvType = 0) { /* RTSTxRrvTime_bb */
-		uRTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
-		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+		uRTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     20, pDevice->byTopCCKBasicRate);
+		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
 		uCTSTime = uAckTime;
 	} else if (byRTSRsvType = 1) { /* RTSTxRrvTime_ba, only in 2.4GHZ */
-		uRTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+		uRTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     20, pDevice->byTopCCKBasicRate);
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
+		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopOFDMBasicRate);
 	} else if (byRTSRsvType = 2) { /* RTSTxRrvTime_aa */
-		uRTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate);
-		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+		uRTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     20, pDevice->byTopOFDMBasicRate);
+		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopOFDMBasicRate);
 		uCTSTime = uAckTime;
 	} else if (byRTSRsvType = 3) { /* CTSTxRrvTime_ba, only in 2.4GHZ */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
+		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopOFDMBasicRate);
 		uRrvTime = uCTSTime + uAckTime + uDataTime + 2 * pDevice->uSIFS;
 		return cpu_to_le16((u16)uRrvTime);
 	}
 
 	/* RTSRrvTime */
-	uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3 * pDevice->uSIFS;
+	uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime
+			+ 3 * pDevice->uSIFS;
 	return cpu_to_le16((u16)uRrvTime);
 }
 
@@ -350,72 +362,102 @@ s_uGetRTSCTSDuration(
 
 	switch (byDurType) {
 	case RTSDUR_BB:    /* RTSDuration_bb */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-		uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
+		uDurTime = uCTSTime + 2 * pDevice->uSIFS
+				+ s_uGetTxRsvTime(pDevice, byPktType,
+						  cbFrameLength, wRate,
+						  bNeedAck);
 		break;
 
 	case RTSDUR_BA:    /* RTSDuration_ba */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-		uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
+		uDurTime = uCTSTime + 2 * pDevice->uSIFS
+				+ s_uGetTxRsvTime(pDevice, byPktType,
+						  cbFrameLength, wRate,
+						  bNeedAck);
 		break;
 
 	case RTSDUR_AA:    /* RTSDuration_aa */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-		uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopOFDMBasicRate);
+		uDurTime = uCTSTime + 2 * pDevice->uSIFS
+				+ s_uGetTxRsvTime(pDevice, byPktType,
+						  cbFrameLength, wRate,
+						  bNeedAck);
 		break;
 
 	case CTSDUR_BA:    /* CTSDuration_ba */
-		uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+		uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType,
+							    cbFrameLength,
+							    wRate, bNeedAck);
 		break;
 
 	case RTSDUR_BA_F0: /* RTSDuration_ba_f0 */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
+		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
+		    (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
-		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) &&
+			 (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
 
 		break;
 
 	case RTSDUR_AA_F0: /* RTSDuration_aa_f0 */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopOFDMBasicRate);
+		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
+		    (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
-		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) &&
+			 (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
 
 		break;
 
 	case RTSDUR_BA_F1: /* RTSDuration_ba_f1 */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopCCKBasicRate);
+		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
+		    (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
-		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) &&
+			 (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
 
 		break;
 
 	case RTSDUR_AA_F1: /* RTSDuration_aa_f1 */
-		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
+					     14, pDevice->byTopOFDMBasicRate);
+		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
+		    (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
-		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) &&
+			 (wRate <= RATE_54M))
 			uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
 
 		break;
 
 	case CTSDUR_BA_F0: /* CTSDuration_ba_f0 */
-		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
+		    (wRate <= RATE_54M))
 			uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
-		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) &&
+			 (wRate <= RATE_54M))
 			uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
 
 		break;
 
 	case CTSDUR_BA_F1: /* CTSDuration_ba_f1 */
-		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
+		    (wRate <= RATE_54M))
 			uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
-		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
+		else if ((byFBOption = AUTO_FB_1) && (wRate >= RATE_18M) &&
+			 (wRate <= RATE_54M))
 			uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
 
 		break;
@@ -459,7 +501,8 @@ s_uFillDataHead(
 					  PK_TYPE_11B, &buf->b);
 
 			if (is_pspoll) {
-				__le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15));
+				__le16 dur = cpu_to_le16(pDevice->current_aid |
+							 BIT(14) | BIT(15));
 
 				buf->duration_a = dur;
 				buf->duration_b = dur;
@@ -477,8 +520,11 @@ s_uFillDataHead(
 									    uMACfragNum, byFBOption));
 			}
 
-			buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
-			buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
+			buf->time_stamp_off_a +				vnt_time_stamp_off(pDevice, wCurrentRate);
+			buf->time_stamp_off_b +				vnt_time_stamp_off(pDevice,
+						   pDevice->byTopCCKBasicRate);
 
 			return buf->duration_a;
 		} else {
@@ -501,8 +547,11 @@ s_uFillDataHead(
 			buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
 										 wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
 
-			buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
-			buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
+			buf->time_stamp_off_a +				vnt_time_stamp_off(pDevice, wCurrentRate);
+			buf->time_stamp_off_b +				vnt_time_stamp_off(pDevice,
+						   pDevice->byTopCCKBasicRate);
 
 			return buf->duration_a;
 		} /* if (byFBOption = AUTO_FB_NONE) */
@@ -530,7 +579,8 @@ s_uFillDataHead(
 					  byPktType, &buf->ab);
 
 			if (is_pspoll) {
-				__le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15));
+				__le16 dur = cpu_to_le16(pDevice->current_aid |
+							 BIT(14) | BIT(15));
 
 				buf->duration = dur;
 			} else {
@@ -542,7 +592,8 @@ s_uFillDataHead(
 									    byFBOption));
 			}
 
-			buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
+			buf->time_stamp_off +				vnt_time_stamp_off(pDevice, wCurrentRate);
 			return buf->duration;
 		}
 	} else {
@@ -552,7 +603,8 @@ s_uFillDataHead(
 				  byPktType, &buf->ab);
 
 		if (is_pspoll) {
-			__le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15));
+			__le16 dur = cpu_to_le16(pDevice->current_aid |
+						 BIT(14) | BIT(15));
 
 			buf->duration = dur;
 		} else {
@@ -792,7 +844,8 @@ s_vFillCTSHead(
 	}
 
 	if (byPktType = PK_TYPE_11GB || byPktType = PK_TYPE_11GA) {
-		if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) {
+		if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA &&
+		    uDMAIdx != TYPE_BEACONDMA) {
 			/* Auto Fall back */
 			struct vnt_cts_fb *buf = pvCTS;
 			/* Get SignalField, ServiceField & Length */
@@ -921,50 +974,96 @@ s_vGenerateTxParameter(
 			/* Fill RsvTime */
 			struct vnt_rrv_time_rts *buf = pvRrvTime;
 
-			buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
-			buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate);
-			buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
-			buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
-			buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
-
-			s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+			buf->rts_rrv_time_aa +				s_uGetRTSCTSRsvTime(pDevice, 2, byPktType,
+						    cbFrameSize, wCurrentRate);
+			buf->rts_rrv_time_ba +				s_uGetRTSCTSRsvTime(pDevice, 1, byPktType,
+						    cbFrameSize, wCurrentRate);
+			buf->rts_rrv_time_bb +				s_uGetRTSCTSRsvTime(pDevice, 0, byPktType,
+						    cbFrameSize, wCurrentRate);
+			buf->rrv_time_a +				vnt_rxtx_rsvtime_le16(pDevice, byPktType,
+						      cbFrameSize, wCurrentRate,
+						      bNeedACK);
+			buf->rrv_time_b +				vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B,
+						      cbFrameSize,
+						      pDevice->byTopCCKBasicRate,
+						      bNeedACK);
+
+			s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize,
+				       bNeedACK, bDisCRC, psEthHeader,
+				       wCurrentRate, byFBOption);
 		} else {/* RTS_needless, PCF mode */
 			struct vnt_rrv_time_cts *buf = pvRrvTime;
 
-			buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
-			buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
-			buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate);
+			buf->rrv_time_a +				vnt_rxtx_rsvtime_le16(pDevice, byPktType,
+						      cbFrameSize, wCurrentRate,
+						      bNeedACK);
+			buf->rrv_time_b +				vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B,
+						      cbFrameSize,
+						      pDevice->byTopCCKBasicRate,
+						      bNeedACK);
+			buf->cts_rrv_time_ba +				s_uGetRTSCTSRsvTime(pDevice, 3, byPktType,
+						    cbFrameSize, wCurrentRate);
 
 			/* Fill CTS */
-			s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
+			s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS,
+				       cbFrameSize, bNeedACK, bDisCRC,
+				       wCurrentRate, byFBOption);
 		}
 	} else if (byPktType = PK_TYPE_11A) {
 		if (pvRTS) {/* RTS_need, non PCF mode */
 			struct vnt_rrv_time_ab *buf = pvRrvTime;
 
-			buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
-			buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
+			buf->rts_rrv_time +				s_uGetRTSCTSRsvTime(pDevice, 2, byPktType,
+						    cbFrameSize, wCurrentRate);
+			buf->rrv_time +				vnt_rxtx_rsvtime_le16(pDevice, byPktType,
+						      cbFrameSize, wCurrentRate,
+						      bNeedACK);
 
 			/* Fill RTS */
-			s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+			s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize,
+				       bNeedACK, bDisCRC, psEthHeader,
+				       wCurrentRate, byFBOption);
 		} else if (!pvRTS) {/* RTS_needless, non PCF mode */
 			struct vnt_rrv_time_ab *buf = pvRrvTime;
 
-			buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK);
+			buf->rrv_time +				vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11A,
+						      cbFrameSize, wCurrentRate,
+						      bNeedACK);
 		}
 	} else if (byPktType = PK_TYPE_11B) {
 		if (pvRTS) {/* RTS_need, non PCF mode */
 			struct vnt_rrv_time_ab *buf = pvRrvTime;
 
-			buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
-			buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
+			buf->rts_rrv_time +				s_uGetRTSCTSRsvTime(pDevice, 0, byPktType,
+						    cbFrameSize, wCurrentRate);
+			buf->rrv_time +				vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B,
+						      cbFrameSize, wCurrentRate,
+						      bNeedACK);
 
 			/* Fill RTS */
-			s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+			s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize,
+				       bNeedACK, bDisCRC, psEthHeader,
+				       wCurrentRate, byFBOption);
 		} else { /* RTS_needless, non PCF mode */
 			struct vnt_rrv_time_ab *buf = pvRrvTime;
 
-			buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
+			buf->rrv_time +				vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B,
+						      cbFrameSize, wCurrentRate,
+						      bNeedACK);
 		}
 	}
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d
  2020-06-07 22:41 Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@drive Rodolfo C. Villordo
@ 2020-06-08  5:15 ` Greg Kroah-Hartman
  2020-06-08  5:46 ` Al Viro
  2020-06-08  7:26 ` Dan Carpenter
  2 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-08  5:15 UTC (permalink / raw)
  To: Rodolfo C. Villordo; +Cc: Forest Bond, kernel-janitors, linux-kernel

On Sun, Jun 07, 2020 at 10:41:56PM +0000, Rodolfo C. Villordo wrote:
> Multiple line over 80 characters fixes by splitting in multiple lines.
> Warning found by checkpatch.pl
> 
> Signed-off-by: Rodolfo C. Villordo <rodolfovillordo@gmail.com>
> ---
>  drivers/staging/vt6655/rxtx.c | 225 ++++++++++++++++++++++++----------
>  1 file changed, 162 insertions(+), 63 deletions(-)
> 

Your subject is a bit odd :(

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d
  2020-06-07 22:41 Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@drive Rodolfo C. Villordo
  2020-06-08  5:15 ` Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d Greg Kroah-Hartman
@ 2020-06-08  5:46 ` Al Viro
  2020-06-08  5:59   ` Julia Lawall
  2020-06-08  7:26 ` Dan Carpenter
  2 siblings, 1 reply; 6+ messages in thread
From: Al Viro @ 2020-06-08  5:46 UTC (permalink / raw)
  To: Rodolfo C. Villordo
  Cc: Forest Bond, Greg Kroah-Hartman, kernel-janitors, linux-kernel

On Sun, Jun 07, 2020 at 10:41:56PM +0000, Rodolfo C. Villordo wrote:
> Multiple line over 80 characters fixes by splitting in multiple lines.
> Warning found by checkpatch.pl

I doubt that checkpatch.pl can catch the real problems there:

* Hungarian Notation Sucks.  Really.
* so does CamelCase, especially for wonders like s_uGetRTSCTSRsvTime
* local variables are useful
* if a long expression keeps cropping up all over the place, you
probably are missing an inline helper.

PS: this
> -			buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
> -			buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
> +			buf->time_stamp_off_a > +				vnt_time_stamp_off(pDevice, wCurrentRate);
> +			buf->time_stamp_off_b > +				vnt_time_stamp_off(pDevice,
> +						   pDevice->byTopCCKBasicRate);
is no improvement.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d
  2020-06-08  5:46 ` Al Viro
@ 2020-06-08  5:59   ` Julia Lawall
  2020-06-08  8:41     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2020-06-08  5:59 UTC (permalink / raw)
  To: Al Viro
  Cc: Rodolfo C. Villordo, Forest Bond, Greg Kroah-Hartman,
	kernel-janitors, linux-kernel



On Mon, 8 Jun 2020, Al Viro wrote:

> On Sun, Jun 07, 2020 at 10:41:56PM +0000, Rodolfo C. Villordo wrote:
> > Multiple line over 80 characters fixes by splitting in multiple lines.
> > Warning found by checkpatch.pl
>
> I doubt that checkpatch.pl can catch the real problems there:
>
> * Hungarian Notation Sucks.  Really.
> * so does CamelCase, especially for wonders like s_uGetRTSCTSRsvTime

Rodolfo,

If you work hard with Coccinelle and python scripting, it can help with
the first two problems.

julia


> * local variables are useful
> * if a long expression keeps cropping up all over the place, you
> probably are missing an inline helper.
>
> PS: this
> > -			buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
> > -			buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
> > +			buf->time_stamp_off_a > > +				vnt_time_stamp_off(pDevice, wCurrentRate);
> > +			buf->time_stamp_off_b > > +				vnt_time_stamp_off(pDevice,
> > +						   pDevice->byTopCCKBasicRate);
> is no improvement.
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d
  2020-06-07 22:41 Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@drive Rodolfo C. Villordo
  2020-06-08  5:15 ` Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d Greg Kroah-Hartman
  2020-06-08  5:46 ` Al Viro
@ 2020-06-08  7:26 ` Dan Carpenter
  2 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-06-08  7:26 UTC (permalink / raw)
  To: Rodolfo C. Villordo
  Cc: Forest Bond, Greg Kroah-Hartman, kernel-janitors, linux-kernel

On Sun, Jun 07, 2020 at 10:41:56PM +0000, Rodolfo C. Villordo wrote:
>  	/* RTSRrvTime */
> -	uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3 * pDevice->uSIFS;
> +	uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime
> +			+ 3 * pDevice->uSIFS;

The + character should go on the first line:

	uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime +
		   3 * pDevice->uSIFS;

The second line should be indented with:

[tab][tab][space][space][space]3 * pDevice->uSIFS;

Same rules apply everywhere.  I'm not going to comment on every line.

>  	case RTSDUR_BA_F0: /* RTSDuration_ba_f0 */
> -		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
> -		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
> +		uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType,
> +					     14, pDevice->byTopCCKBasicRate);
> +		if ((byFBOption = AUTO_FB_0) && (wRate >= RATE_18M) &&
> +		    (wRate <= RATE_54M))


Here it's awkward to break the two wRate conditions across multiple
lines.  It's better to write:

		if ((byFBOption = AUTO_FB_0) &&
	            (wRate >= RATE_18M) && (wRate <= RATE_54M))

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d
  2020-06-08  5:59   ` Julia Lawall
@ 2020-06-08  8:41     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2020-06-08  8:41 UTC (permalink / raw)
  To: Julia Lawall, Al Viro
  Cc: Rodolfo C. Villordo, Forest Bond, Greg Kroah-Hartman,
	kernel-janitors, linux-kernel

On Mon, 2020-06-08 at 07:59 +0200, Julia Lawall wrote:
> On Mon, 8 Jun 2020, Al Viro wrote:
> 
> > On Sun, Jun 07, 2020 at 10:41:56PM +0000, Rodolfo C. Villordo wrote:
> > > Multiple line over 80 characters fixes by splitting in multiple lines.
> > > Warning found by checkpatch.pl
> > 
> > I doubt that checkpatch.pl can catch the real problems there:
> > 
> > * Hungarian Notation Sucks.  Really.
> > * so does CamelCase, especially for wonders like s_uGetRTSCTSRsvTime
> 
> Rodolfo,
> 
> If you work hard with Coccinelle and python scripting, it can help with
> the first two problems.

These VIA vt6655/vt6656 drivers have been in staging for more than
a decade.  There are relatively few checkpatch coding style
cleanups to do but there are many overall style issues to resolve.


It's true the identifier transforms could be done with Coccinelle,
but the problem is larger than identifier types and line lengths.

Hungarian renaming can't really be automated, it's basically a
sed problem where the new identifiers have to be chosen by someone
with specific device knowledge.

Look at vt6655/rf.c:

Lots of things should be reduced/replaced/simplified.
For instance, these repeated patterns exist:

	"(BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW"
	"(BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW"

There are 300+ uses just in this one file.

It's a lot of visual noise that should be minimized by using macros.
It would also reduce the number of checkpatch's long line warnings.

All the of unsigned char could be u8, unsigned short -> u16, etc.
Many arrays could be static const.

Nearly every function in the file could be improved.

For instance, this code could be written altogether:

bool RFbAL7230SelectChannelPostProcess(struct vnt_private *priv,
				       u16 byOldChannel,
				       u16 byNewChannel)
{
	bool ret;

	ret = true;

	/* if change between 11 b/g and 11a need to update the following
	 * register
	 * Channel Index 1~14
	 */
	if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G)) {
		/* Change from 2.4G to 5G [Reg] */
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[2]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[3]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[5]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[7]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[10]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[12]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[15]);
	} else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G)) {
		/* Change from 5G to 2.4G [Reg] */
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[2]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[3]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[5]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[7]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[10]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[12]);
		ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[15]);
	}

	return ret;
}

This could be something like: (written in email client, untested)

{
	unsigned long *table;
	static const int indices[] = {2, 3, 5, 7, 10, 12, 15};
	int i;
	bool ret = true;

	/* if changing between 11b/g and 11a, update the indices registers */

	if (byOldChannel <= CB_MAX_CHANNEL_24G && byNewChannel > CB_MAX_CHANNEL_24G)
		table = dwAL7230InitTableAMode;
	else if (byOldChannel > CB_MAX_CHANNEL_24G && byNewChannel <= CB_MAX_CHANNEL_24G)
		table = dwAL7230InitTable;
	else
		return ret;

	for (i = 0 ; i < ARRAY_SIZE(indices); i++)
		ret &= IFRFbWriteEmbedded(priv, table[indices[i]]);

	return ret;
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-08  8:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07 22:41 Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@drive Rodolfo C. Villordo
2020-06-08  5:15 ` Forest Bond <forest@alittletooquiet.net>,Greg Kroah-Hartman <gregkh@linuxfoundation.org>,devel@d Greg Kroah-Hartman
2020-06-08  5:46 ` Al Viro
2020-06-08  5:59   ` Julia Lawall
2020-06-08  8:41     ` Joe Perches
2020-06-08  7:26 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).