Commit eae32582 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Begin to make driver/channel mapping private to isdn_common.c

parent 0342d35c
......@@ -564,8 +564,8 @@ isdn_audio_eval_dtmf(modem_info * info)
ISDN_AUDIO_SKB_LOCK(skb) = 0;
save_flags(flags);
cli();
di = info->isdn_driver;
ch = info->isdn_channel;
di = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
restore_flags(flags);
......@@ -685,8 +685,8 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
ISDN_AUDIO_SKB_LOCK(skb) = 0;
save_flags(flags);
cli();
di = info->isdn_driver;
ch = info->isdn_channel;
di = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += 2;
restore_flags(flags);
......
......@@ -44,6 +44,9 @@ MODULE_LICENSE("GPL");
isdn_dev *dev;
static int drvmap[ISDN_MAX_CHANNELS]; /* Map slot -> driver-index */
static int chanmap[ISDN_MAX_CHANNELS]; /* Map slot -> channel-index */
static char *isdn_revision = "$Revision: 1.114.6.16 $";
extern char *isdn_net_revision;
......@@ -230,7 +233,7 @@ isdn_dc2minor(int di, int ch)
{
int i;
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (dev->chanmap[i] == ch && dev->drvmap[i] == di)
if (chanmap[i] == ch && drvmap[i] == di)
return i;
return -1;
}
......@@ -458,8 +461,8 @@ isdn_status_callback(isdn_ctrl * c)
case ISDN_STAT_RUN:
dev->drv[di]->flags |= DRV_FLAG_RUNNING;
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (dev->drvmap[i] == di)
isdn_all_eaz(di, dev->chanmap[i]);
if (drvmap[i] == di)
isdn_all_eaz(di, chanmap[i]);
set_global_features();
break;
case ISDN_STAT_STOP:
......@@ -506,14 +509,10 @@ isdn_status_callback(isdn_ctrl * c)
case 1:
/* Schedule connection-setup */
isdn_net_dial();
cmd.driver = di;
cmd.arg = c->arg;
cmd.command = ISDN_CMD_ACCEPTD;
for ( p = dev->netdev; p; p = p->next )
if ( p->local->isdn_channel == cmd.arg )
{
if (p->local->isdn_slot == isdn_dc2minor(di, cmd.arg)) {
strcpy( cmd.parm.setup.eazmsn, p->local->msn );
isdn_command(&cmd);
isdn_slot_command(p->local->isdn_slot, ISDN_CMD_ACCEPTD, &cmd);
retval = 1;
break;
}
......@@ -679,8 +678,8 @@ isdn_status_callback(isdn_ctrl * c)
save_flags(flags);
cli();
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if ((dev->drvmap[i] == di) &&
(dev->chanmap[i] == c->arg)) {
if ((drvmap[i] == di) &&
(chanmap[i] == c->arg)) {
if (c->parm.num[0])
dev->usage[i] &= ~ISDN_USAGE_DISABLED;
else
......@@ -707,9 +706,9 @@ isdn_status_callback(isdn_ctrl * c)
cli();
isdn_tty_stat_callback(i, c);
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (dev->drvmap[i] == di) {
dev->drvmap[i] = -1;
dev->chanmap[i] = -1;
if (drvmap[i] == di) {
drvmap[i] = -1;
chanmap[i] = -1;
dev->usage[i] &= ~ISDN_USAGE_DISABLED;
isdn_unregister_devfs(i);
}
......@@ -884,13 +883,13 @@ isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_que
static __inline int
isdn_minor2drv(int minor)
{
return (dev->drvmap[minor]);
return drvmap[minor];
}
static __inline int
isdn_minor2chan(int minor)
{
return (dev->chanmap[minor]);
return chanmap[minor];
}
static char *
......@@ -903,19 +902,19 @@ isdn_statstr(void)
sprintf(istatbuf, "idmap:\t");
p = istatbuf + strlen(istatbuf);
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
sprintf(p, "%s ", (dev->drvmap[i] < 0) ? "-" : dev->drvid[dev->drvmap[i]]);
sprintf(p, "%s ", (drvmap[i] < 0) ? "-" : dev->drvid[drvmap[i]]);
p = istatbuf + strlen(istatbuf);
}
sprintf(p, "\nchmap:\t");
p = istatbuf + strlen(istatbuf);
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
sprintf(p, "%d ", dev->chanmap[i]);
sprintf(p, "%d ", chanmap[i]);
p = istatbuf + strlen(istatbuf);
}
sprintf(p, "\ndrmap:\t");
p = istatbuf + strlen(istatbuf);
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
sprintf(p, "%d ", dev->drvmap[i]);
sprintf(p, "%d ", drvmap[i]);
p = istatbuf + strlen(istatbuf);
}
sprintf(p, "\nusage:\t");
......@@ -1761,10 +1760,10 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
*/
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (USG_NONE(dev->usage[i]) &&
(dev->drvmap[i] != -1)) {
int d = dev->drvmap[i];
(drvmap[i] != -1)) {
int d = drvmap[i];
if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) &&
((pre_dev != d) || (pre_chan != dev->chanmap[i])))
((pre_dev != d) || (pre_chan != chanmap[i])))
continue;
if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
continue;
......@@ -1781,7 +1780,7 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
restore_flags(flags);
return i;
} else {
if ((pre_dev == d) && (pre_chan == dev->chanmap[i])) {
if ((pre_dev == d) && (pre_chan == chanmap[i])) {
dev->usage[i] &= ISDN_USAGE_EXCLUSIVE;
dev->usage[i] |= usage;
isdn_info_update();
......@@ -1802,27 +1801,32 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
void
isdn_free_channel(int di, int ch, int usage)
{
int i;
ulong flags;
int slot;
slot = isdn_dc2minor(di, ch);
isdn_slot_free(slot, usage);
}
void
isdn_slot_free(int slot, int usage)
{
unsigned long flags;
save_flags(flags);
cli();
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (((!usage) || ((dev->usage[i] & ISDN_USAGE_MASK) == usage)) &&
(dev->drvmap[i] == di) &&
(dev->chanmap[i] == ch)) {
dev->usage[i] &= (ISDN_USAGE_NONE | ISDN_USAGE_EXCLUSIVE);
strcpy(dev->num[i], "???");
dev->ibytes[i] = 0;
dev->obytes[i] = 0;
if (!usage || (dev->usage[slot] & ISDN_USAGE_MASK) == usage) {
dev->usage[slot] &= (ISDN_USAGE_NONE | ISDN_USAGE_EXCLUSIVE);
strcpy(dev->num[slot], "???");
dev->ibytes[slot] = 0;
dev->obytes[slot] = 0;
// 20.10.99 JIM, try to reinitialize v110 !
dev->v110emu[i] = 0;
atomic_set(&(dev->v110use[i]), 0);
isdn_v110_close(dev->v110[i]);
dev->v110[i] = NULL;
dev->v110emu[slot] = 0;
atomic_set(&(dev->v110use[slot]), 0);
isdn_v110_close(dev->v110[slot]);
dev->v110[slot] = NULL;
// 20.10.99 JIM, try to reinitialize v110 !
isdn_info_update();
skb_queue_purge(&dev->drv[di]->rpqueue[ch]);
skb_queue_purge(&dev->drv[isdn_slot_driver(slot)]->rpqueue[isdn_slot_channel(slot)]);
}
restore_flags(flags);
}
......@@ -1839,8 +1843,8 @@ isdn_unexclusive_channel(int di, int ch)
save_flags(flags);
cli();
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if ((dev->drvmap[i] == di) &&
(dev->chanmap[i] == ch)) {
if ((drvmap[i] == di) &&
(chanmap[i] == ch)) {
dev->usage[i] &= ~ISDN_USAGE_EXCLUSIVE;
isdn_info_update();
restore_flags(flags);
......@@ -1997,9 +2001,9 @@ isdn_add_channels(driver *d, int drvidx, int n, int adding)
cli();
for (j = d->channels; j < m; j++)
for (k = 0; k < ISDN_MAX_CHANNELS; k++)
if (dev->chanmap[k] < 0) {
dev->chanmap[k] = j;
dev->drvmap[k] = drvidx;
if (chanmap[k] < 0) {
chanmap[k] = j;
drvmap[k] = drvidx;
isdn_register_devfs(k);
break;
}
......@@ -2140,6 +2144,75 @@ register_isdn(isdn_if * i)
return 1;
}
int
isdn_slot_driver(int slot)
{
BUG_ON(slot < 0);
return drvmap[slot];
}
int
isdn_slot_channel(int slot)
{
BUG_ON(slot < 0);
return chanmap[slot];
}
int
isdn_slot_hdrlen(int slot)
{
int di = isdn_slot_driver(slot);
return dev->drv[di]->interface->hl_hdrlen;
}
char *
isdn_slot_map_eaz2msn(int slot, char *msn)
{
int di = isdn_slot_driver(slot);
return isdn_map_eaz2msn(msn, di);
}
int
isdn_slot_command(int slot, int cmd, isdn_ctrl *ctrl)
{
ctrl->command = cmd;
ctrl->driver = isdn_slot_driver(slot);
ctrl->arg &= 0xff; ctrl->arg |= isdn_slot_channel(slot);
return isdn_command(ctrl);
}
void
isdn_slot_all_eaz(int slot)
{
isdn_ctrl cmd;
cmd.parm.num[0] = '\0';
isdn_slot_command(slot, ISDN_CMD_SETEAZ, &cmd);
}
int
isdn_slot_readbchan(int slot, u_char *buf, u_char *fp, int len, wait_queue_head_t *sleep)
{
int di = isdn_slot_driver(slot);
int ch = isdn_slot_channel(slot);
return isdn_readbchan(di, ch, buf, fp, len, sleep);
}
int
isdn_slot_writebuf_skb_stub(int slot, int ack, struct sk_buff *skb)
{
int di = isdn_slot_driver(slot);
int ch = isdn_slot_channel(slot);
return isdn_writebuf_skb_stub(di, ch, ack, skb);
}
/*
*****************************************************************************
* And now the modules code.
......@@ -2261,8 +2334,8 @@ static int __init isdn_init(void)
init_MUTEX(&dev->sem);
init_waitqueue_head(&dev->info_waitq);
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
dev->drvmap[i] = -1;
dev->chanmap[i] = -1;
drvmap[i] = -1;
chanmap[i] = -1;
dev->m_idx[i] = -1;
strcpy(dev->num[i], "???");
init_waitqueue_head(&dev->mdm.info[i].open_wait);
......
......@@ -47,3 +47,13 @@ extern int isdn_add_channels(driver *, int, int, int);
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
extern void isdn_dumppkt(char *, u_char *, int, int);
#endif
extern void isdn_slot_free(int slot, int usage);
extern void isdn_slot_all_eaz(int slot);
extern int isdn_slot_command(int slot, int cmd, isdn_ctrl *);
extern char *isdn_slot_map_eaz2msn(int slot, char *msn);
extern int isdn_slot_writebuf_skb_stub(int slot, int, struct sk_buff *);
extern int isdn_slot_readbchan(int slot, u_char *, u_char *, int, wait_queue_head_t *);
extern int isdn_slot_hdrlen(int slot);
extern int isdn_slot_driver(int slot);
extern int isdn_slot_channel(int slot);
......@@ -280,8 +280,7 @@ isdn_net_bind_channel(isdn_net_local * lp, int idx)
save_flags(flags);
cli();
lp->flags |= ISDN_NET_CONNECTED;
lp->isdn_device = dev->drvmap[idx];
lp->isdn_channel = dev->chanmap[idx];
lp->isdn_slot = idx;
dev->rx_netdev[idx] = lp->netdev;
dev->st_netdev[idx] = lp->netdev;
restore_flags(flags);
......@@ -307,12 +306,11 @@ isdn_net_unbind_channel(isdn_net_local * lp)
qdisc_reset(lp->netdev->dev.qdisc);
}
lp->dialstate = 0;
dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET);
dev->rx_netdev[lp->isdn_slot] = NULL;
dev->st_netdev[lp->isdn_slot] = NULL;
isdn_slot_free(lp->isdn_slot, ISDN_USAGE_NET);
lp->flags &= ~ISDN_NET_CONNECTED;
lp->isdn_device = -1;
lp->isdn_channel = -1;
lp->isdn_slot = -1;
restore_flags(flags);
}
......@@ -459,7 +457,7 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
isdn_ppp_free(lp);
#endif
isdn_net_lp_disconnected(lp);
isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
isdn_slot_all_eaz(lp->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", lp->name);
printk(KERN_INFO "%s: Chargesum is %d\n", lp->name,
lp->charge);
......@@ -574,7 +572,6 @@ isdn_net_dial(void)
{
isdn_net_dev *p = dev->netdev;
int anymore = 0;
int i;
unsigned long flags;
isdn_ctrl cmd;
u_char *phone_number;
......@@ -616,13 +613,9 @@ isdn_net_dial(void)
/* Fall through */
case 2:
/* Prepare dialing. Clear EAZ, then set EAZ. */
cmd.driver = lp->isdn_device;
cmd.arg = lp->isdn_channel;
cmd.command = ISDN_CMD_CLREAZ;
isdn_command(&cmd);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_CLREAZ, &cmd);
sprintf(cmd.parm.num, "%s", isdn_map_eaz2msn(lp->msn, cmd.driver));
cmd.command = ISDN_CMD_SETEAZ;
isdn_command(&cmd);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETEAZ, &cmd);
lp->dialretry = 0;
anymore = 1;
lp->dialstate++;
......@@ -642,16 +635,10 @@ isdn_net_dial(void)
isdn_net_hangup(&p->dev);
break;
}
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_SETL2;
cmd.arg = lp->isdn_channel + (lp->l2_proto << 8);
isdn_command(&cmd);
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
isdn_command(&cmd);
cmd.driver = lp->isdn_device;
cmd.arg = lp->isdn_channel;
cmd.arg = lp->l2_proto << 8;
isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = lp->l3_proto << 8;
isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETL3, &cmd);
save_flags(flags);
cli();
if (!lp->dial) {
......@@ -676,8 +663,6 @@ isdn_net_dial(void)
break;
}
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_DIAL;
cmd.parm.setup.si2 = 0;
/* check for DOV */
......@@ -710,11 +695,10 @@ isdn_net_dial(void)
}
restore_flags(flags);
sprintf(cmd.parm.setup.eazmsn, "%s",
isdn_map_eaz2msn(lp->msn, cmd.driver));
i = isdn_dc2minor(lp->isdn_device, lp->isdn_channel);
if (i >= 0) {
strcpy(dev->num[i], cmd.parm.setup.phone);
dev->usage[i] |= ISDN_USAGE_OUTGOING;
isdn_slot_map_eaz2msn(lp->isdn_slot, lp->msn));
if (lp->isdn_slot >= 0) {
strcpy(dev->num[lp->isdn_slot], cmd.parm.setup.phone);
dev->usage[lp->isdn_slot] |= ISDN_USAGE_OUTGOING;
isdn_info_update();
}
printk(KERN_INFO "%s: dialing %d %s... %s\n", lp->name,
......@@ -725,7 +709,7 @@ isdn_net_dial(void)
printk(KERN_DEBUG "dial: d=%d c=%d\n", lp->isdn_device,
lp->isdn_channel);
#endif
isdn_command(&cmd);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_DIAL, &cmd);
}
lp->huptimer = 0;
lp->outgoing = 1;
......@@ -752,13 +736,10 @@ isdn_net_dial(void)
break;
case 5:
/* Got D-Channel-Connect, send B-Channel-request */
cmd.driver = lp->isdn_device;
cmd.arg = lp->isdn_channel;
cmd.command = ISDN_CMD_ACCEPTB;
anymore = 1;
lp->dtimer = 0;
lp->dialstate++;
isdn_command(&cmd);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_ACCEPTB, &cmd);
break;
case 6:
/* Wait for B- or D-Channel-connect. If timeout,
......@@ -778,14 +759,10 @@ isdn_net_dial(void)
#ifdef ISDN_DEBUG_NET_DIAL
printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
#endif
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_SETL2;
cmd.arg = lp->isdn_channel + (lp->l2_proto << 8);
isdn_command(&cmd);
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = lp->isdn_channel + (lp->l3_proto << 8);
isdn_command(&cmd);
cmd.arg = lp->l2_proto << 8;
isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = lp->l3_proto << 8;
isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETL3, &cmd);
if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT15)
isdn_net_hangup(&p->dev);
else {
......@@ -795,10 +772,7 @@ isdn_net_dial(void)
break;
case 9:
/* Got incoming D-Channel-Connect, send B-Channel-request */
cmd.driver = lp->isdn_device;
cmd.arg = lp->isdn_channel;
cmd.command = ISDN_CMD_ACCEPTB;
isdn_command(&cmd);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_ACCEPTB, &cmd);
anymore = 1;
lp->dtimer = 0;
lp->dialstate++;
......@@ -829,11 +803,8 @@ isdn_net_dial(void)
printk(KERN_INFO "%s: hangup waiting for callback ...\n", lp->name);
lp->dtimer = 0;
lp->dialstate = 4;
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_HANGUP;
cmd.arg = lp->isdn_channel;
isdn_command(&cmd);
isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_HANGUP, &cmd);
isdn_slot_all_eaz(lp->isdn_slot);
}
anymore = 1;
break;
......@@ -883,12 +854,9 @@ isdn_net_hangup(struct net_device *d)
pops -> disconn_ind(cprot);
#endif /* CONFIG_ISDN_X25 */
cmd.driver = lp->isdn_device;
cmd.command = ISDN_CMD_HANGUP;
cmd.arg = lp->isdn_channel;
isdn_command(&cmd);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_HANGUP, &cmd);
printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, lp->charge);
isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
isdn_slot_all_eaz(lp->isdn_slot);
}
isdn_net_unbind_channel(lp);
}
......@@ -1049,7 +1017,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
printk("isdn BUG at %s:%d!\n", __FILE__, __LINE__);
goto error;
}
ret = isdn_writebuf_skb_stub(lp->isdn_device, lp->isdn_channel, 1, skb);
ret = isdn_slot_writebuf_skb_stub(lp->isdn_slot, 1, skb);
if (ret != len) {
/* we should never get here */
printk(KERN_WARNING "%s: HL driver queue full\n", lp->name);
......@@ -1433,7 +1401,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev)
static struct sk_buff*
isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
{
unsigned short hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen;
unsigned short hl = isdn_slot_hdrlen(lp->isdn_slot);
struct sk_buff *skb;
skb = alloc_skb(hl + len, GFP_ATOMIC);
......@@ -2161,6 +2129,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
char nr[32];
char *my_eaz;
int slot = isdn_dc2minor(di, ch);
/* Search name in netdev-chain */
save_flags(flags);
cli();
......@@ -2210,7 +2179,7 @@ p = dev->netdev;
}
swapped = 0;
/* check acceptable call types for DOV */
my_eaz = isdn_map_eaz2msn(lp->msn, di);
my_eaz = isdn_slot_map_eaz2msn(slot, lp->msn);
if (si1 == 1) { /* it's a DOV call, check if we allow it */
if (*my_eaz == 'v' || *my_eaz == 'V' ||
*my_eaz == 'b' || *my_eaz == 'B')
......@@ -2436,7 +2405,7 @@ p = dev->netdev;
isdn_ppp_free(lp);
#endif
isdn_net_lp_disconnected(lp);
isdn_free_channel(lp->isdn_device, lp->isdn_channel,
isdn_slot_free(lp->isdn_slot,
ISDN_USAGE_NET);
}
dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE;
......@@ -2444,8 +2413,7 @@ p = dev->netdev;
strcpy(dev->num[idx], nr);
isdn_info_update();
dev->st_netdev[idx] = lp->netdev;
lp->isdn_device = di;
lp->isdn_channel = ch;
lp->isdn_slot = slot;
lp->ppp_slot = -1;
lp->flags |= ISDN_NET_CONNECTED;
lp->dialstate = 7;
......@@ -2471,7 +2439,7 @@ p = dev->netdev;
}
/* If none of configured EAZ/MSN matched and not verbose, be silent */
if (!ematch || dev->net_verbose)
printk(KERN_INFO "isdn_net: call from %s -> %d %s ignored\n", nr, di, eaz);
printk(KERN_INFO "isdn_net: call from %s -> %d %s ignored\n", nr, slot, eaz);
restore_flags(flags);
return (wret == 2)?5:0;
}
......@@ -2642,8 +2610,7 @@ isdn_net_new(char *name, struct net_device *master)
netdev->local->tqueue.data = netdev->local;
spin_lock_init(&netdev->local->xmit_lock);
netdev->local->isdn_device = -1;
netdev->local->isdn_channel = -1;
netdev->local->isdn_slot = -1;
netdev->local->pre_device = -1;
netdev->local->pre_channel = -1;
netdev->local->exclusive = -1;
......@@ -3051,7 +3018,7 @@ int
isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer)
{
isdn_net_dev *p = isdn_net_findif(phone->name);
int ch, dv, idx;
int idx;
if (!p) return -ENODEV;
/*
......@@ -3060,11 +3027,8 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer)
* in (partially) wrong number copied to user. This race
* currently ignored.
*/
ch = p->local->isdn_channel;
dv = p->local->isdn_device;
if(ch<0 && dv<0) return -ENOTCONN;
idx = isdn_dc2minor(dv, ch);
if (idx<0) return -ENODEV;
idx = p->local->isdn_slot;
if (idx<0) return -ENOTCONN;
/* for pre-bound channels, we need this extra check */
if ( strncmp(dev->num[idx],"???",3) == 0 ) return -ENOTCONN;
strncpy(phone->phone,dev->num[idx],ISDN_MSNLEN);
......@@ -3147,7 +3111,7 @@ isdn_net_force_hangup(char *name)
struct net_device *q;
if (p) {
if (p->local->isdn_device < 0)
if (p->local->isdn_slot < 0)
return 1;
q = p->local->slave;
/* If this interface has slaves, do a hangup for them also. */
......
......@@ -804,11 +804,11 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
if (proto != PPP_LCP)
lp->huptimer = 0;
if (lp->isdn_device < 0 || lp->isdn_channel < 0) {
if (lp->isdn_slot < 0) {
retval = 0;
goto out;
}
if ((dev->drv[lp->isdn_device]->flags & DRV_FLAG_RUNNING) &&
if ((dev->drv[isdn_slot_driver(lp->isdn_slot)]->flags & DRV_FLAG_RUNNING) &&
lp->dialstate == 0 &&
(lp->flags & ISDN_NET_CONNECTED)) {
unsigned short hl;
......@@ -818,7 +818,7 @@ isdn_ppp_write(struct file *file, const char *buf, size_t count, loff_t *off)
* sk_buff. old call to dev_alloc_skb only reserved
* 16 bytes, now we are looking what the driver want
*/
hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen;
hl = isdn_slot_hdrlen(lp->isdn_slot);
skb = alloc_skb(hl+count, GFP_ATOMIC);
if (!skb) {
printk(KERN_WARNING "isdn_ppp_write: out of memory!\n");
......@@ -1263,7 +1263,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)
* sk_buff. old call to dev_alloc_skb only reserved
* 16 bytes, now we are looking what the driver want.
*/
hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen + IPPP_MAX_HEADER;
hl = isdn_slot_hdrlen(lp->isdn_slot) + IPPP_MAX_HEADER;;
/*
* Note: hl might still be insufficient because the method
* above does not account for a possibible MPPP slave channel
......@@ -2094,7 +2094,7 @@ static void isdn_ppp_ccp_xmit_reset(struct ippp_struct *is, int proto,
isdn_net_local *lp = is->lp;
/* Alloc large enough skb */
hl = dev->drv[lp->isdn_device]->interface->hl_hdrlen;
hl = isdn_slot_hdrlen(lp->isdn_slot);
skb = alloc_skb(len + hl + 16,GFP_ATOMIC);
if(!skb) {
printk(KERN_WARNING
......
......@@ -143,7 +143,7 @@ isdn_tty_readmodem(void)
if (c > 0) {
save_flags(flags);
cli();
r = isdn_readbchan(info->isdn_driver, info->isdn_channel,
r = isdn_slot_readbchan(info->isdn_slot,
tty->flip.char_buf_ptr,
tty->flip.flag_buf_ptr, c, 0);
/* CISCO AsyncPPP Hack */
......@@ -315,8 +315,7 @@ isdn_tty_tint(modem_info * info)
if (!skb)
return;
len = skb->len;
if ((slen = isdn_writebuf_skb_stub(info->isdn_driver,
info->isdn_channel, 1, skb)) == len) {
if ((slen = isdn_slot_writebuf_skb_stub(info->isdn_slot, 1, skb)) == len) {
struct tty_struct *tty = info->tty;
info->send_outstanding++;
info->msr &= ~UART_MSR_CTS;
......@@ -479,11 +478,11 @@ isdn_tty_senddown(modem_info * info)
atomic_inc(&info->xmit_lock);
if (!(atomic_dec_and_test(&info->xmit_lock)))
return;
if (info->isdn_driver < 0) {
if (info->isdn_slot < 0) {
info->xmit_count = 0;
return;
}
skb_res = dev->drv[info->isdn_driver]->interface->hl_hdrlen + 4;
skb_res = isdn_slot_hdrlen(info->isdn_slot);
#ifdef CONFIG_ISDN_AUDIO
if (info->vonline & 2)
audio_len = buflen * voice_cf[info->emu.vpar[3]];
......@@ -657,8 +656,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
restore_flags(flags);
isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else {
info->isdn_driver = dev->drvmap[i];
info->isdn_channel = dev->chanmap[i];
info->isdn_slot = i;
info->drv_index = i;
dev->m_idx[i] = info->line;
dev->usage[i] |= ISDN_USAGE_OUTGOING;
......@@ -666,42 +664,30 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
strcpy(info->last_num, n);
isdn_info_update();
restore_flags(flags);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_CLREAZ;
isdn_command(&cmd);
strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver));
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETEAZ;
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL2;
isdn_slot_command(info->isdn_slot, ISDN_CMD_CLREAZ, &cmd);
strcpy(cmd.parm.num, isdn_slot_map_eaz2msn(info->isdn_slot, m->msn));
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETEAZ, &cmd);
info->last_l2 = l2;
cmd.arg = info->isdn_channel + (l2 << 8);
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8);
cmd.arg = l2 << 8;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = m->mdmreg[REG_L3PROT] << 8;
#ifdef CONFIG_ISDN_TTY_FAX
if (l2 == ISDN_PROTO_L2_FAX) {
cmd.parm.fax = info->fax;
info->fax->direction = ISDN_TTY_FAX_CONN_OUT;
}
#endif
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL3, &cmd);
sprintf(cmd.parm.setup.phone, "%s", n);
sprintf(cmd.parm.setup.eazmsn, "%s",
isdn_map_eaz2msn(m->msn, info->isdn_driver));
isdn_slot_map_eaz2msn(info->isdn_slot, m->msn));
cmd.parm.setup.si1 = si;
cmd.parm.setup.si2 = m->mdmreg[REG_SI2];
cmd.command = ISDN_CMD_DIAL;
info->dialing = 1;
info->emu.carrierwait = 0;
strcpy(dev->num[i], n);
isdn_info_update();
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, ISDN_CMD_DIAL, &cmd);
isdn_timer_ctrl(ISDN_TIMER_CARRIER, 1);
}
}
......@@ -714,18 +700,16 @@ void
isdn_tty_modem_hup(modem_info * info, int local)
{
isdn_ctrl cmd;
int di, ch;
int slot;
if (!info)
return;
di = info->isdn_driver;
ch = info->isdn_channel;
if (di < 0 || ch < 0)
slot = info->isdn_slot;
if (slot < 0)
return;
info->isdn_driver = -1;
info->isdn_channel = -1;
info->isdn_slot = -1;
#ifdef ISDN_DEBUG_MODEM_HUP
printk(KERN_DEBUG "Mhup ttyI%d\n", info->line);
......@@ -768,16 +752,12 @@ isdn_tty_modem_hup(modem_info * info, int local)
info->msr &= ~(UART_MSR_DCD | UART_MSR_RI);
info->lsr |= UART_LSR_TEMT;
if (local) {
cmd.driver = di;
cmd.command = ISDN_CMD_HANGUP;
cmd.arg = ch;
isdn_command(&cmd);
}
if (local)
isdn_slot_command(slot, ISDN_CMD_HANGUP, &cmd);
isdn_all_eaz(di, ch);
isdn_slot_all_eaz(slot);
info->emu.mdmreg[REG_RINGCNT] = 0;
isdn_free_channel(di, ch, 0);
isdn_slot_free(slot, 0);
if (info->drv_index >= 0) {
dev->m_idx[info->drv_index] = -1;
......@@ -812,11 +792,11 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
printk(KERN_DEBUG "Msusp ttyI%d\n", info->line);
#endif
l = strlen(id);
if ((info->isdn_driver >= 0)) {
if ((info->isdn_slot >= 0)) {
cmd.parm.cmsg.Length = l+18;
cmd.parm.cmsg.Command = CAPI_FACILITY;
cmd.parm.cmsg.Subcommand = CAPI_REQ;
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
cmd.parm.cmsg.adr.Controller = isdn_slot_driver(info->isdn_slot) + 1;
cmd.parm.cmsg.para[0] = 3; /* 16 bit 0x0003 suplementary service */
cmd.parm.cmsg.para[1] = 0;
cmd.parm.cmsg.para[2] = l + 3;
......@@ -824,10 +804,7 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
cmd.parm.cmsg.para[4] = 0;
cmd.parm.cmsg.para[5] = l;
strncpy(&cmd.parm.cmsg.para[6], id, l);
cmd.command = CAPI_PUT_MESSAGE;
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, CAPI_PUT_MESSAGE, &cmd);
}
}
......@@ -876,38 +853,25 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
restore_flags(flags);
isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else {
info->isdn_driver = dev->drvmap[i];
info->isdn_channel = dev->chanmap[i];
info->drv_index = i;
info->isdn_slot = i;
dev->m_idx[i] = info->line;
dev->usage[i] |= ISDN_USAGE_OUTGOING;
info->last_dir = 1;
// strcpy(info->last_num, n);
isdn_info_update();
restore_flags(flags);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_CLREAZ;
isdn_command(&cmd);
strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver));
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETEAZ;
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL2;
isdn_slot_command(info->isdn_slot, ISDN_CMD_CLREAZ, &cmd);
strcpy(cmd.parm.num, isdn_slot_map_eaz2msn(info->isdn_slot, m->msn));
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETEAZ, &cmd);
info->last_l2 = l2;
cmd.arg = info->isdn_channel + (l2 << 8);
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8);
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.arg = l2 << 8;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = m->mdmreg[REG_L3PROT] << 8;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL3, &cmd);
cmd.parm.cmsg.Length = l+18;
cmd.parm.cmsg.Command = CAPI_FACILITY;
cmd.parm.cmsg.Subcommand = CAPI_REQ;
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
cmd.parm.cmsg.adr.Controller = isdn_slot_driver(info->isdn_slot) + 1;
cmd.parm.cmsg.para[0] = 3; /* 16 bit 0x0003 suplementary service */
cmd.parm.cmsg.para[1] = 0;
cmd.parm.cmsg.para[2] = l+3;
......@@ -915,11 +879,10 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
cmd.parm.cmsg.para[4] = 0;
cmd.parm.cmsg.para[5] = l;
strncpy(&cmd.parm.cmsg.para[6], id, l);
cmd.command =CAPI_PUT_MESSAGE;
info->dialing = 1;
// strcpy(dev->num[i], n);
isdn_info_update();
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, CAPI_PUT_MESSAGE, &cmd);
isdn_timer_ctrl(ISDN_TIMER_CARRIER, 1);
}
}
......@@ -970,46 +933,33 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
restore_flags(flags);
isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else {
info->isdn_driver = dev->drvmap[i];
info->isdn_channel = dev->chanmap[i];
info->isdn_slot = i;
info->drv_index = i;
dev->m_idx[i] = info->line;
dev->usage[i] |= ISDN_USAGE_OUTGOING;
info->last_dir = 1;
isdn_info_update();
restore_flags(flags);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_CLREAZ;
isdn_command(&cmd);
strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver));
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETEAZ;
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL2;
isdn_slot_command(info->isdn_slot, ISDN_CMD_CLREAZ, &cmd);
strcpy(cmd.parm.num, isdn_slot_map_eaz2msn(info->isdn_slot, m->msn));
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETEAZ, &cmd);
info->last_l2 = l2;
cmd.arg = info->isdn_channel + (l2 << 8);
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8);
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.arg = l2 << 8;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = m->mdmreg[REG_L3PROT] << 8;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL3, &cmd);
cmd.parm.cmsg.Length = l+14;
cmd.parm.cmsg.Command = CAPI_MANUFACTURER;
cmd.parm.cmsg.Subcommand = CAPI_REQ;
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
cmd.parm.cmsg.adr.Controller = isdn_slot_driver(info->isdn_slot) + 1;
cmd.parm.cmsg.para[0] = l+1;
strncpy(&cmd.parm.cmsg.para[1], msg, l);
cmd.parm.cmsg.para[l+1] = 0xd;
cmd.command =CAPI_PUT_MESSAGE;
/* info->dialing = 1;
strcpy(dev->num[i], n);
isdn_info_update();
*/
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, CAPI_PUT_MESSAGE, &cmd);
}
}
......@@ -1173,6 +1123,7 @@ isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int co
{
int c;
int total = 0;
int di;
modem_info *info = (modem_info *) tty->driver_data;
atemu *m = &info->emu;
......@@ -1186,8 +1137,9 @@ isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int co
c = count;
if (c > info->xmit_size - info->xmit_count)
c = info->xmit_size - info->xmit_count;
if (info->isdn_driver >= 0 && c > dev->drv[info->isdn_driver]->maxbufsize)
c = dev->drv[info->isdn_driver]->maxbufsize;
di = isdn_slot_driver(info->isdn_slot);
if (di >= 0 && c > dev->drv[di]->maxbufsize)
c = dev->drv[di]->maxbufsize;
if (c <= 0)
break;
if ((info->online > 1)
......@@ -1247,12 +1199,9 @@ isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int co
if (info->vonline & 4) { /* ETX seen */
isdn_ctrl c;
c.command = ISDN_CMD_FAXCMD;
c.driver = info->isdn_driver;
c.arg = info->isdn_channel;
c.parm.aux.cmd = ISDN_FAX_CLASS1_CTRL;
c.parm.aux.subcmd = ETX;
isdn_command(&c);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &c);
}
info->vonline = 0;
#ifdef ISDN_DEBUG_MODEM_VOICE
......@@ -2100,8 +2049,7 @@ isdn_tty_init(void)
info->normal_termios = m->tty_modem.init_termios;
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
info->isdn_driver = -1;
info->isdn_channel = -1;
info->isdn_slot = -1;
info->drv_index = -1;
info->xmit_size = ISDN_SERIAL_XMIT_SIZE;
skb_queue_head_init(&info->xmit_queue);
......@@ -2265,16 +2213,14 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
#ifndef FIX_FILE_TRANSFER
(info->flags & ISDN_ASYNC_NORMAL_ACTIVE) &&
#endif
(info->isdn_driver == -1) &&
(info->isdn_channel == -1) &&
(info->isdn_slot == -1) &&
(USG_NONE(dev->usage[idx]))) {
int matchret;
if ((matchret = isdn_tty_match_icall(eaz, &info->emu, di)) > wret)
wret = matchret;
if (!matchret) { /* EAZ is matching */
info->isdn_driver = di;
info->isdn_channel = ch;
info->isdn_slot = idx;
info->drv_index = idx;
dev->m_idx[idx] = info->line;
dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE;
......@@ -2328,8 +2274,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
#ifdef ISDN_TTY_STAT_DEBUG
printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line);
#endif
if ((info->isdn_driver == c->driver) &&
(info->isdn_channel == c->arg)) {
if ((info->isdn_slot == isdn_dc2minor(c->driver, c->arg))) {
info->msr |= UART_MSR_CTS;
if (info->send_outstanding)
if (!(--info->send_outstanding))
......@@ -2459,7 +2404,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
#endif
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
info = &dev->mdm.info[i];
if (info->isdn_driver == c->driver) {
if (isdn_slot_driver(info->isdn_slot) == c->driver) {
if (info->online)
isdn_tty_modem_hup(info, 1);
}
......@@ -2511,6 +2456,7 @@ isdn_tty_at_cout(char *msg, modem_info * info)
ulong flags;
struct sk_buff *skb = 0;
char *sp = 0;
int di,ch;
if (!msg) {
printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n");
......@@ -2526,8 +2472,9 @@ isdn_tty_at_cout(char *msg, modem_info * info)
/* use queue instead of direct flip, if online and */
/* data is in queue or flip buffer is full */
di = isdn_slot_driver(info->isdn_slot); ch = isdn_slot_channel(info->isdn_slot);
if ((info->online) && (((tty->flip.count + strlen(msg)) >= TTY_FLIPBUF_SIZE) ||
(!skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel])))) {
(!skb_queue_empty(&dev->drv[di]->rpqueue[ch])))) {
skb = alloc_skb(strlen(msg)
#ifdef CONFIG_ISDN_AUDIO
+ sizeof(isdn_audio_skb)
......@@ -2570,8 +2517,8 @@ isdn_tty_at_cout(char *msg, modem_info * info)
}
}
if (skb) {
__skb_queue_tail(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel], skb);
dev->drv[info->isdn_driver]->rcvcount[info->isdn_channel] += skb->len;
__skb_queue_tail(&dev->drv[di]->rpqueue[ch], skb);
dev->drv[di]->rcvcount[ch] += skb->len;
restore_flags(flags);
/* Schedule dequeuing */
if ((dev->modempoll) && (info->rcvsched))
......@@ -2589,7 +2536,7 @@ isdn_tty_at_cout(char *msg, modem_info * info)
static void
isdn_tty_on_hook(modem_info * info)
{
if (info->isdn_channel >= 0) {
if (info->isdn_slot >= 0) {
#ifdef ISDN_DEBUG_MODEM_HUP
printk(KERN_DEBUG "Mhup in isdn_tty_on_hook\n");
#endif
......@@ -3304,24 +3251,18 @@ isdn_tty_cmd_ATA(modem_info * info)
l2 = ISDN_PROTO_L2_X75I;
}
#endif
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL2;
cmd.arg = info->isdn_channel + (l2 << 8);
cmd.arg = l2 << 8;
info->last_l2 = l2;
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8);
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = m->mdmreg[REG_L3PROT] << 8;
#ifdef CONFIG_ISDN_TTY_FAX
if (l2 == ISDN_PROTO_L2_FAX) {
cmd.parm.fax = info->fax;
info->fax->direction = ISDN_TTY_FAX_CONN_IN;
}
#endif
isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_ACCEPTD;
isdn_slot_command(info->isdn_slot, ISDN_CMD_SETL3, &cmd);
isdn_slot_command(info->isdn_slot, ISDN_CMD_ACCEPTD, &cmd);
info->dialing = 16;
info->emu.carrierwait = 0;
isdn_command(&cmd);
......@@ -3680,12 +3621,10 @@ isdn_tty_cmd_PLUSV(char **p, modem_info * info)
PARSE_ERROR1;
m->vpar[4] = par1;
m->vpar[5] = par2;
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_AUDIO;
cmd.arg = info->isdn_channel + (ISDN_AUDIO_SETDD << 8);
cmd.arg = ISDN_AUDIO_SETDD << 8;
cmd.parm.num[0] = par1;
cmd.parm.num[1] = par2;
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, ISDN_CMD_AUDIO, &cmd);
break;
} else
if (*p[0] == '?') {
......
......@@ -74,7 +74,7 @@ isdn_tty_fax_modem_result(int code, modem_info * info)
case 2: /* +FCON */
/* Append CPN, if enabled */
if ((m->mdmreg[REG_CPNFCON] & BIT_CPNFCON) &&
(!(dev->usage[info->isdn_channel] & ISDN_USAGE_OUTGOING))) {
(!(dev->usage[info->isdn_slot] & ISDN_USAGE_OUTGOING))) {
sprintf(rs, "/%s", m->cpn);
isdn_tty_at_cout(rs, info);
}
......@@ -360,12 +360,11 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
default:
PARSE_ERROR1;
}
c.command = ISDN_CMD_FAXCMD;
#ifdef ISDN_TTY_FAX_CMD_DEBUG
printk(KERN_DEBUG "isdn_tty_cmd_FCLASS1 %d/%d/%d)\n",
c.parm.aux.cmd, c.parm.aux.subcmd, c.parm.aux.para[0]);
#endif
if (info->isdn_driver < 0) {
if (info->isdn_slot < 0) {
save_flags(flags);
cli();
if ((c.parm.aux.subcmd == AT_EQ_VALUE) ||
......@@ -380,26 +379,19 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
restore_flags(flags);
PARSE_ERROR1;
}
info->isdn_driver = dev->drvmap[i];
info->isdn_channel = dev->chanmap[i];
info->isdn_slot = i;
info->drv_index = i;
dev->m_idx[i] = info->line;
c.driver = info->isdn_driver;
c.arg = info->isdn_channel;
isdn_command(&c);
isdn_free_channel(info->isdn_driver, info->isdn_channel,
ISDN_USAGE_FAX);
info->isdn_driver = -1;
info->isdn_channel = -1;
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &c);
isdn_slot_free(info->isdn_slot, ISDN_USAGE_FAX);
info->isdn_slot = -1;
if (info->drv_index >= 0) {
dev->m_idx[info->drv_index] = -1;
info->drv_index = -1;
}
restore_flags(flags);
} else {
c.driver = info->isdn_driver;
c.arg = info->isdn_channel;
isdn_command(&c);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &c);
}
return 1;
}
......@@ -800,10 +792,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
printk(KERN_DEBUG "isdn_tty: Fax FDR\n");
#endif
f->code = ISDN_TTY_FAX_DR;
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_FAXCMD;
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &cmd);
if (f->phase == ISDN_FAX_PHASE_B) {
f->phase = ISDN_FAX_PHASE_C;
} else if (f->phase == ISDN_FAX_PHASE_D) {
......@@ -855,10 +844,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
#endif
if ((f->phase == ISDN_FAX_PHASE_B) || (f->phase == ISDN_FAX_PHASE_D)) {
f->code = ISDN_TTY_FAX_DT;
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_FAXCMD;
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &cmd);
if (f->phase == ISDN_FAX_PHASE_D) {
f->phase = ISDN_FAX_PHASE_C;
isdn_tty_fax_modem_result(7, info); /* CONNECT */
......@@ -913,10 +899,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
PARSE_ERROR1;
f->fet = par;
f->code = ISDN_TTY_FAX_ET;
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_FAXCMD;
isdn_command(&cmd);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &cmd);
#ifdef ISDN_TTY_FAX_STAT_DEBUG
printk(KERN_DEBUG "isdn_tty: Fax FET=%d\n", par);
#endif
......
......@@ -292,8 +292,7 @@ typedef struct isdn_net_local_s {
ulong magic;
char name[10]; /* Name of device */
struct net_device_stats stats; /* Ethernet Statistics */
int isdn_device; /* Index to isdn-device */
int isdn_channel; /* Index to isdn-channel */
int isdn_slot; /* Index to isdn device/channel */
int ppp_slot; /* PPPD device slot number */
int pre_device; /* Preselected isdn-device */
int pre_channel; /* Preselected isdn-channel */
......@@ -480,8 +479,7 @@ typedef struct modem_info {
/* 2 = B-Channel is up, deliver d.*/
int dialing; /* Dial in progress or ATA */
int rcvsched; /* Receive needs schedule */
int isdn_driver; /* Index to isdn-driver */
int isdn_channel; /* Index to isdn-channel */
int isdn_slot; /* Index to isdn-driver/channel */
int drv_index; /* Index to dev->usage */
int ncarrier; /* Flag: schedule NO CARRIER */
unsigned char last_cause[8]; /* Last cause message */
......@@ -608,8 +606,6 @@ typedef struct isdn_devt {
infostruct *infochain; /* List of open info-devs. */
wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
struct timer_list timer; /* Misc.-function Timer */
int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */
int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */
int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */
char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
/* Remote number of active ch.*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment