staging: vt6655: return early if not bNeedAck
PATCH 1/2 staging: vt6655: return early if not bNeedAck
This patch will check for bNeedAck before making bb_get_frame_time call, so in case we dont need uAckTime, we can return early.
--- drivers/staging/vt6655/rxtx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/staging/vt6655/rxtx.c +5 -4
@@ -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,
Signature · 1 line
2.26.2
PATCH 2/2 staging: vt6655: fix LONG_LINE warning
This patch will fix LONG_LINE error from checkpatch, by createing temporary variable so call to the function is not in if/else block.
--- drivers/staging/vt6655/rxtx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/staging/vt6655/rxtx.c +12 -4
@@ -164,16 +164,24 @@ s_uGetTxRsvTime( ) {unsigned int uDataTime, uAckTime; +unsigned short basic_rate; 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); +/* +* CCK mode - 11b +* OFDM mode - 11g 2.4G & 11a 5G +*/ +if (byPktType ==PK_TYPE_11B ) + basic_rate = (unsigned short )pDevice->byTopCCKBasicRate; +else + basic_rate = (unsigned short )pDevice->byTopOFDMBasicRate; + + uAckTime =bb_get_frame_time (pDevice->byPreambleType, byPktType,14 , + basic_rate);return uDataTime + pDevice->uSIFS + uAckTime; }
Signature · 1 line
2.26.2
Re: [PATCH 2/2] staging: vt6655: fix LONG_LINE warning
Quoted 2 lines · Matej Dujava
This patch will fix
LONG_LINEerror from checkpatch, by createing temporary variable so call to the function is not in if/else block.
[]
drivers/staging/vt6655/rxtx.c
Quoted 1 line
drivers/staging/vt6655/rxtx.c +0
-0
[]
Quoted 19 lines
drivers/staging/vt6655/rxtx.c +5
-4@@ -164,16 +164,24 @@ s_uGetTxRsvTime( ) {unsigned int uDataTime, uAckTime; +unsigned short basic_rate; 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); +/* +* CCK mode - 11b +* OFDM mode - 11g 2.4G & 11a 5G +*/
drivers/staging/vt6655/rxtx.c s_uGetTxRsvTime( · line 187
Quoted 10 lines
drivers/staging/vt6655/rxtx.c +7
-0+if (byPktType ==PK_TYPE_11B ) + basic_rate = (unsigned short )pDevice->byTopCCKBasicRate; +else + basic_rate = (unsigned short )pDevice->byTopOFDMBasicRate; + + uAckTime =bb_get_frame_time (pDevice->byPreambleType, byPktType,14 , + basic_rate);return uDataTime + pDevice->uSIFS + uAckTime; }
perhaps simpler using a ?:
uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, byPktType == PK_TYPE_11B ? pDevice->byTopCCKBasicRate : pDevice->byTopOFDMBasicRate);
the casts aren't necessary either as both by... fields are u8
Re: [PATCH 2/2] staging: vt6655: fix LONG_LINE warning
Quoted 6 lines · Joe Perches
Quoted 2 lines · Matej Dujava
This patch will fix
LONG_LINEerror from checkpatch, by createing temporary variable so call to the function is not in if/else block.[]
drivers/staging/vt6655/rxtx.c
Quoted 1 line
drivers/staging/vt6655/rxtx.c +0
-0[]
Sorry, am I missing something here?
Quoted 32 lines
Quoted 19 lines
drivers/staging/vt6655/rxtx.c +5
-4@@ -164,16 +164,24 @@ s_uGetTxRsvTime( ) {unsigned int uDataTime, uAckTime; +unsigned short basic_rate; 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); +/* +* CCK mode - 11b +* OFDM mode - 11g 2.4G & 11a 5G +*/ drivers/staging/vt6655/rxtx.c s_uGetTxRsvTime( · line 187
Quoted 10 lines
drivers/staging/vt6655/rxtx.c +7
-0+if (byPktType ==PK_TYPE_11B ) + basic_rate = (unsigned short )pDevice->byTopCCKBasicRate; +else + basic_rate = (unsigned short )pDevice->byTopOFDMBasicRate; + + uAckTime =bb_get_frame_time (pDevice->byPreambleType, byPktType,14 , + basic_rate);return uDataTime + pDevice->uSIFS + uAckTime; }perhaps simpler using a ?:
Quoted 6 lines
uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, byPktType == PK_TYPE_11B ? pDevice->byTopCCKBasicRate : pDevice->byTopOFDMBasicRate);the casts aren't necessary either as both by... fields are u8
Thank you, will resend my patch.