aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00dev.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-02-25 17:15:01 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-28 09:13:09 -0500
commitb290d433618aa7122f6e6c4a62ddc79412a48d4d (patch)
tree2c24cf5ac226d7c15bca28e79ccd2c7139b7a03d /drivers/net/wireless/rt2x00/rt2x00dev.c
parent8bfb04756a698e38825656eab3bc339a321551b3 (diff)
rt2x00: Fix antenna diversity
Fix 2 issues in antenna diversity selection. 1) the following statement will always return true. if ((rssi_curr - rssi_old) > -5 || (rssi_curr - rssi_old) < 5) It is cleaner to check if the absolute value is smaller then 5. 2) Only enable software diversity when default antenna setup indicates support for it. Don't select it when the hardware does not indicate support for it... Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index c4be2ac4d7a4..00f5f0d49e1d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -293,7 +293,7 @@ static void rt2x00lib_evaluate_antenna_eval(struct rt2x00_dev *rt2x00dev)
293 * sample the rssi from the other antenna to make a valid 293 * sample the rssi from the other antenna to make a valid
294 * comparison between the 2 antennas. 294 * comparison between the 2 antennas.
295 */ 295 */
296 if ((rssi_curr - rssi_old) > -5 || (rssi_curr - rssi_old) < 5) 296 if (abs(rssi_curr - rssi_old) < 5)
297 return; 297 return;
298 298
299 rt2x00dev->link.ant.flags |= ANTENNA_MODE_SAMPLE; 299 rt2x00dev->link.ant.flags |= ANTENNA_MODE_SAMPLE;
@@ -319,10 +319,10 @@ static void rt2x00lib_evaluate_antenna(struct rt2x00_dev *rt2x00dev)
319 rt2x00dev->link.ant.flags &= ~ANTENNA_TX_DIVERSITY; 319 rt2x00dev->link.ant.flags &= ~ANTENNA_TX_DIVERSITY;
320 320
321 if (rt2x00dev->hw->conf.antenna_sel_rx == 0 && 321 if (rt2x00dev->hw->conf.antenna_sel_rx == 0 &&
322 rt2x00dev->default_ant.rx != ANTENNA_SW_DIVERSITY) 322 rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
323 rt2x00dev->link.ant.flags |= ANTENNA_RX_DIVERSITY; 323 rt2x00dev->link.ant.flags |= ANTENNA_RX_DIVERSITY;
324 if (rt2x00dev->hw->conf.antenna_sel_tx == 0 && 324 if (rt2x00dev->hw->conf.antenna_sel_tx == 0 &&
325 rt2x00dev->default_ant.tx != ANTENNA_SW_DIVERSITY) 325 rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
326 rt2x00dev->link.ant.flags |= ANTENNA_TX_DIVERSITY; 326 rt2x00dev->link.ant.flags |= ANTENNA_TX_DIVERSITY;
327 327
328 if (!(rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) && 328 if (!(rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) &&