diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2010-02-08 05:12:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 19:01:30 -0500 |
commit | 3d5d30fe7a6aa4c9d63dc4fe6b6da6abac423bc2 (patch) | |
tree | 145a786c36ef66ac976feaf28ad4b004d7581dac /drivers/isdn/capi | |
parent | 6576c2891adacad81ea0b24f0704ecac9fc727cb (diff) |
CAPI: Clean up capiminors_lock
Use a plain spin lock for capiminors_lock, drop inconsistent irqsafe
acquisitions (it's only used in process context anyway).
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r-- | drivers/isdn/capi/capi.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index cf5e996ac448..0b264b4565c8 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -149,7 +149,7 @@ static LIST_HEAD(capidev_list); | |||
149 | 149 | ||
150 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 150 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
151 | 151 | ||
152 | static DEFINE_RWLOCK(capiminors_lock); | 152 | static DEFINE_SPINLOCK(capiminors_lock); |
153 | static struct capiminor **capiminors; | 153 | static struct capiminor **capiminors; |
154 | 154 | ||
155 | static struct tty_driver *capinc_tty_driver; | 155 | static struct tty_driver *capinc_tty_driver; |
@@ -218,7 +218,6 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) | |||
218 | struct capiminor *mp; | 218 | struct capiminor *mp; |
219 | struct device *dev; | 219 | struct device *dev; |
220 | unsigned int minor; | 220 | unsigned int minor; |
221 | unsigned long flags; | ||
222 | 221 | ||
223 | mp = kzalloc(sizeof(*mp), GFP_KERNEL); | 222 | mp = kzalloc(sizeof(*mp), GFP_KERNEL); |
224 | if (!mp) { | 223 | if (!mp) { |
@@ -242,13 +241,13 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) | |||
242 | mp->port.ops = &capiminor_port_ops; | 241 | mp->port.ops = &capiminor_port_ops; |
243 | 242 | ||
244 | /* Allocate the least unused minor number. */ | 243 | /* Allocate the least unused minor number. */ |
245 | write_lock_irqsave(&capiminors_lock, flags); | 244 | spin_lock(&capiminors_lock); |
246 | for (minor = 0; minor < capi_ttyminors; minor++) | 245 | for (minor = 0; minor < capi_ttyminors; minor++) |
247 | if (!capiminors[minor]) { | 246 | if (!capiminors[minor]) { |
248 | capiminors[minor] = mp; | 247 | capiminors[minor] = mp; |
249 | break; | 248 | break; |
250 | } | 249 | } |
251 | write_unlock_irqrestore(&capiminors_lock, flags); | 250 | spin_unlock(&capiminors_lock); |
252 | 251 | ||
253 | if (minor == capi_ttyminors) { | 252 | if (minor == capi_ttyminors) { |
254 | printk(KERN_NOTICE "capi: out of minors\n"); | 253 | printk(KERN_NOTICE "capi: out of minors\n"); |
@@ -264,9 +263,9 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) | |||
264 | return mp; | 263 | return mp; |
265 | 264 | ||
266 | err_out2: | 265 | err_out2: |
267 | write_lock_irqsave(&capiminors_lock, flags); | 266 | spin_lock(&capiminors_lock); |
268 | capiminors[minor] = NULL; | 267 | capiminors[minor] = NULL; |
269 | write_unlock_irqrestore(&capiminors_lock, flags); | 268 | spin_unlock(&capiminors_lock); |
270 | 269 | ||
271 | err_out1: | 270 | err_out1: |
272 | kfree(mp); | 271 | kfree(mp); |
@@ -288,11 +287,11 @@ static struct capiminor *capiminor_get(unsigned int minor) | |||
288 | { | 287 | { |
289 | struct capiminor *mp; | 288 | struct capiminor *mp; |
290 | 289 | ||
291 | read_lock(&capiminors_lock); | 290 | spin_lock(&capiminors_lock); |
292 | mp = capiminors[minor]; | 291 | mp = capiminors[minor]; |
293 | if (mp) | 292 | if (mp) |
294 | kref_get(&mp->kref); | 293 | kref_get(&mp->kref); |
295 | read_unlock(&capiminors_lock); | 294 | spin_unlock(&capiminors_lock); |
296 | 295 | ||
297 | return mp; | 296 | return mp; |
298 | } | 297 | } |
@@ -304,13 +303,11 @@ static inline void capiminor_put(struct capiminor *mp) | |||
304 | 303 | ||
305 | static void capiminor_free(struct capiminor *mp) | 304 | static void capiminor_free(struct capiminor *mp) |
306 | { | 305 | { |
307 | unsigned long flags; | ||
308 | |||
309 | tty_unregister_device(capinc_tty_driver, mp->minor); | 306 | tty_unregister_device(capinc_tty_driver, mp->minor); |
310 | 307 | ||
311 | write_lock_irqsave(&capiminors_lock, flags); | 308 | spin_lock(&capiminors_lock); |
312 | capiminors[mp->minor] = NULL; | 309 | capiminors[mp->minor] = NULL; |
313 | write_unlock_irqrestore(&capiminors_lock, flags); | 310 | spin_unlock(&capiminors_lock); |
314 | 311 | ||
315 | capiminor_put(mp); | 312 | capiminor_put(mp); |
316 | } | 313 | } |