diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index a49d8c38a4bd..72bb49c064c7 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -243,11 +243,16 @@ s_uGetDataDuration( ) { bool bLastFrag = false; - unsigned int uAckTime = 0, uNextPktTime = 0; + unsigned int uAckTime = 0, uNextPktTime = 0, len; if (uFragIdx == (uMACfragNum - 1)) bLastFrag = true; + if (uFragIdx == (uMACfragNum - 2)) + len = cbLastFragmentSize; + else + len = cbFrameLength; + switch (byDurType) { case DATADUR_B: /* DATADUR_B */ if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */ @@ -258,10 +263,7 @@ s_uGetDataDuration( return 0; } } else {/* First Frag or Mid Frag */ - if (uFragIdx == (uMACfragNum - 2)) - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck); - else - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); + uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len, wRate, bNeedAck); if (bNeedAck) uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); @@ -278,10 +280,7 @@ s_uGetDataDuration( return 0; } } else {/* First Frag or Mid Frag */ - if (uFragIdx == (uMACfragNum - 2)) - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck); - else - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck); + uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, len, wRate, bNeedAck); if (bNeedAck) uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); @@ -304,16 +303,9 @@ s_uGetDataDuration( 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 (uFragIdx == (uMACfragNum - 2)) - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck); - else - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck); + 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); } if (bNeedAck) @@ -337,16 +329,9 @@ s_uGetDataDuration( 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 (uFragIdx == (uMACfragNum - 2)) - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck); - else - uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck); + 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); } if (bNeedAck)