aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
diff options
context:
space:
mode:
authorMichael Buesch <mbuesch@freenet.de>2006-02-19 22:08:48 +0100
committerJohn W. Linville <linville@tuxdriver.com>2006-03-27 11:18:37 -0500
commit10d8dd88dcc2c8ebe8ac7dcf75a2da7c9f9ee0f3 (patch)
tree36a2d439a39f182ee80788fcec58ac3f7b6b7f55 /drivers/net/wireless/bcm43xx/bcm43xx_wx.c
parentad3f086c49aa682e493c935cda76f3850ee4a80e (diff)
[PATCH] bcm43xx: split the channel helper functions, so that they can be used without a valid running core.
Signed-off-by: Michael Buesch <mbuesch@freenet.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_wx.c')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index df37d28996c..aa2d9930c43 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -111,8 +111,9 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
unsigned long flags;
u8 channel;
int freq;
- int err = 0;
+ int err = -EINVAL;
+ spin_lock_irqsave(&bcm->lock, flags);
if ((data->freq.m >= 0) && (data->freq.m <= 1000)) {
channel = data->freq.m;
freq = bcm43xx_channel_to_freq(bcm, channel);
@@ -121,16 +122,17 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
freq = data->freq.m;
}
if (!bcm43xx_is_valid_channel(bcm, channel))
- return -EINVAL;
-
- spin_lock_irqsave(&bcm->lock, flags);
+ goto out_unlock;
if (bcm->initialized) {
//ieee80211softmac_disassoc(softmac, $REASON);
bcm43xx_mac_suspend(bcm);
err = bcm43xx_radio_selectchannel(bcm, channel, 0);
bcm43xx_mac_enable(bcm);
- } else
+ } else {
bcm->current_core->radio->initial_channel = channel;
+ err = 0;
+ }
+out_unlock:
spin_unlock_irqrestore(&bcm->lock, flags);
return err;