Skip to contentSkip to conversation

staging: vt6656: rxtx.c s:_uGetDataDuration simplify structure

PATCH In review Malcolm Priestley 2 participants 2 messages Aug 7, 2013 – Aug 12, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 staging: vt6656: rxtx.c s:_uGetDataDuration simplify structure

A value is only returned when bNeedAck is true.

Only when byDurType == DATADUR_B is different.

Remove switch statement and simplify with if structure.

---
 drivers/staging/vt6656/rxtx.c | 50 ++++++++-----------------------------------
 1 file changed, 9 insertions(+), 41 deletions(-)
drivers/staging/vt6656/rxtx.c +9 -41
index 70a30d9..42f0823 100644
@@ -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);switch
-            } 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;
 }
Signature · 1 line
1.8.1.2
maintainer
#1 lore raw
Quoted 7 lines · Malcolm Priestley

A value is only returned when bNeedAck is true.

Only when byDurType == DATADUR_B is different.

Remove switch statement and simplify with if structure.

This one didn't apply due to other patches I didn't apply in your previous ones.

Can you redo all of these and resend them against my staging-next tree so that I can apply them?

thanks,

greg k-h