Commit 8de8c516 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by David S. Miller

[PATCH] rt2x00: Remove rt2x00_clear_link

rt2x00_clear_link() was becoming too large for statically inline,
also it was used on a single location and shouldn't really be
used anywhere else. So move the entire code into the function
rt2x00lib_start_link_tuner()
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39e75857
...@@ -276,26 +276,14 @@ struct link { ...@@ -276,26 +276,14 @@ struct link {
struct delayed_work work; struct delayed_work work;
}; };
/*
* 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. * Update the rssi using the walking average approach.
*/ */
static inline void rt2x00_update_link_rssi(struct link *link, int rssi) static inline void rt2x00_update_link_rssi(struct link *link, int rssi)
{ {
if (!link->qual.avg_rssi) if (link->qual.avg_rssi)
link->qual.avg_rssi = rssi; rssi = ((link->qual.avg_rssi * 7) + rssi) / 8;
else link->qual.avg_rssi = rssi;
link->qual.avg_rssi = ((link->qual.avg_rssi * 7) + rssi) / 8;
} }
/* /*
......
...@@ -67,7 +67,21 @@ EXPORT_SYMBOL_GPL(rt2x00lib_get_ring); ...@@ -67,7 +67,21 @@ EXPORT_SYMBOL_GPL(rt2x00lib_get_ring);
*/ */
static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev) 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. * Reset the link tuner.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment