diff options
author | Joerg Sommer <joerg@alea.gnuu.de> | 2007-03-02 13:32:06 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-03-07 22:13:50 -0500 |
commit | d632f9fa38203ad5bac31e46921812216693b14f (patch) | |
tree | 3689936f1b1be4ce3750809155cb5af95e7d7217 /drivers/net/wireless/bcm43xx | |
parent | 01a597769c7ef4db979c6a23aa97e5d2e53cbc46 (diff) |
[PATCH] bcm43xx: Fix bug in frequency to channel conversion
The frequency to channel routine in bcm43xx requires that the frequency
be in MHz, but that condition is not always met. This patch does the
necessary conversion.
Signed-off-by: Joerg Sommer <joerg@alea.gnuu.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_wx.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 7b665e2386a8..d6d9413d7f23 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -105,18 +105,24 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev, | |||
105 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 105 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
106 | unsigned long flags; | 106 | unsigned long flags; |
107 | u8 channel; | 107 | u8 channel; |
108 | s8 expon; | ||
108 | int freq; | 109 | int freq; |
109 | int err = -EINVAL; | 110 | int err = -EINVAL; |
110 | 111 | ||
111 | mutex_lock(&bcm->mutex); | 112 | mutex_lock(&bcm->mutex); |
112 | spin_lock_irqsave(&bcm->irq_lock, flags); | 113 | spin_lock_irqsave(&bcm->irq_lock, flags); |
113 | 114 | ||
114 | if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { | 115 | if ((data->freq.e == 0) && |
116 | (data->freq.m >= 0) && (data->freq.m <= 1000)) { | ||
115 | channel = data->freq.m; | 117 | channel = data->freq.m; |
116 | freq = bcm43xx_channel_to_freq(bcm, channel); | 118 | freq = bcm43xx_channel_to_freq(bcm, channel); |
117 | } else { | 119 | } else { |
118 | channel = bcm43xx_freq_to_channel(bcm, data->freq.m); | ||
119 | freq = data->freq.m; | 120 | freq = data->freq.m; |
121 | expon = 6 - data->freq.e; | ||
122 | while (--expon >= 0) /* scale down the frequency to MHz */ | ||
123 | freq /= 10; | ||
124 | assert(freq > 1000); | ||
125 | channel = bcm43xx_freq_to_channel(bcm, freq); | ||
120 | } | 126 | } |
121 | if (!ieee80211_is_valid_channel(bcm->ieee, channel)) | 127 | if (!ieee80211_is_valid_channel(bcm->ieee, channel)) |
122 | goto out_unlock; | 128 | goto out_unlock; |