[PATCH 5/5] staging: vt6655: extract index manupulation out of function call

From: Matej Dujava
Date: Sun May 03 2020 - 09:29:46 EST


This patch will remove if/else by selecting proper argument before
function call, also index is updated before function call.

Signed-off-by: Matej Dujava <mdujava@xxxxxxxxxxxx>
---
drivers/staging/vt6655/rxtx.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index c4d62c27f1c1..1e025bb72810 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -266,7 +266,8 @@ s_uGetDataDuration(
return 0;
} else {
/* First Frag or Mid Frag */
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len, wRate, bNeedAck);
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
+ len, wRate, bNeedAck);
}

return pDevice->uSIFS + uAckTime + uNextPktTime;
@@ -283,8 +284,8 @@ s_uGetDataDuration(
return 0;
} else {
/* First Frag or Mid Frag */
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len,
- wRate, bNeedAck);
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
+ len, wRate, bNeedAck);
}

return pDevice->uSIFS + uAckTime + uNextPktTime;
@@ -307,17 +308,15 @@ s_uGetDataDuration(
else if (wRate > RATE_54M)
wRate = RATE_54M;

- if (byFBOption == AUTO_FB_0) {
- uNextPktTime = s_uGetTxRsvTime(pDevice,
- byPktType, len,
- wFB_Opt0[FB_RATE0][wRate - RATE_18M],
- bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice,
- byPktType, len,
- wFB_Opt1[FB_RATE0][wRate - RATE_18M],
- bNeedAck);
- }
+ wRate -= RATE_18M;
+
+ if (byFBOption == AUTO_FB_0)
+ wRate = wFB_Opt0[FB_RATE0][wRate];
+ else
+ wRate = wFB_Opt1[FB_RATE0][wRate];
+
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
+ len, wRate, bNeedAck);
}

return pDevice->uSIFS + uAckTime + uNextPktTime;
--
2.26.2