mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Axel Rasmussen <axel.rasmussen1@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Subject: [PATCH 2/9] drivers: staging: rtl8187se: refactor/clean signal smoothing
Date: Sat,  1 Mar 2014 22:22:46 -0700	[thread overview]
Message-ID: <1393737773-13937-3-git-send-email-axel.rasmussen1@gmail.com> (raw)
In-Reply-To: <1393737773-13937-1-git-send-email-axel.rasmussen1@gmail.com>

Signed-off-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
---
 drivers/staging/rtl8187se/r8180.h      |  2 +-
 drivers/staging/rtl8187se/r8180_core.c | 29 ++++++++++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h
index f81e6b5..5ac4673 100644
--- a/drivers/staging/rtl8187se/r8180.h
+++ b/drivers/staging/rtl8187se/r8180.h
@@ -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;
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index e5f8a56..67c2583 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -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);
-- 
1.8.3.2


  parent reply	other threads:[~2014-03-02  5:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02  5:22 [PATCH 0/9] drivers: staging: rtl8187se: various code cleanups Axel Rasmussen
2014-03-02  5:22 ` [PATCH 1/9] drivers: staging: rtl8187se: use netdev_* instead of prink Axel Rasmussen
2014-03-02  5:22 ` Axel Rasmussen [this message]
2014-03-02  5:22 ` [PATCH 3/9] drivers: staging: rtl8187se: wrap excessively long lines Axel Rasmussen
2014-03-03  8:58   ` Dan Carpenter
2014-03-02  5:22 ` [PATCH 4/9] " Axel Rasmussen
2014-03-03  9:02   ` Dan Carpenter
2014-03-02  5:22 ` [PATCH 5/9] " Axel Rasmussen
2014-03-02  5:22 ` [PATCH 6/9] drivers: staging: rtl8187se: fixed broken indentation Axel Rasmussen
2014-03-02  5:22 ` [PATCH 7/9] drivers: staging: rtl8187se: fixed checkpatch.pl errors Axel Rasmussen
2014-03-02  5:36   ` Joe Perches
2014-03-02 20:19     ` axel.rasmussen1
2014-03-02  5:22 ` [PATCH 8/9] drivers: staging: rtl8187se: wrap excessively long lines Axel Rasmussen
2014-03-02  5:22 ` [PATCH 9/9] drivers: staging: rtl8187se: refactor wmm_param_update Axel Rasmussen
2014-03-03  9:15   ` Dan Carpenter
2014-03-04  7:12 ` [PATCH v2 0/9] drivers: staging: rtl8187se: various code cleanups Axel Rasmussen
2014-03-04  9:51   ` Dan Carpenter
2014-03-04  7:12 ` [PATCH v2 1/9] drivers: staging: rtl8187se: use netdev_* instead of prink Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 2/9] drivers: staging: rtl8187se: refactor/clean signal smoothing Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 3/9] drivers: staging: rtl8187se: wrap excessively long lines Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 4/9] " Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 5/9] " Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 6/9] drivers: staging: rtl8187se: fixed broken indentation Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 7/9] drivers: staging: rtl8187se: fixed checkpatch.pl errors Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 8/9] drivers: staging: rtl8187se: wrap excessively long lines Axel Rasmussen
2014-03-04  7:12 ` [PATCH v2 9/9] drivers: staging: rtl8187se: refactor wmm_param_update Axel Rasmussen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393737773-13937-3-git-send-email-axel.rasmussen1@gmail.com \
    --to=axel.rasmussen1@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®