staging: vt6656: rxtx.c s:_uGetDataDuration simplify structure.
authorMalcolm Priestley <tvboxspy@gmail.com>
Tue, 13 Aug 2013 18:59:31 +0000 (19:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2013 21:42:59 +0000 (14:42 -0700)
A value is only returned when bNeedAck is true.

Only when byDurType == DATADUR_B is different.

Remove switch statement and simplify with if structure.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/rxtx.c

index c8e3e7e85cbec8e310c4b110259d9e9f4e179d14..a701120e6493805b31c9276574d59017f3ed9012 100644 (file)
@@ -389,47 +389,15 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType,
 {
        u32 uAckTime = 0;
 
-    switch (byDurType) {
-
-    case DATADUR_B:    //DATADUR_B
-            if (bNeedAck) {
-               uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    case DATADUR_A:    //DATADUR_A
-            if(bNeedAck){
-               uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    case DATADUR_A_F0:    //DATADUR_A_F0
-            if(bNeedAck){
-               uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    case DATADUR_A_F1:    //DATADUR_A_F1
-            if(bNeedAck){
-               uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
-                return (pDevice->uSIFS + uAckTime);
-            } else {
-                return 0;
-            }
-        break;
-
-    default:
-        break;
-    }
+       if (bNeedAck) {
+               if (byDurType == DATADUR_B)
+                       uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
+                               byPktType, 14, pDevice->byTopCCKBasicRate);
+               else
+                       uAckTime = BBuGetFrameTime(pDevice->byPreambleType,
+                               byPktType, 14, pDevice->byTopOFDMBasicRate);
+               return pDevice->uSIFS + uAckTime;
+       }
 
        return 0;
 }