aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43/debugfs.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 3aafde9f08a8..734e70e1a06d 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -223,15 +223,10 @@ out:
223static int txpower_g_write_file(struct b43_wldev *dev, 223static int txpower_g_write_file(struct b43_wldev *dev,
224 const char *buf, size_t count) 224 const char *buf, size_t count)
225{ 225{
226 unsigned long flags;
227 unsigned long phy_flags; 226 unsigned long phy_flags;
228 int err = 0;
229 227
230 spin_lock_irqsave(&dev->wl->irq_lock, flags); 228 if (dev->phy.type != B43_PHYTYPE_G)
231 if (dev->phy.type != B43_PHYTYPE_G) { 229 return -ENODEV;
232 err = -ENODEV;
233 goto out_unlock;
234 }
235 if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) { 230 if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) {
236 /* Automatic control */ 231 /* Automatic control */
237 dev->phy.manual_txpower_control = 0; 232 dev->phy.manual_txpower_control = 0;
@@ -240,10 +235,8 @@ static int txpower_g_write_file(struct b43_wldev *dev,
240 int bbatt = 0, rfatt = 0, txmix = 0, pa2db = 0, pa3db = 0; 235 int bbatt = 0, rfatt = 0, txmix = 0, pa2db = 0, pa3db = 0;
241 /* Manual control */ 236 /* Manual control */
242 if (sscanf(buf, "%d %d %d %d %d", &bbatt, &rfatt, 237 if (sscanf(buf, "%d %d %d %d %d", &bbatt, &rfatt,
243 &txmix, &pa2db, &pa3db) != 5) { 238 &txmix, &pa2db, &pa3db) != 5)
244 err = -EINVAL; 239 return -EINVAL;
245 goto out_unlock;
246 }
247 b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt); 240 b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt);
248 dev->phy.manual_txpower_control = 1; 241 dev->phy.manual_txpower_control = 1;
249 dev->phy.bbatt.att = bbatt; 242 dev->phy.bbatt.att = bbatt;
@@ -262,10 +255,8 @@ static int txpower_g_write_file(struct b43_wldev *dev,
262 b43_radio_unlock(dev); 255 b43_radio_unlock(dev);
263 b43_phy_unlock(dev, phy_flags); 256 b43_phy_unlock(dev, phy_flags);
264 } 257 }
265out_unlock:
266 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
267 258
268 return err; 259 return 0;
269} 260}
270 261
271/* wl->irq_lock is locked */ 262/* wl->irq_lock is locked */