retval = 2;
}
break;
- case 1:
+ case 1: /* incoming call accepted by net interface */
list_for_each(l, &isdn_net_devs) {
isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list);
if (p->isdn_slot == i) {
strcpy(cmd.parm.setup.eazmsn, p->mlp->msn);
+ isdn_slot_set_usage(i, (isdn_slot_usage(i) & ISDN_USAGE_EXCLUSIVE) | ISDN_USAGE_NET);
+ strcpy(isdn_slot_num(i), c->parm.setup.phone);
+
isdn_slot_command(i, ISDN_CMD_ACCEPTD, &cmd);
retval = 1;
break;
if (USG_NONE(slot[i].usage) &&
(slot[i].di != -1)) {
int d = slot[i].di;
- if ((slot[i].usage & ISDN_USAGE_EXCLUSIVE) &&
- ((pre_dev != d) || (pre_chan != slot[i].ch)))
- continue;
if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
continue;
if (slot[i].usage & ISDN_USAGE_DISABLED)
continue; /* usage not allowed */
- if (dev->drv[d]->flags & DRV_FLAG_RUNNING) {
- if (((dev->drv[d]->interface->features & features) == features) ||
- (((dev->drv[d]->interface->features & vfeatures) == vfeatures) &&
- (dev->drv[d]->interface->features & ISDN_FEATURE_L2_TRANS))) {
- if ((pre_dev < 0) || (pre_chan < 0)) {
- isdn_slot_set_usage(i, (isdn_slot_usage(i) & ISDN_USAGE_EXCLUSIVE) | usage);
- restore_flags(flags);
- return i;
- } else if ((pre_dev == d) && (pre_chan == slot[i].ch)) {
- isdn_slot_set_usage(i, (isdn_slot_usage(i) & ISDN_USAGE_EXCLUSIVE) | usage);
- restore_flags(flags);
- return i;
- }
+ if (!dev->drv[d]->flags & DRV_FLAG_RUNNING)
+ continue;
+ if (((dev->drv[d]->interface->features & features) == features) ||
+ (((dev->drv[d]->interface->features & vfeatures) == vfeatures) &&
+ (dev->drv[d]->interface->features & ISDN_FEATURE_L2_TRANS))) {
+ if (pre_dev < 0 || pre_chan < 0 ||
+ (pre_dev == d && pre_chan == slot[i].ch)) {
+ isdn_slot_set_usage(i, usage);
+ restore_flags(flags);
+ return i;
}
}
}
int sl;
sl = isdn_dc2minor(di, ch);
- isdn_slot_free(sl, usage);
+ isdn_slot_free(sl);
}
void
-isdn_slot_free(int sl, int usage)
+isdn_slot_free(int sl)
{
unsigned long flags;
save_flags(flags);
cli();
- if (!usage || (slot[sl].usage & ISDN_USAGE_MASK) == usage) {
- strcpy(isdn_slot_num(sl), "???");
- slot[sl].ibytes = 0;
- slot[sl].obytes = 0;
+ strcpy(isdn_slot_num(sl), "???");
+ slot[sl].ibytes = 0;
+ slot[sl].obytes = 0;
// 20.10.99 JIM, try to reinitialize v110 !
- slot[sl].iv110.v110emu = 0;
- atomic_set(&slot[sl].iv110.v110use, 0);
- isdn_v110_close(slot[sl].iv110.v110);
- slot[sl].iv110.v110 = NULL;
+ slot[sl].iv110.v110emu = 0;
+ atomic_set(&slot[sl].iv110.v110use, 0);
+ isdn_v110_close(slot[sl].iv110.v110);
+ slot[sl].iv110.v110 = NULL;
// 20.10.99 JIM, try to reinitialize v110 !
- isdn_slot_set_usage(sl, isdn_slot_usage(sl) & (ISDN_USAGE_NONE | ISDN_USAGE_EXCLUSIVE));
- skb_queue_purge(&dev->drv[isdn_slot_driver(sl)]->rpqueue[isdn_slot_channel(sl)]);
- }
- restore_flags(flags);
-}
-
-/*
- * Cancel Exclusive-Flag for ISDN-channel
- */
-void
-isdn_unexclusive_channel(int di, int ch)
-{
- int i;
- ulong flags;
-
- save_flags(flags);
- cli();
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if ((slot[i].di == di) &&
- (slot[i].ch == ch)) {
- isdn_slot_set_usage(i, isdn_slot_usage(i) & ~ISDN_USAGE_EXCLUSIVE);
- restore_flags(flags);
- return;
- }
+ isdn_slot_set_usage(sl, ISDN_USAGE_NONE);
+ skb_queue_purge(&dev->drv[isdn_slot_driver(sl)]->rpqueue[isdn_slot_channel(sl)]);
restore_flags(flags);
}
case ISDN_CMD_DIAL:
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return -EBUSY;
+
/* fall through */
default:
ctrl->arg = isdn_slot_channel(sl);
extern void isdn_info_update(void);
extern char *isdn_map_eaz2msn(char *msn, int di);
extern void isdn_timer_ctrl(int tf, int onoff);
-extern void isdn_unexclusive_channel(int di, int ch);
extern int isdn_getnum(char **);
extern int isdn_msncmp( const char *, const char *);
extern int isdn_add_channels(driver *, int, int, int);
};
extern int isdn_get_free_slot(int, int, int, int, int, char *);
-extern void isdn_slot_free(int slot, int usage);
+extern void isdn_slot_free(int slot);
extern void isdn_slot_all_eaz(int slot);
extern int isdn_slot_command(int slot, int cmd, isdn_ctrl *);
extern int isdn_slot_dial(int slot, struct dial_info *dial);
goto out;
}
if (idev->exclusive >= 0) {
- isdn_unexclusive_channel(idev->pre_device, idev->pre_channel);
- isdn_free_channel(idev->pre_device, idev->pre_channel, ISDN_USAGE_NET);
+ isdn_slot_free(idev->exclusive);
idev->exclusive = -1;
}
if (cfg->exclusive) {
/* If binding is exclusive, try to grab the channel */
- idev->exclusive = isdn_get_free_slot(ISDN_USAGE_NET, mlp->l2_proto,
- mlp->l3_proto, drvidx, chidx, cfg->eaz);
+ idev->exclusive = isdn_get_free_slot(ISDN_USAGE_NET | ISDN_USAGE_EXCLUSIVE,
+ mlp->l2_proto, mlp->l3_proto, drvidx, chidx, cfg->eaz);
if (idev->exclusive < 0) {
/* Grab failed, because desired channel is in use */
retval = -EBUSY;
goto out;
}
- /* All went ok, so update isdninfo */
- isdn_slot_set_usage(idev->exclusive, ISDN_USAGE_EXCLUSIVE);
}
idev->pre_device = drvidx;
idev->pre_channel = chidx;
isdn_net_rmallphone(idev);
if (idev->exclusive >= 0)
- isdn_unexclusive_channel(idev->pre_device, idev->pre_channel);
+ isdn_free_slot(idev->exclusive);
list_del(&idev->slaves);
fsm_change_state(&idev->fi, ST_NULL);
isdn_slot_set_idev(idev->isdn_slot, NULL);
- isdn_slot_free(idev->isdn_slot, ISDN_USAGE_NET);
+ isdn_slot_free(idev->isdn_slot);
idev->isdn_slot = -1;
if (slot < 0)
goto err;
- isdn_slot_set_usage(slot, isdn_slot_usage(slot) | ISDN_USAGE_OUTGOING);
-
if (isdn_net_bind_channel(idev, slot) < 0)
goto err;
int slot = (int) arg;
// FIXME this really should be done in generic code
-// strcpy(isdn_slot_num(slot), nr);
- isdn_slot_set_usage(slot, (isdn_slot_usage(slot) & ISDN_USAGE_EXCLUSIVE) | ISDN_USAGE_NET);
isdn_net_bind_channel(idev, slot);
if (slot < 0)
goto err;
- isdn_slot_set_usage(slot, isdn_slot_usage(slot) | ISDN_USAGE_OUTGOING);
-
if (isdn_net_bind_channel(idev, slot) < 0)
goto err;
isdn_slot_all_eaz(slot);
info->emu.mdmreg[REG_RINGCNT] = 0;
- isdn_slot_free(slot, 0);
+ isdn_slot_free(slot);
isdn_slot_set_m_idx(slot, -1);
info->isdn_slot = -1;
}
info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &c);
- isdn_slot_free(info->isdn_slot, ISDN_USAGE_FAX);
+ isdn_slot_free(info->isdn_slot);
isdn_slot_set_m_idx(i, -1);
info->isdn_slot = -1;
restore_flags(flags);