]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drivers: staging: rtl8187se: refactor/clean signal smoothing
authorAxel Rasmussen <axel.rasmussen1@gmail.com>
Tue, 4 Mar 2014 07:12:50 +0000 (00:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Mar 2014 01:12:01 +0000 (17:12 -0800)
Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8187se/r8180.h
drivers/staging/rtl8187se/r8180_core.c

index f81e6b51d277ca03a7640e82b4d95212e3611711..5ac46737157a76654cd34f4be21f99f5b4003c8b 100644 (file)
@@ -586,7 +586,7 @@ typedef struct r8180_priv {
        /* High Power Mechanism. Added by amy, 080312. */
        bool bToUpdateTxPwr;
        long UndecoratedSmoothedSS;
-       long UndercorateSmoothedRxPower;
+       long UndecoratedSmoothedRxPower;
        u8 RSSI;
        char RxPower;
        u8 InitialGain;
index e5f8a560a15ccaa13addcb0c3f417e5b7c3929c0..67c2583806cfa8c5b9d5e53a8e156b3816ded480 100644 (file)
@@ -1143,23 +1143,30 @@ static long TranslateToDbm8185(u8 SignalStrengthIndex)
 /*
  * Perform signal smoothing for dynamic mechanism.
  * This is different with PerformSignalSmoothing8185 in smoothing formula.
- * No dramatic adjustion is apply because dynamic mechanism need some degree
- * of correctness. Ported from 8187B.
+ * No dramatic adjustment is applied because dynamic mechanism need some
+ * degree of correctness. Ported from 8187B.
  */
 static void PerformUndecoratedSignalSmoothing8185(struct r8180_priv *priv,
                                                  bool bCckRate)
 {
-       /* Determin the current packet is CCK rate. */
+       long smoothedSS;
+       long smoothedRx;
+
+       /* Determine the current packet is CCK rate. */
        priv->bCurCCKPkt = bCckRate;
 
+       smoothedSS = priv->SignalStrength * 10;
+
        if (priv->UndecoratedSmoothedSS >= 0)
-               priv->UndecoratedSmoothedSS = ((priv->UndecoratedSmoothedSS * 5) +
-                                              (priv->SignalStrength * 10)) / 6;
-       else
-               priv->UndecoratedSmoothedSS = priv->SignalStrength * 10;
+               smoothedSS = ((priv->UndecoratedSmoothedSS * 5) +
+                               smoothedSS) / 6;
+
+       priv->UndecoratedSmoothedSS = smoothedSS;
+
+       smoothedRx = ((priv->UndecoratedSmoothedRxPower * 50) +
+                       (priv->RxPower * 11)) / 60;
 
-       priv->UndercorateSmoothedRxPower = ((priv->UndercorateSmoothedRxPower * 50) +
-                                           (priv->RxPower * 11)) / 60;
+       priv->UndecoratedSmoothedRxPower = smoothedRx;
 
        if (bCckRate)
                priv->CurCCKRSSI = priv->RSSI;
@@ -1399,8 +1406,8 @@ static void rtl8180_rx(struct net_device *dev)
 
                        /* For good-looking singal strength. */
                        SignalStrengthIndex = NetgearSignalStrengthTranslate(
-                                                       priv->LastSignalStrengthInPercent,
-                                                       priv->SignalStrength);
+                               priv->LastSignalStrengthInPercent,
+                               priv->SignalStrength);
 
                        priv->LastSignalStrengthInPercent = SignalStrengthIndex;
                        priv->Stats_SignalStrength = TranslateToDbm8185((u8)SignalStrengthIndex);