From e3b8577aa167ca5612b7723b6949dc888921ac8d Mon Sep 17 00:00:00 2001 From: Matej Dujava Date: Sun, 3 May 2020 15:29:12 +0200 Subject: [PATCH] staging: vt6655: extract index manupulation out of function call 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 Link: https://lore.kernel.org/r/1588512552-12297-6-git-send-email-mdujava@kocurkovo.cz Signed-off-by: Greg Kroah-Hartman --- 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;