isdnloop_bchan_send(card, 1);
if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) {
/* schedule b-channel polling again */
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;
add_timer(&card->rb_timer);
card->flags |= ISDNLOOP_FLAGS_RBTIMER;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
} else
card->flags &= ~ISDNLOOP_FLAGS_RBTIMER;
}
{
ulong flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
*card->msg_buf_write++ = (c == 0xff) ? '\n' : c;
if (card->msg_buf_write == card->msg_buf_read) {
if (++card->msg_buf_read > card->msg_buf_end)
}
if (card->msg_buf_write > card->msg_buf_end)
card->msg_buf_write = card->msg_buf;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
/*
if (!(card->flags & ISDNLOOP_FLAGS_RBTIMER)) {
/* schedule b-channel polling */
card->flags |= ISDNLOOP_FLAGS_RBTIMER;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
del_timer(&card->rb_timer);
card->rb_timer.function = isdnloop_pollbchan;
card->rb_timer.data = (unsigned long) card;
card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD;
add_timer(&card->rb_timer);
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
/* schedule again */
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD;
add_timer(&card->st_timer);
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
/*
return 0;
if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE)
return 0;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
nskb = dev_alloc_skb(skb->len);
if (nskb) {
memcpy(skb_put(nskb, len), skb->data, len);
} else
len = 0;
card->sndcount[channel] += len;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
return len;
}
unsigned long flags;
char buf[60];
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
if (card->rcard) {
isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1);
card->rcard[ch]->rcard[card->rch[ch]] = NULL;
/* No user responding */
sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3));
isdnloop_fake(card, buf, ch + 1);
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
/*
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
init_timer(&card->c_timer[ch]);
card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT;
if (ch)
card->c_timer[ch].function = isdnloop_atimeout0;
card->c_timer[ch].data = (unsigned long) card;
add_timer(&card->c_timer[ch]);
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
/*
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
del_timer(&card->c_timer[ch]);
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
static u_char si2bit[] =
}
}
if (num_match) {
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
/* channel idle? */
if (!(cc->rcard[ch])) {
/* Check SI */
if (!(si2bit[cmd->parm.setup.si1] & cc->sil[ch])) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return 3;
}
/* ch is idle, si and number matches */
cc->rch[ch] = lch;
card->rcard[lch] = cc;
card->rch[lch] = ch;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return 0;
} else {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
/* num matches, but busy */
if (ch == 1)
return 1;
unsigned long flags;
isdn_ctrl cmd;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
if (card->flags & ISDNLOOP_FLAGS_RUNNING) {
card->flags &= ~ISDNLOOP_FLAGS_RUNNING;
del_timer(&card->st_timer);
cmd.driver = card->myid;
card->interface.statcallb(&cmd);
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
}
/*
return -EBUSY;
if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
return -EFAULT;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&card->isdnloop_lock, flags);
switch (sdef.ptype) {
case ISDN_PTYPE_EURO:
if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96",
-1)) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return -ENOMEM;
}
card->sil[0] = card->sil[1] = 4;
if (isdnloop_fake(card, "TEI OK", 0)) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return -ENOMEM;
}
for (i = 0; i < 3; i++)
case ISDN_PTYPE_1TR6:
if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95",
-1)) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return -ENOMEM;
}
card->sil[0] = card->sil[1] = 4;
if (isdnloop_fake(card, "TEI OK", 0)) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return -ENOMEM;
}
strcpy(card->s0num[0], sdef.num[0]);
card->s0num[2][0] = '\0';
break;
default:
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n",
sdef.ptype);
return -EINVAL;
card->st_timer.data = (unsigned long) card;
add_timer(&card->st_timer);
card->flags |= ISDNLOOP_FLAGS_RUNNING;
- restore_flags(flags);
+ spin_unlock_irqrestore(&card->isdnloop_lock, flags);
return 0;
}
skb_queue_head_init(&card->bqueue[i]);
}
skb_queue_head_init(&card->dqueue);
+ card->isdnloop_lock = SPIN_LOCK_UNLOCKED;
card->next = cards;
cards = card;
if (!register_isdn(&card->interface)) {