#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
-static DEFINE_RWLOCK(capiminors_lock);
+static DEFINE_SPINLOCK(capiminors_lock);
static struct capiminor **capiminors;
static struct tty_driver *capinc_tty_driver;
struct capiminor *mp;
struct device *dev;
unsigned int minor;
- unsigned long flags;
mp = kzalloc(sizeof(*mp), GFP_KERNEL);
if (!mp) {
mp->port.ops = &capiminor_port_ops;
/* Allocate the least unused minor number. */
- write_lock_irqsave(&capiminors_lock, flags);
+ spin_lock(&capiminors_lock);
for (minor = 0; minor < capi_ttyminors; minor++)
if (!capiminors[minor]) {
capiminors[minor] = mp;
break;
}
- write_unlock_irqrestore(&capiminors_lock, flags);
+ spin_unlock(&capiminors_lock);
if (minor == capi_ttyminors) {
printk(KERN_NOTICE "capi: out of minors\n");
return mp;
err_out2:
- write_lock_irqsave(&capiminors_lock, flags);
+ spin_lock(&capiminors_lock);
capiminors[minor] = NULL;
- write_unlock_irqrestore(&capiminors_lock, flags);
+ spin_unlock(&capiminors_lock);
err_out1:
kfree(mp);
{
struct capiminor *mp;
- read_lock(&capiminors_lock);
+ spin_lock(&capiminors_lock);
mp = capiminors[minor];
if (mp)
kref_get(&mp->kref);
- read_unlock(&capiminors_lock);
+ spin_unlock(&capiminors_lock);
return mp;
}
static void capiminor_free(struct capiminor *mp)
{
- unsigned long flags;
-
tty_unregister_device(capinc_tty_driver, mp->minor);
- write_lock_irqsave(&capiminors_lock, flags);
+ spin_lock(&capiminors_lock);
capiminors[mp->minor] = NULL;
- write_unlock_irqrestore(&capiminors_lock, flags);
+ spin_unlock(&capiminors_lock);
capiminor_put(mp);
}