diff options
author | Briana Oursler <briana.oursler@gmail.com> | 2020-04-01 21:03:40 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-13 09:55:26 +0300 |
commit | e781fd1b33010bcec66607c16fb38710267081ce (patch) | |
tree | db85421322ef8abec25872a9f2ad3a0953a6d43f /drivers/staging/vt6655 | |
parent | 5b0578364fb875366de08686593f9fc6ce2ce564 (diff) | |
download | linux-e781fd1b33010bcec66607c16fb38710267081ce.tar.xz |
Staging: vt6655: Move rate determination logic.
Factor rate setting logic out of nested if-else statement to prevent
code duplication.
Signed-off-by: Briana Oursler <briana.oursler@gmail.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://lore.kernel.org/r/ba87af8a2d28d5737c6d8888bbda143aad723d2c.1585763457.git.briana.oursler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6655')
-rw-r--r-- | drivers/staging/vt6655/rxtx.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 30777d6368ba..a49d8c38a4bd 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -298,23 +298,18 @@ s_uGetDataDuration( return 0; } } else { /* First Frag or Mid Frag */ - if (byFBOption == AUTO_FB_0) { - if (wRate < RATE_18M) - wRate = RATE_18M; - else if (wRate > RATE_54M) - wRate = RATE_54M; + if (wRate < RATE_18M) + wRate = RATE_18M; + else if (wRate > RATE_54M) + wRate = RATE_54M; + if (byFBOption == AUTO_FB_0) { if (uFragIdx == (uMACfragNum - 2)) uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); else uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck); } else { /* (byFBOption == AUTO_FB_1) */ - if (wRate < RATE_18M) - wRate = RATE_18M; - else if (wRate > RATE_54M) - wRate = RATE_54M; - if (uFragIdx == (uMACfragNum - 2)) uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck); else @@ -336,23 +331,18 @@ s_uGetDataDuration( return 0; } } else { /* First Frag or Mid Frag */ - if (byFBOption == AUTO_FB_0) { - if (wRate < RATE_18M) - wRate = RATE_18M; - else if (wRate > RATE_54M) - wRate = RATE_54M; + if (wRate < RATE_18M) + wRate = RATE_18M; + else if (wRate > RATE_54M) + wRate = RATE_54M; + if (byFBOption == AUTO_FB_0) { if (uFragIdx == (uMACfragNum - 2)) uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); else uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck); } else { /* (byFBOption == AUTO_FB_1) */ - if (wRate < RATE_18M) - wRate = RATE_18M; - else if (wRate > RATE_54M) - wRate = RATE_54M; - if (uFragIdx == (uMACfragNum - 2)) uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck); else |