dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
Ivo van Doorn 2008-02-25 23:15:01 +01:00 committed by John W. Linville
parent 8bfb04756a
commit b290d43361
1 changed files with 3 additions and 3 deletions

View File

@ -293,7 +293,7 @@ static void rt2x00lib_evaluate_antenna_eval(struct rt2x00_dev *rt2x00dev)
* sample the rssi from the other antenna to make a valid
* comparison between the 2 antennas.
*/
if ((rssi_curr - rssi_old) > -5 || (rssi_curr - rssi_old) < 5)
if (abs(rssi_curr - rssi_old) < 5)
return;
rt2x00dev->link.ant.flags |= ANTENNA_MODE_SAMPLE;
@ -319,10 +319,10 @@ static void rt2x00lib_evaluate_antenna(struct rt2x00_dev *rt2x00dev)
rt2x00dev->link.ant.flags &= ~ANTENNA_TX_DIVERSITY;
if (rt2x00dev->hw->conf.antenna_sel_rx == 0 &&
rt2x00dev->default_ant.rx != ANTENNA_SW_DIVERSITY)
rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
rt2x00dev->link.ant.flags |= ANTENNA_RX_DIVERSITY;
if (rt2x00dev->hw->conf.antenna_sel_tx == 0 &&
rt2x00dev->default_ant.tx != ANTENNA_SW_DIVERSITY)
rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
rt2x00dev->link.ant.flags |= ANTENNA_TX_DIVERSITY;
if (!(rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) &&