linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Early return in s_uGetTxRsvTime
@ 2020-05-03 15:42 Matej Dujava
  2020-05-03 15:42 ` [PATCH v2 1/2] staging: vt6655: return early if not bNeedAck Matej Dujava
  2020-05-03 15:42 ` [PATCH v2 2/2] staging: vt6655: fix LONG_LINE warning Matej Dujava
  0 siblings, 2 replies; 3+ messages in thread
From: Matej Dujava @ 2020-05-03 15:42 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, devel, linux-kernel
  Cc: Stefano Brivio, Briana Oursler, Frank A. Cancio Bello, Matej Dujava

This patch set will fix checkpatch LONG_LINE warnings and will save us
one call of bb_get_frame_time in case od !bNeedAck.

Change history:
v2: Implemented advice of ternary operator from Joe Perches <joe@perches.com>

Matej Dujava (2):
  staging: vt6655: return early if not bNeedAck
  staging: vt6655: fix LONG_LINE warning

 drivers/staging/vt6655/rxtx.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

--
2.26.2


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

* [PATCH v2 1/2] staging: vt6655: return early if not bNeedAck
  2020-05-03 15:42 [PATCH v2 0/2] Early return in s_uGetTxRsvTime Matej Dujava
@ 2020-05-03 15:42 ` Matej Dujava
  2020-05-03 15:42 ` [PATCH v2 2/2] staging: vt6655: fix LONG_LINE warning Matej Dujava
  1 sibling, 0 replies; 3+ messages in thread
From: Matej Dujava @ 2020-05-03 15:42 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, devel, linux-kernel
  Cc: Stefano Brivio, Briana Oursler, Frank A. Cancio Bello, Matej Dujava

This patch will check for bNeedAck before making bb_get_frame_time call, so
in case we dont need uAckTime, we can return early.

Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
---
 drivers/staging/vt6655/rxtx.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 2f9c2ead3cb8..dda578436e64 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -166,15 +166,16 @@ s_uGetTxRsvTime(
 	unsigned int uDataTime, uAckTime;
 
 	uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, cbFrameLength, wRate);
+
+	if (!bNeedAck)
+		return uDataTime;
+
 	if (byPktType == PK_TYPE_11B) /* llb,CCK mode */
 		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
 	else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */
 		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
 
-	if (bNeedAck)
-		return uDataTime + pDevice->uSIFS + uAckTime;
-	else
-		return uDataTime;
+	return uDataTime + pDevice->uSIFS + uAckTime;
 }
 
 static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
-- 
2.26.2


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

* [PATCH v2 2/2] staging: vt6655: fix LONG_LINE warning
  2020-05-03 15:42 [PATCH v2 0/2] Early return in s_uGetTxRsvTime Matej Dujava
  2020-05-03 15:42 ` [PATCH v2 1/2] staging: vt6655: return early if not bNeedAck Matej Dujava
@ 2020-05-03 15:42 ` Matej Dujava
  1 sibling, 0 replies; 3+ messages in thread
From: Matej Dujava @ 2020-05-03 15:42 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman, devel, linux-kernel
  Cc: Stefano Brivio, Briana Oursler, Frank A. Cancio Bello, Matej Dujava

This patch will fix LONG_LINE error from checkpatch, by using ternary
operator.

Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
---
 drivers/staging/vt6655/rxtx.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index dda578436e64..994c19f1de43 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -170,10 +170,14 @@ s_uGetTxRsvTime(
 	if (!bNeedAck)
 		return uDataTime;
 
-	if (byPktType == PK_TYPE_11B) /* llb,CCK mode */
-		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
-	else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */
-		uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
+	/*
+	 * CCK mode  - 11b
+	 * OFDM mode - 11g 2.4G & 11a 5G
+	 */
+	uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14,
+				     byPktType == PK_TYPE_11B ?
+				     pDevice->byTopCCKBasicRate :
+				     pDevice->byTopOFDMBasicRate);
 
 	return uDataTime + pDevice->uSIFS + uAckTime;
 }
-- 
2.26.2


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

end of thread, other threads:[~2020-05-03 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03 15:42 [PATCH v2 0/2] Early return in s_uGetTxRsvTime Matej Dujava
2020-05-03 15:42 ` [PATCH v2 1/2] staging: vt6655: return early if not bNeedAck Matej Dujava
2020-05-03 15:42 ` [PATCH v2 2/2] staging: vt6655: fix LONG_LINE warning Matej Dujava

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).