diff options
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c index b438f48e891d..6a23bdc75412 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | |||
@@ -120,12 +120,12 @@ static ssize_t bcm43xx_attr_sprom_show(struct device *dev, | |||
120 | GFP_KERNEL); | 120 | GFP_KERNEL); |
121 | if (!sprom) | 121 | if (!sprom) |
122 | return -ENOMEM; | 122 | return -ENOMEM; |
123 | bcm43xx_lock_mmio(bcm, flags); | 123 | bcm43xx_lock_irqsafe(bcm, flags); |
124 | assert(bcm->initialized); | ||
125 | err = bcm43xx_sprom_read(bcm, sprom); | 124 | err = bcm43xx_sprom_read(bcm, sprom); |
126 | if (!err) | 125 | if (!err) |
127 | err = sprom2hex(sprom, buf, PAGE_SIZE); | 126 | err = sprom2hex(sprom, buf, PAGE_SIZE); |
128 | bcm43xx_unlock_mmio(bcm, flags); | 127 | mmiowb(); |
128 | bcm43xx_unlock_irqsafe(bcm, flags); | ||
129 | kfree(sprom); | 129 | kfree(sprom); |
130 | 130 | ||
131 | return err; | 131 | return err; |
@@ -150,10 +150,10 @@ static ssize_t bcm43xx_attr_sprom_store(struct device *dev, | |||
150 | err = hex2sprom(sprom, buf, count); | 150 | err = hex2sprom(sprom, buf, count); |
151 | if (err) | 151 | if (err) |
152 | goto out_kfree; | 152 | goto out_kfree; |
153 | bcm43xx_lock_mmio(bcm, flags); | 153 | bcm43xx_lock_irqsafe(bcm, flags); |
154 | assert(bcm->initialized); | ||
155 | err = bcm43xx_sprom_write(bcm, sprom); | 154 | err = bcm43xx_sprom_write(bcm, sprom); |
156 | bcm43xx_unlock_mmio(bcm, flags); | 155 | mmiowb(); |
156 | bcm43xx_unlock_irqsafe(bcm, flags); | ||
157 | out_kfree: | 157 | out_kfree: |
158 | kfree(sprom); | 158 | kfree(sprom); |
159 | 159 | ||
@@ -170,15 +170,13 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
170 | char *buf) | 170 | char *buf) |
171 | { | 171 | { |
172 | struct bcm43xx_private *bcm = dev_to_bcm(dev); | 172 | struct bcm43xx_private *bcm = dev_to_bcm(dev); |
173 | unsigned long flags; | ||
174 | int err; | 173 | int err; |
175 | ssize_t count = 0; | 174 | ssize_t count = 0; |
176 | 175 | ||
177 | if (!capable(CAP_NET_ADMIN)) | 176 | if (!capable(CAP_NET_ADMIN)) |
178 | return -EPERM; | 177 | return -EPERM; |
179 | 178 | ||
180 | bcm43xx_lock(bcm, flags); | 179 | bcm43xx_lock_noirq(bcm); |
181 | assert(bcm->initialized); | ||
182 | 180 | ||
183 | switch (bcm43xx_current_radio(bcm)->interfmode) { | 181 | switch (bcm43xx_current_radio(bcm)->interfmode) { |
184 | case BCM43xx_RADIO_INTERFMODE_NONE: | 182 | case BCM43xx_RADIO_INTERFMODE_NONE: |
@@ -195,7 +193,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
195 | } | 193 | } |
196 | err = 0; | 194 | err = 0; |
197 | 195 | ||
198 | bcm43xx_unlock(bcm, flags); | 196 | bcm43xx_unlock_noirq(bcm); |
199 | 197 | ||
200 | return err ? err : count; | 198 | return err ? err : count; |
201 | 199 | ||
@@ -231,16 +229,15 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev, | |||
231 | return -EINVAL; | 229 | return -EINVAL; |
232 | } | 230 | } |
233 | 231 | ||
234 | bcm43xx_lock_mmio(bcm, flags); | 232 | bcm43xx_lock_irqsafe(bcm, flags); |
235 | assert(bcm->initialized); | ||
236 | 233 | ||
237 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); | 234 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); |
238 | if (err) { | 235 | if (err) { |
239 | printk(KERN_ERR PFX "Interference Mitigation not " | 236 | printk(KERN_ERR PFX "Interference Mitigation not " |
240 | "supported by device\n"); | 237 | "supported by device\n"); |
241 | } | 238 | } |
242 | 239 | mmiowb(); | |
243 | bcm43xx_unlock_mmio(bcm, flags); | 240 | bcm43xx_unlock_irqsafe(bcm, flags); |
244 | 241 | ||
245 | return err ? err : count; | 242 | return err ? err : count; |
246 | } | 243 | } |
@@ -254,15 +251,13 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, | |||
254 | char *buf) | 251 | char *buf) |
255 | { | 252 | { |
256 | struct bcm43xx_private *bcm = dev_to_bcm(dev); | 253 | struct bcm43xx_private *bcm = dev_to_bcm(dev); |
257 | unsigned long flags; | ||
258 | int err; | 254 | int err; |
259 | ssize_t count; | 255 | ssize_t count; |
260 | 256 | ||
261 | if (!capable(CAP_NET_ADMIN)) | 257 | if (!capable(CAP_NET_ADMIN)) |
262 | return -EPERM; | 258 | return -EPERM; |
263 | 259 | ||
264 | bcm43xx_lock(bcm, flags); | 260 | bcm43xx_lock_noirq(bcm); |
265 | assert(bcm->initialized); | ||
266 | 261 | ||
267 | if (bcm->short_preamble) | 262 | if (bcm->short_preamble) |
268 | count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); | 263 | count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); |
@@ -270,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, | |||
270 | count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); | 265 | count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); |
271 | 266 | ||
272 | err = 0; | 267 | err = 0; |
273 | bcm43xx_unlock(bcm, flags); | 268 | bcm43xx_unlock_noirq(bcm); |
274 | 269 | ||
275 | return err ? err : count; | 270 | return err ? err : count; |
276 | } | 271 | } |
@@ -290,13 +285,12 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev, | |||
290 | value = get_boolean(buf, count); | 285 | value = get_boolean(buf, count); |
291 | if (value < 0) | 286 | if (value < 0) |
292 | return value; | 287 | return value; |
293 | bcm43xx_lock(bcm, flags); | 288 | bcm43xx_lock_irqsafe(bcm, flags); |
294 | assert(bcm->initialized); | ||
295 | 289 | ||
296 | bcm->short_preamble = !!value; | 290 | bcm->short_preamble = !!value; |
297 | 291 | ||
298 | err = 0; | 292 | err = 0; |
299 | bcm43xx_unlock(bcm, flags); | 293 | bcm43xx_unlock_irqsafe(bcm, flags); |
300 | 294 | ||
301 | return err ? err : count; | 295 | return err ? err : count; |
302 | } | 296 | } |
@@ -310,7 +304,7 @@ int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) | |||
310 | struct device *dev = &bcm->pci_dev->dev; | 304 | struct device *dev = &bcm->pci_dev->dev; |
311 | int err; | 305 | int err; |
312 | 306 | ||
313 | assert(bcm->initialized); | 307 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); |
314 | 308 | ||
315 | err = device_create_file(dev, &dev_attr_sprom); | 309 | err = device_create_file(dev, &dev_attr_sprom); |
316 | if (err) | 310 | if (err) |