aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorForrest Zhang <forrest@hifulltech.com>2009-05-13 11:14:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-20 14:07:51 -0400
commita54be5d43aa2d6febc5a4f8dd3b87b9429b60437 (patch)
tree5488ef943dbf8816910f0df3703e842a2a541f4e /drivers/net
parent88f16db7a2fa63b9242e8a0fbc40d51722f2e2f9 (diff)
ath5k: fix exp off-by-one when computing OFDM delta slope
Commit e8f055f0c3b ("ath5k: Update reset code") subtly changed the code that computes floating point values for the PHY3_TIMING register such that the exponent is off by a decimal point, which can cause problems with OFDM channel operation. get_bitmask_order() actually returns the highest bit set plus one, whereas the previous code wanted the highest bit set. Instead, use ilog2 which is what this code is really calculating. Also check coef_scaled to handle the (invalid) case where we need log2(0). Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath5k/reset.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c
index faede828c8ff..5f72c111c2e8 100644
--- a/drivers/net/wireless/ath5k/reset.c
+++ b/drivers/net/wireless/ath5k/reset.c
@@ -26,7 +26,7 @@
26\*****************************/ 26\*****************************/
27 27
28#include <linux/pci.h> /* To determine if a card is pci-e */ 28#include <linux/pci.h> /* To determine if a card is pci-e */
29#include <linux/bitops.h> /* For get_bitmask_order */ 29#include <linux/log2.h>
30#include "ath5k.h" 30#include "ath5k.h"
31#include "reg.h" 31#include "reg.h"
32#include "base.h" 32#include "base.h"
@@ -69,10 +69,10 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
69 69
70 /* Get exponent 70 /* Get exponent
71 * ALGO: coef_exp = 14 - highest set bit position */ 71 * ALGO: coef_exp = 14 - highest set bit position */
72 coef_exp = get_bitmask_order(coef_scaled); 72 coef_exp = ilog2(coef_scaled);
73 73
74 /* Doesn't make sense if it's zero*/ 74 /* Doesn't make sense if it's zero*/
75 if (!coef_exp) 75 if (!coef_scaled || !coef_exp)
76 return -EINVAL; 76 return -EINVAL;
77 77
78 /* Note: we've shifted coef_scaled by 24 */ 78 /* Note: we've shifted coef_scaled by 24 */