diff options
author | Michael Buesch <mb@bu3sch.de> | 2006-06-27 15:38:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-07-10 14:19:41 -0400 |
commit | efa6a370216f1816456b49aac03295071720f7eb (patch) | |
tree | a29c205e603d96ad3b4ef34b274335a851672aac /drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | |
parent | b312d799b324e895745ffe148def234fc60d5b74 (diff) |
[PATCH] bcm43xx: opencoded locking
As many people don't seem to like the locking "obfuscation"
in the bcm43xx driver, this patch removes it.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c index 6a23bdc75412..cc1ff3c6f140 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | |||
@@ -120,12 +120,14 @@ 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_irqsafe(bcm, flags); | 123 | mutex_lock(&bcm->mutex); |
124 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
124 | err = bcm43xx_sprom_read(bcm, sprom); | 125 | err = bcm43xx_sprom_read(bcm, sprom); |
125 | if (!err) | 126 | if (!err) |
126 | err = sprom2hex(sprom, buf, PAGE_SIZE); | 127 | err = sprom2hex(sprom, buf, PAGE_SIZE); |
127 | mmiowb(); | 128 | mmiowb(); |
128 | bcm43xx_unlock_irqsafe(bcm, flags); | 129 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
130 | mutex_unlock(&bcm->mutex); | ||
129 | kfree(sprom); | 131 | kfree(sprom); |
130 | 132 | ||
131 | return err; | 133 | return err; |
@@ -150,10 +152,14 @@ static ssize_t bcm43xx_attr_sprom_store(struct device *dev, | |||
150 | err = hex2sprom(sprom, buf, count); | 152 | err = hex2sprom(sprom, buf, count); |
151 | if (err) | 153 | if (err) |
152 | goto out_kfree; | 154 | goto out_kfree; |
153 | bcm43xx_lock_irqsafe(bcm, flags); | 155 | mutex_lock(&bcm->mutex); |
156 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
157 | spin_lock(&bcm->leds_lock); | ||
154 | err = bcm43xx_sprom_write(bcm, sprom); | 158 | err = bcm43xx_sprom_write(bcm, sprom); |
155 | mmiowb(); | 159 | mmiowb(); |
156 | bcm43xx_unlock_irqsafe(bcm, flags); | 160 | spin_unlock(&bcm->leds_lock); |
161 | spin_unlock_irqrestore(&bcm->irq_lock, flags); | ||
162 | mutex_unlock(&bcm->mutex); | ||
157 | out_kfree: | 163 | out_kfree: |
158 | kfree(sprom); | 164 | kfree(sprom); |
159 | 165 | ||
@@ -176,7 +182,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
176 | if (!capable(CAP_NET_ADMIN)) | 182 | if (!capable(CAP_NET_ADMIN)) |
177 | return -EPERM; | 183 | return -EPERM; |
178 | 184 | ||
179 | bcm43xx_lock_noirq(bcm); | 185 | mutex_lock(&bcm->mutex); |
180 | 186 | ||
181 | switch (bcm43xx_current_radio(bcm)->interfmode) { | 187 | switch (bcm43xx_current_radio(bcm)->interfmode) { |
182 | case BCM43xx_RADIO_INTERFMODE_NONE: | 188 | case BCM43xx_RADIO_INTERFMODE_NONE: |
@@ -193,7 +199,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
193 | } | 199 | } |
194 | err = 0; | 200 | err = 0; |
195 | 201 | ||
196 | bcm43xx_unlock_noirq(bcm); | 202 | mutex_unlock(&bcm->mutex); |
197 | 203 | ||
198 | return err ? err : count; | 204 | return err ? err : count; |
199 | 205 | ||
@@ -229,7 +235,8 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev, | |||
229 | return -EINVAL; | 235 | return -EINVAL; |
230 | } | 236 | } |
231 | 237 | ||
232 | bcm43xx_lock_irqsafe(bcm, flags); | 238 | mutex_lock(&bcm->mutex); |
239 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
233 | 240 | ||
234 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); | 241 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); |
235 | if (err) { | 242 | if (err) { |
@@ -237,7 +244,8 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev, | |||
237 | "supported by device\n"); | 244 | "supported by device\n"); |
238 | } | 245 | } |
239 | mmiowb(); | 246 | mmiowb(); |
240 | bcm43xx_unlock_irqsafe(bcm, flags); | 247 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
248 | mutex_unlock(&bcm->mutex); | ||
241 | 249 | ||
242 | return err ? err : count; | 250 | return err ? err : count; |
243 | } | 251 | } |
@@ -257,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, | |||
257 | if (!capable(CAP_NET_ADMIN)) | 265 | if (!capable(CAP_NET_ADMIN)) |
258 | return -EPERM; | 266 | return -EPERM; |
259 | 267 | ||
260 | bcm43xx_lock_noirq(bcm); | 268 | mutex_lock(&bcm->mutex); |
261 | 269 | ||
262 | if (bcm->short_preamble) | 270 | if (bcm->short_preamble) |
263 | count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); | 271 | count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); |
@@ -265,7 +273,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, | |||
265 | count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); | 273 | count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); |
266 | 274 | ||
267 | err = 0; | 275 | err = 0; |
268 | bcm43xx_unlock_noirq(bcm); | 276 | mutex_unlock(&bcm->mutex); |
269 | 277 | ||
270 | return err ? err : count; | 278 | return err ? err : count; |
271 | } | 279 | } |
@@ -285,12 +293,14 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev, | |||
285 | value = get_boolean(buf, count); | 293 | value = get_boolean(buf, count); |
286 | if (value < 0) | 294 | if (value < 0) |
287 | return value; | 295 | return value; |
288 | bcm43xx_lock_irqsafe(bcm, flags); | 296 | mutex_lock(&bcm->mutex); |
297 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
289 | 298 | ||
290 | bcm->short_preamble = !!value; | 299 | bcm->short_preamble = !!value; |
291 | 300 | ||
292 | err = 0; | 301 | err = 0; |
293 | bcm43xx_unlock_irqsafe(bcm, flags); | 302 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
303 | mutex_unlock(&bcm->mutex); | ||
294 | 304 | ||
295 | return err ? err : count; | 305 | return err ? err : count; |
296 | } | 306 | } |