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