aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c16
2 files changed, 18 insertions, 16 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index c47a1e6333c..d6f0a72b7a0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -277,25 +277,13 @@ struct link {
};
/*
- * Clear all counters inside the link structure.
- */
-static inline void rt2x00_clear_link(struct link *link)
-{
- link->count = 0;
- memset(&link->qual, 0, sizeof(link->qual));
- link->qual.rx_percentage = 50;
- link->qual.tx_percentage = 50;
-}
-
-/*
* Update the rssi using the walking average approach.
*/
static inline void rt2x00_update_link_rssi(struct link *link, int rssi)
{
- if (!link->qual.avg_rssi)
- link->qual.avg_rssi = rssi;
- else
- link->qual.avg_rssi = ((link->qual.avg_rssi * 7) + rssi) / 8;
+ if (link->qual.avg_rssi)
+ rssi = ((link->qual.avg_rssi * 7) + rssi) / 8;
+ link->qual.avg_rssi = rssi;
}
/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index b2016f459d3..0f824b27f1e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -67,7 +67,21 @@ EXPORT_SYMBOL_GPL(rt2x00lib_get_ring);
*/
static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev)
{
- rt2x00_clear_link(&rt2x00dev->link);
+ rt2x00dev->link.count = 0;
+ rt2x00dev->link.vgc_level = 0;
+
+ memset(&rt2x00dev->link.qual, 0, sizeof(rt2x00dev->link.qual));
+
+ /*
+ * The RX and TX percentage should start at 50%
+ * this will assure we will get at least get some
+ * decent value when the link tuner starts.
+ * The value will be dropped and overwritten with
+ * the correct (measured )value anyway during the
+ * first run of the link tuner.
+ */
+ rt2x00dev->link.qual.rx_percentage = 50;
+ rt2x00dev->link.qual.tx_percentage = 50;
/*
* Reset the link tuner.