Commit 0bba2356 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Assorted cleanups

Remove the legacy functions
  
    isdn_slot_readbchan(int slot, u_char *, u_char *, int);
    isdn_slot_driver(int slot);
    isdn_slot_channel(int slot);
    isdn_slot_set_usage(int slot, int usage);
    isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb);
    isdn_drv_hdrlen(int di);
  
Most of their tasks have been taken over by isdn_common.c, or are
obsoleted by using the isdn_slot based approach.
parent 620a0018
...@@ -517,8 +517,6 @@ isdn_audio_eval_dtmf(modem_info * info) ...@@ -517,8 +517,6 @@ isdn_audio_eval_dtmf(modem_info * info)
dtmf_state *s; dtmf_state *s;
int silence; int silence;
int i; int i;
int di;
int ch;
unsigned long flags; unsigned long flags;
int grp[2]; int grp[2];
char what; char what;
...@@ -563,8 +561,6 @@ isdn_audio_eval_dtmf(modem_info * info) ...@@ -563,8 +561,6 @@ 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 = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
isdn_tty_queue_tail(info, skb, 2); isdn_tty_queue_tail(info, skb, 2);
restore_flags(flags); restore_flags(flags);
/* Schedule dequeuing */ /* Schedule dequeuing */
...@@ -658,8 +654,6 @@ isdn_audio_put_dle_code(modem_info * info, u_char code) ...@@ -658,8 +654,6 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
{ {
struct sk_buff *skb; struct sk_buff *skb;
unsigned long flags; unsigned long flags;
int di;
int ch;
char *p; char *p;
skb = dev_alloc_skb(2); skb = dev_alloc_skb(2);
...@@ -682,8 +676,6 @@ isdn_audio_put_dle_code(modem_info * info, u_char code) ...@@ -682,8 +676,6 @@ 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 = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
isdn_tty_queue_tail(info, skb, 2); isdn_tty_queue_tail(info, skb, 2);
restore_flags(flags); restore_flags(flags);
/* Schedule dequeuing */ /* Schedule dequeuing */
......
...@@ -35,9 +35,9 @@ MODULE_LICENSE("GPL"); ...@@ -35,9 +35,9 @@ MODULE_LICENSE("GPL");
isdn_dev *dev; isdn_dev *dev;
static int isdn_command(isdn_ctrl *cmd);
static void isdn_register_devfs(int); static void isdn_register_devfs(int);
static void isdn_unregister_devfs(int); static void isdn_unregister_devfs(int);
static int isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb);
/* ====================================================================== */ /* ====================================================================== */
...@@ -209,10 +209,11 @@ slot_dial(struct fsm_inst *fi, int pr, void *arg) ...@@ -209,10 +209,11 @@ slot_dial(struct fsm_inst *fi, int pr, void *arg)
static int static int
slot_acceptd(struct fsm_inst *fi, int pr, void *arg) slot_acceptd(struct fsm_inst *fi, int pr, void *arg)
{ {
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg; isdn_ctrl *ctrl = arg;
int retval; int retval;
retval = isdn_command(ctrl); retval = __slot_command(slot, ctrl);
if (retval >= 0) if (retval >= 0)
fsm_change_state(fi, ST_SLOT_WAIT_DCONN); fsm_change_state(fi, ST_SLOT_WAIT_DCONN);
...@@ -222,10 +223,11 @@ slot_acceptd(struct fsm_inst *fi, int pr, void *arg) ...@@ -222,10 +223,11 @@ slot_acceptd(struct fsm_inst *fi, int pr, void *arg)
static int static int
slot_acceptb(struct fsm_inst *fi, int pr, void *arg) slot_acceptb(struct fsm_inst *fi, int pr, void *arg)
{ {
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg; isdn_ctrl *ctrl = arg;
int retval; int retval;
retval = isdn_command(ctrl); retval = __slot_command(slot, ctrl);
if (retval >= 0) if (retval >= 0)
fsm_change_state(fi, ST_SLOT_WAIT_BCONN); fsm_change_state(fi, ST_SLOT_WAIT_BCONN);
...@@ -235,10 +237,11 @@ slot_acceptb(struct fsm_inst *fi, int pr, void *arg) ...@@ -235,10 +237,11 @@ slot_acceptb(struct fsm_inst *fi, int pr, void *arg)
static int static int
slot_actv_hangup(struct fsm_inst *fi, int pr, void *arg) slot_actv_hangup(struct fsm_inst *fi, int pr, void *arg)
{ {
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg; isdn_ctrl *ctrl = arg;
int retval; int retval;
retval = isdn_command(ctrl); retval = __slot_command(slot, ctrl);
if (retval >= 0) if (retval >= 0)
fsm_change_state(fi, ST_SLOT_WAIT_BHUP); fsm_change_state(fi, ST_SLOT_WAIT_BHUP);
...@@ -384,7 +387,6 @@ static int ...@@ -384,7 +387,6 @@ static int
slot_unbind(struct fsm_inst *fi, int pr, void *arg) slot_unbind(struct fsm_inst *fi, int pr, void *arg)
{ {
struct isdn_slot *slot = fi->userdata; struct isdn_slot *slot = fi->userdata;
int sl = slot - slots;
strcpy(slot->num, "???"); strcpy(slot->num, "???");
slot->ibytes = 0; slot->ibytes = 0;
...@@ -395,7 +397,8 @@ slot_unbind(struct fsm_inst *fi, int pr, void *arg) ...@@ -395,7 +397,8 @@ slot_unbind(struct fsm_inst *fi, int pr, void *arg)
isdn_v110_close(slot->iv110.v110); isdn_v110_close(slot->iv110.v110);
slot->iv110.v110 = NULL; slot->iv110.v110 = NULL;
// 20.10.99 JIM, try to reinitialize v110 ! // 20.10.99 JIM, try to reinitialize v110 !
isdn_slot_set_usage(sl, ISDN_USAGE_NONE); slot->usage = ISDN_USAGE_NONE;
isdn_info_update();
return 0; return 0;
} }
...@@ -495,18 +498,12 @@ struct isdn_driver { ...@@ -495,18 +498,12 @@ struct isdn_driver {
struct fsm_inst fi; struct fsm_inst fi;
} driver; } driver;
static int __drv_command(struct isdn_driver *drv, isdn_ctrl *cmd);
static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED; static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED;
static struct isdn_driver *drivers[ISDN_MAX_DRIVERS]; static struct isdn_driver *drivers[ISDN_MAX_DRIVERS];
int static int
isdn_drv_maxbufsize(int di)
{
BUG_ON(di < 0);
return drivers[di]->maxbufsize;
}
int
isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb) isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb)
{ {
struct sk_buff *skb2; struct sk_buff *skb2;
...@@ -514,7 +511,7 @@ isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb) ...@@ -514,7 +511,7 @@ isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb)
int hl = drv->interface->hl_hdrlen; int hl = drv->interface->hl_hdrlen;
int retval; int retval;
if( skb_headroom(skb) >= hl ) if (skb_headroom(skb) >= hl)
return drivers[di]->interface->writebuf_skb(di, ch, 1, skb); return drivers[di]->interface->writebuf_skb(di, ch, 1, skb);
skb2 = skb_realloc_headroom(skb, hl); skb2 = skb_realloc_headroom(skb, hl);
...@@ -530,12 +527,6 @@ isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb) ...@@ -530,12 +527,6 @@ isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb)
return retval; return retval;
} }
int
isdn_drv_hdrlen(int di)
{
return drivers[di]->interface->hl_hdrlen;
}
int int
__isdn_drv_lookup(char *drvid) __isdn_drv_lookup(char *drvid)
{ {
...@@ -638,7 +629,6 @@ set_global_features(void) ...@@ -638,7 +629,6 @@ set_global_features(void)
static int isdn_add_channels(struct isdn_driver *, int, int, int); static int isdn_add_channels(struct isdn_driver *, int, int, int);
static void isdn_receive_skb_callback(int di, int ch, struct sk_buff *skb); static void isdn_receive_skb_callback(int di, int ch, struct sk_buff *skb);
static int isdn_status_callback(isdn_ctrl * c); static int isdn_status_callback(isdn_ctrl * c);
static void set_global_features(void);
static int static int
drv_register(struct fsm_inst *fi, int pr, void *arg) drv_register(struct fsm_inst *fi, int pr, void *arg)
...@@ -688,10 +678,9 @@ drv_stat_unload(struct fsm_inst *fi, int pr, void *arg) ...@@ -688,10 +678,9 @@ drv_stat_unload(struct fsm_inst *fi, int pr, void *arg)
cmd.driver = drv->di; cmd.driver = drv->di;
cmd.arg = 0; cmd.arg = 0;
cmd.command = ISDN_CMD_UNLOCK; cmd.command = ISDN_CMD_UNLOCK;
isdn_command(&cmd); __drv_command(drv, &cmd);
drv->locks--; drv->locks--;
} }
// isdn_tty_stat_callback(i, c); FIXME?
for (i = 0; i < ISDN_MAX_CHANNELS; i++) { for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if (slots[i].di == drv->di) { if (slots[i].di == drv->di) {
slots[i].di = -1; slots[i].di = -1;
...@@ -958,9 +947,9 @@ isdn_status_callback(isdn_ctrl *c) ...@@ -958,9 +947,9 @@ isdn_status_callback(isdn_ctrl *c)
if ((slots[i].di == di) && if ((slots[i].di == di) &&
(slots[i].ch == c->arg)) { (slots[i].ch == c->arg)) {
if (c->parm.num[0]) if (c->parm.num[0])
isdn_slot_set_usage(i, isdn_slot_usage(i) & ~ISDN_USAGE_DISABLED); slots[i].usage &= ~ISDN_USAGE_DISABLED;
else if (USG_NONE(isdn_slot_usage(i))) else if (USG_NONE(isdn_slot_usage(i)))
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_DISABLED); slots[i].usage |= ISDN_USAGE_DISABLED;
else else
retval = -1; retval = -1;
break; break;
...@@ -1064,7 +1053,7 @@ isdn_lock_drivers(void) ...@@ -1064,7 +1053,7 @@ isdn_lock_drivers(void)
cmd.driver = i; cmd.driver = i;
cmd.arg = 0; cmd.arg = 0;
cmd.command = ISDN_CMD_LOCK; cmd.command = ISDN_CMD_LOCK;
isdn_command(&cmd); __drv_command(drivers[i], &cmd);
drivers[i]->locks++; drivers[i]->locks++;
} }
spin_unlock_irqrestore(&drivers_lock, flags); spin_unlock_irqrestore(&drivers_lock, flags);
...@@ -1093,7 +1082,7 @@ isdn_unlock_drivers(void) ...@@ -1093,7 +1082,7 @@ isdn_unlock_drivers(void)
cmd.driver = i; cmd.driver = i;
cmd.arg = 0; cmd.arg = 0;
cmd.command = ISDN_CMD_UNLOCK; cmd.command = ISDN_CMD_UNLOCK;
isdn_command(&cmd); __drv_command(drivers[i], &cmd);
drivers[i]->locks--; drivers[i]->locks--;
} }
} }
...@@ -1354,41 +1343,6 @@ __slot_command(struct isdn_slot *slot, isdn_ctrl *cmd) ...@@ -1354,41 +1343,6 @@ __slot_command(struct isdn_slot *slot, isdn_ctrl *cmd)
return __drv_command(drv, cmd); return __drv_command(drv, cmd);
} }
static int
isdn_command(isdn_ctrl *cmd)
{
int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255);
if (cmd->driver == -1) {
isdn_BUG();
return 1;
}
if (cmd->command == ISDN_CMD_SETL2) {
unsigned long l2prot = (cmd->arg >> 8) & 255;
unsigned long features = (drivers[cmd->driver]->interface->features
>> ISDN_FEATURE_L2_SHIFT) &
ISDN_FEATURE_L2_MASK;
unsigned long l2_feature = (1 << l2prot);
switch (l2prot) {
case ISDN_PROTO_L2_V11096:
case ISDN_PROTO_L2_V11019:
case ISDN_PROTO_L2_V11038:
/* If V.110 requested, but not supported by
* HL-driver, set emulator-flag and change
* Layer-2 to transparent
*/
if (!(features & l2_feature)) {
slots[idx].iv110.v110emu = l2prot;
cmd->arg = (cmd->arg & 255) |
(ISDN_PROTO_L2_TRANS << 8);
} else
slots[idx].iv110.v110emu = 0;
}
}
return __drv_command(drivers[cmd->driver], cmd);
}
/* /*
* Begin of a CAPI like LL<->HL interface, currently used only for * Begin of a CAPI like LL<->HL interface, currently used only for
* supplementary service (CAPI 2.0 part III) * supplementary service (CAPI 2.0 part III)
...@@ -1425,8 +1379,6 @@ isdn_getnum(char **p) ...@@ -1425,8 +1379,6 @@ isdn_getnum(char **p)
return v; return v;
} }
#define DLE 0x10
static __inline int static __inline int
isdn_minor2drv(int minor) isdn_minor2drv(int minor)
{ {
...@@ -1484,7 +1436,7 @@ isdn_statstr(void) ...@@ -1484,7 +1436,7 @@ isdn_statstr(void)
sprintf(p, "\nphone:\t"); sprintf(p, "\nphone:\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 ", isdn_slot_num(i)); sprintf(p, "%s ", slots[i].num);
p = istatbuf + strlen(istatbuf); p = istatbuf + strlen(istatbuf);
} }
sprintf(p, "\n"); sprintf(p, "\n");
...@@ -2015,7 +1967,7 @@ isdn_ctrl_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -2015,7 +1967,7 @@ isdn_ctrl_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
c.command = ISDN_CMD_IOCTL; c.command = ISDN_CMD_IOCTL;
c.arg = cmd; c.arg = cmd;
memcpy(c.parm.num, (char *) &iocts.arg, sizeof(ulong)); memcpy(c.parm.num, (char *) &iocts.arg, sizeof(ulong));
ret = isdn_command(&c); ret = __drv_command(drivers[drvidx], &c);
memcpy((char *) &iocts.arg, c.parm.num, sizeof(ulong)); memcpy((char *) &iocts.arg, c.parm.num, sizeof(ulong));
if (copy_to_user((char *) arg, &iocts, sizeof(isdn_ioctl_struct))) if (copy_to_user((char *) arg, &iocts, sizeof(isdn_ioctl_struct)))
return -EFAULT; return -EFAULT;
...@@ -2111,6 +2063,7 @@ int ...@@ -2111,6 +2063,7 @@ int
isdn_get_free_slot(int usage, int l2_proto, int l3_proto, isdn_get_free_slot(int usage, int l2_proto, int l3_proto,
int pre_dev, int pre_chan, char *msn) int pre_dev, int pre_chan, char *msn)
{ {
struct isdn_slot *slot;
int i; int i;
ulong flags; ulong flags;
ulong features; ulong features;
...@@ -2126,24 +2079,32 @@ isdn_get_free_slot(int usage, int l2_proto, int l3_proto, ...@@ -2126,24 +2079,32 @@ isdn_get_free_slot(int usage, int l2_proto, int l3_proto,
* because we can emulate this in linklevel. * because we can emulate this in linklevel.
*/ */
for (i = 0; i < ISDN_MAX_CHANNELS; i++) for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if (USG_NONE(slots[i].usage) && slot = &slots[i];
(slots[i].di != -1)) {
int d = slots[i].di; if (drivers[slot->di]->fi.state != ST_DRV_RUNNING)
if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
continue; continue;
if (!USG_NONE(slots[i].usage))
continue;
if (slots[i].usage & ISDN_USAGE_DISABLED) if (slots[i].usage & ISDN_USAGE_DISABLED)
continue; /* usage not allowed */
if (drivers[d]->fi.state != ST_DRV_RUNNING)
continue; continue;
if (((drivers[d]->interface->features & features) == features) || if (slots[i].di == -1)
(((drivers[d]->interface->features & vfeatures) == vfeatures) && continue;
(drivers[d]->interface->features & ISDN_FEATURE_L2_TRANS))) {
if (strcmp(isdn_map_eaz2msn(msn, slot->di), "-") == 0)
continue;
if (((drivers[slot->di]->interface->features & features) == features) ||
(((drivers[slot->di]->interface->features & vfeatures) == vfeatures) &&
(drivers[slot->di]->interface->features & ISDN_FEATURE_L2_TRANS))) {
if (pre_dev < 0 || pre_chan < 0 || if (pre_dev < 0 || pre_chan < 0 ||
(pre_dev == d && pre_chan == slots[i].ch)) { (pre_dev == slot->di && pre_chan == slot->ch)) {
isdn_slot_set_usage(i, usage); slot->usage = usage;
fsm_event(&slots[i].fi, EV_SLOT_BIND, NULL); isdn_info_update();
fsm_event(&slot->fi, EV_SLOT_BIND, NULL);
return i; return i;
} }
} }
...@@ -2341,48 +2302,46 @@ EXPORT_SYMBOL(isdn_ppp_unregister_compressor); ...@@ -2341,48 +2302,46 @@ EXPORT_SYMBOL(isdn_ppp_unregister_compressor);
#endif #endif
int int
isdn_slot_driver(int sl) isdn_slot_maxbufsize(int sl)
{
BUG_ON(sl < 0);
return slots[sl].di;
}
int
isdn_slot_channel(int sl)
{ {
BUG_ON(sl < 0); BUG_ON(sl < 0);
return slots[sl].ch; return slots[sl].drv->maxbufsize;
} }
int int
isdn_slot_hdrlen(int sl) isdn_slot_hdrlen(int sl)
{ {
int di = isdn_slot_driver(sl); struct isdn_slot *slot = &slots[sl];
return drivers[di]->interface->hl_hdrlen; BUG_ON(sl < 0);
return slot->drv->interface->hl_hdrlen;
} }
char * char *
isdn_slot_map_eaz2msn(int sl, char *msn) isdn_slot_map_eaz2msn(int sl, char *msn)
{ {
int di = isdn_slot_driver(sl); struct isdn_slot *slot = &slots[sl];
BUG_ON(sl < 0);
return isdn_map_eaz2msn(msn, di); return isdn_map_eaz2msn(msn, slot->di);
} }
int int
isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl) isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
{ {
struct isdn_slot *slot = &slots[sl];
ctrl->command = cmd; ctrl->command = cmd;
ctrl->driver = isdn_slot_driver(sl); ctrl->driver = slot->di;
switch (cmd) { switch (cmd) {
case ISDN_CMD_SETL2: case ISDN_CMD_SETL2:
case ISDN_CMD_SETL3: case ISDN_CMD_SETL3:
case ISDN_CMD_PROT_IO: case ISDN_CMD_PROT_IO:
ctrl->arg &= ~0xff; ctrl->arg |= isdn_slot_channel(sl); ctrl->arg &= ~0xff; ctrl->arg |= slot->ch;
break; break;
case ISDN_CMD_DIAL: case ISDN_CMD_DIAL:
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
...@@ -2390,26 +2349,26 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl) ...@@ -2390,26 +2349,26 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
/* fall through */ /* fall through */
default: default:
ctrl->arg = isdn_slot_channel(sl); ctrl->arg = slot->ch;
break; break;
} }
switch (cmd) { switch (cmd) {
case ISDN_CMD_CLREAZ: case ISDN_CMD_CLREAZ:
return fsm_event(&slots[sl].fi, EV_CMD_CLREAZ, ctrl); return fsm_event(&slot->fi, EV_CMD_CLREAZ, ctrl);
case ISDN_CMD_SETEAZ: case ISDN_CMD_SETEAZ:
return fsm_event(&slots[sl].fi, EV_CMD_SETEAZ, ctrl); return fsm_event(&slot->fi, EV_CMD_SETEAZ, ctrl);
case ISDN_CMD_SETL2: case ISDN_CMD_SETL2:
return fsm_event(&slots[sl].fi, EV_CMD_SETL2, ctrl); return fsm_event(&slot->fi, EV_CMD_SETL2, ctrl);
case ISDN_CMD_SETL3: case ISDN_CMD_SETL3:
return fsm_event(&slots[sl].fi, EV_CMD_SETL3, ctrl); return fsm_event(&slot->fi, EV_CMD_SETL3, ctrl);
case ISDN_CMD_DIAL: case ISDN_CMD_DIAL:
return fsm_event(&slots[sl].fi, EV_CMD_DIAL, ctrl); return fsm_event(&slot->fi, EV_CMD_DIAL, ctrl);
case ISDN_CMD_ACCEPTD: case ISDN_CMD_ACCEPTD:
return fsm_event(&slots[sl].fi, EV_CMD_ACCEPTD, ctrl); return fsm_event(&slot->fi, EV_CMD_ACCEPTD, ctrl);
case ISDN_CMD_ACCEPTB: case ISDN_CMD_ACCEPTB:
return fsm_event(&slots[sl].fi, EV_CMD_ACCEPTB, ctrl); return fsm_event(&slot->fi, EV_CMD_ACCEPTB, ctrl);
case ISDN_CMD_HANGUP: case ISDN_CMD_HANGUP:
return fsm_event(&slots[sl].fi, EV_CMD_HANGUP, ctrl); return fsm_event(&slot->fi, EV_CMD_HANGUP, ctrl);
} }
HERE; HERE;
return -1; return -1;
...@@ -2418,18 +2377,22 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl) ...@@ -2418,18 +2377,22 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
int int
isdn_slot_dial(int sl, struct dial_info *dial) isdn_slot_dial(int sl, struct dial_info *dial)
{ {
struct isdn_slot *slot = &slots[sl];
isdn_ctrl cmd; isdn_ctrl cmd;
int retval; int retval;
char *msn = isdn_slot_map_eaz2msn(sl, dial->msn); char *msn = isdn_slot_map_eaz2msn(sl, dial->msn);
BUG_ON(sl < 0);
/* check for DOV */ /* check for DOV */
if (dial->si1 == 7 && tolower(dial->phone[0]) == 'v') { /* DOV call */ if (dial->si1 == 7 && tolower(dial->phone[0]) == 'v') { /* DOV call */
dial->si1 = 1; dial->si1 = 1;
dial->phone++; /* skip v/V */ dial->phone++; /* skip v/V */
} }
strcpy(isdn_slot_num(sl), dial->phone); strcpy(slot->num, dial->phone);
isdn_slot_set_usage(sl, isdn_slot_usage(sl) | ISDN_USAGE_OUTGOING); slot->usage |= ISDN_USAGE_OUTGOING;
isdn_info_update();
retval = isdn_slot_command(sl, ISDN_CMD_CLREAZ, &cmd); retval = isdn_slot_command(sl, ISDN_CMD_CLREAZ, &cmd);
if (retval) if (retval)
...@@ -2479,15 +2442,6 @@ isdn_slot_usage(int sl) ...@@ -2479,15 +2442,6 @@ isdn_slot_usage(int sl)
return slots[sl].usage; return slots[sl].usage;
} }
void
isdn_slot_set_usage(int sl, int usage)
{
BUG_ON(sl < 0);
slots[sl].usage = usage;
isdn_info_update();
}
int int
isdn_slot_m_idx(int sl) isdn_slot_m_idx(int sl)
{ {
...@@ -2665,7 +2619,7 @@ static int __init isdn_init(void) ...@@ -2665,7 +2619,7 @@ static int __init isdn_init(void)
slots[i].di = -1; slots[i].di = -1;
slots[i].ch = -1; slots[i].ch = -1;
slots[i].m_idx = -1; slots[i].m_idx = -1;
strcpy(isdn_slot_num(i), "???"); strcpy(slots[i].num, "???");
init_waitqueue_head(&isdn_mdm.info[i].open_wait); init_waitqueue_head(&isdn_mdm.info[i].open_wait);
init_waitqueue_head(&isdn_mdm.info[i].close_wait); init_waitqueue_head(&isdn_mdm.info[i].close_wait);
slots[i].fi.fsm = &slot_fsm; slots[i].fi.fsm = &slot_fsm;
...@@ -2718,23 +2672,15 @@ static int __init isdn_init(void) ...@@ -2718,23 +2672,15 @@ static int __init isdn_init(void)
*/ */
static void __exit isdn_exit(void) static void __exit isdn_exit(void)
{ {
unsigned long flags;
#ifdef CONFIG_ISDN_PPP #ifdef CONFIG_ISDN_PPP
isdn_ppp_cleanup(); isdn_ppp_cleanup();
#endif #endif
save_flags(flags);
cli();
isdn_net_lib_exit(); isdn_net_lib_exit();
isdn_tty_exit(); isdn_tty_exit();
if (unregister_chrdev(ISDN_MAJOR, "isdn")) unregister_chrdev(ISDN_MAJOR, "isdn");
BUG();
isdn_cleanup_devfs(); isdn_cleanup_devfs();
del_timer(&dev->timer); del_timer_sync(&dev->timer);
restore_flags(flags);
/* call vfree with interrupts enabled, else it will hang */
vfree(dev); vfree(dev);
fsm_free(&drv_fsm); fsm_free(&drv_fsm);
fsm_free(&slot_fsm); fsm_free(&slot_fsm);
......
...@@ -86,12 +86,9 @@ extern int isdn_slot_command(int slot, int cmd, isdn_ctrl *); ...@@ -86,12 +86,9 @@ extern int isdn_slot_command(int slot, int cmd, isdn_ctrl *);
extern int isdn_slot_dial(int slot, struct dial_info *dial); extern int isdn_slot_dial(int slot, struct dial_info *dial);
extern char *isdn_slot_map_eaz2msn(int slot, char *msn); extern char *isdn_slot_map_eaz2msn(int slot, char *msn);
extern int isdn_slot_write(int slot, struct sk_buff *); extern int isdn_slot_write(int slot, struct sk_buff *);
extern int isdn_slot_readbchan(int slot, u_char *, u_char *, int);
extern int isdn_slot_hdrlen(int slot); extern int isdn_slot_hdrlen(int slot);
extern int isdn_slot_driver(int slot); extern int isdn_slot_maxbufsize(int slot);
extern int isdn_slot_channel(int slot);
extern int isdn_slot_usage(int slot); extern int isdn_slot_usage(int slot);
extern void isdn_slot_set_usage(int slot, int usage);
extern char *isdn_slot_num(int slot); extern char *isdn_slot_num(int slot);
extern int isdn_slot_m_idx(int slot); extern int isdn_slot_m_idx(int slot);
extern void isdn_slot_set_m_idx(int slot, int midx); extern void isdn_slot_set_m_idx(int slot, int midx);
...@@ -99,8 +96,5 @@ extern void isdn_slot_set_priv(int sl, int usage, void *priv, int (*stat_cb)(in ...@@ -99,8 +96,5 @@ extern void isdn_slot_set_priv(int sl, int usage, void *priv, int (*stat_cb)(in
extern void *isdn_slot_priv(int sl); extern void *isdn_slot_priv(int sl);
extern int isdn_hard_header_len(void); extern int isdn_hard_header_len(void);
int isdn_drv_maxbufsize(int di);
int isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb);
int isdn_drv_hdrlen(int di);
int isdn_drv_lookup(char *drvid); int isdn_drv_lookup(char *drvid);
char *isdn_drv_drvid(int di); char *isdn_drv_drvid(int di);
...@@ -1431,9 +1431,6 @@ isdn_net_dev_icall(isdn_net_dev *idev, int di, int ch, int si1, ...@@ -1431,9 +1431,6 @@ isdn_net_dev_icall(isdn_net_dev *idev, int di, int ch, int si1,
if (*my_eaz == 'b' || *my_eaz == 'B') if (*my_eaz == 'b' || *my_eaz == 'B')
my_eaz++; /* skip to allow a match */ my_eaz++; /* skip to allow a match */
} }
if (!USG_NONE(isdn_slot_usage(slot))) // FIXME?
return 0;
/* check called number */ /* check called number */
switch (isdn_msncmp(eaz, my_eaz)) { switch (isdn_msncmp(eaz, my_eaz)) {
case 1: /* no match */ case 1: /* no match */
......
...@@ -873,7 +873,6 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m) ...@@ -873,7 +873,6 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
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 = 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;
...@@ -933,7 +932,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) ...@@ -933,7 +932,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
info->isdn_slot = i; info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line); isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1; info->last_dir = 1;
// strcpy(info->last_num, n); // strcpy(info->last_num, n);
restore_flags(flags); restore_flags(flags);
...@@ -945,7 +943,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) ...@@ -945,7 +943,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
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 = 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;
...@@ -1010,7 +1007,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) ...@@ -1010,7 +1007,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
info->isdn_slot = i; info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line); isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1; info->last_dir = 1;
restore_flags(flags); restore_flags(flags);
info->last_l2 = l2; info->last_l2 = l2;
...@@ -1021,7 +1017,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) ...@@ -1021,7 +1017,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
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 = 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;
...@@ -1193,7 +1188,6 @@ isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int co ...@@ -1193,7 +1188,6 @@ 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;
...@@ -1207,12 +1201,8 @@ isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int co ...@@ -1207,12 +1201,8 @@ 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_slot >= 0) if (info->isdn_slot >= 0 && c > isdn_slot_maxbufsize(info->isdn_slot))
di = isdn_slot_driver(info->isdn_slot); c = isdn_slot_maxbufsize(info->isdn_slot);
else
di = -1;
if (di >= 0 && c > isdn_drv_maxbufsize(di))
c = isdn_drv_maxbufsize(di);
if (c <= 0) if (c <= 0)
break; break;
if ((info->online > 1) if ((info->online > 1)
...@@ -2295,13 +2285,12 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup) ...@@ -2295,13 +2285,12 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
if (!matchret) { /* EAZ is matching */ if (!matchret) { /* EAZ is matching */
info->isdn_slot = idx; info->isdn_slot = idx;
isdn_slot_set_m_idx(idx, info->line); isdn_slot_set_m_idx(idx, info->line);
isdn_slot_set_priv(idx, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb); isdn_slot_set_priv(idx, isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]), info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
strcpy(isdn_slot_num(idx), nr); strcpy(isdn_slot_num(idx), nr);
strcpy(info->emu.cpn, eaz); strcpy(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1]; info->emu.mdmreg[REG_SI1I] = si2bit[si1];
info->emu.mdmreg[REG_PLAN] = setup->plan; info->emu.mdmreg[REG_PLAN] = setup->plan;
info->emu.mdmreg[REG_SCREEN] = setup->screen; info->emu.mdmreg[REG_SCREEN] = setup->screen;
isdn_slot_set_usage(idx, (isdn_slot_usage(idx) & ISDN_USAGE_EXCLUSIVE) | isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]));
restore_flags(flags); restore_flags(flags);
printk(KERN_INFO "isdn_tty: call from %s, -> RING on ttyI%d\n", nr, printk(KERN_INFO "isdn_tty: call from %s, -> RING on ttyI%d\n", nr,
info->line); info->line);
...@@ -2450,18 +2439,6 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) ...@@ -2450,18 +2439,6 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
return 1; return 1;
} }
break; break;
case ISDN_STAT_UNLOAD:
#ifdef ISDN_TTY_STAT_DEBUG
printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line);
#endif
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
info = &isdn_mdm.info[i];
if (isdn_slot_driver(info->isdn_slot) == c->driver) {
if (info->online)
isdn_tty_modem_hup(info, 1);
}
}
return 1;
#ifdef CONFIG_ISDN_TTY_FAX #ifdef CONFIG_ISDN_TTY_FAX
case ISDN_STAT_FAXIND: case ISDN_STAT_FAXIND:
if (TTY_IS_ACTIVE(info)) { if (TTY_IS_ACTIVE(info)) {
...@@ -2508,7 +2485,6 @@ isdn_tty_at_cout(char *msg, modem_info * info) ...@@ -2508,7 +2485,6 @@ 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");
...@@ -2524,11 +2500,6 @@ isdn_tty_at_cout(char *msg, modem_info * info) ...@@ -2524,11 +2500,6 @@ 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 */
if (info->isdn_slot >= 0) {
di = isdn_slot_driver(info->isdn_slot); ch = isdn_slot_channel(info->isdn_slot);
} else {
di = -1; ch = -1;
}
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(&info->rpqueue)))) { (!skb_queue_empty(&info->rpqueue)))) {
skb = alloc_skb(strlen(msg) skb = alloc_skb(strlen(msg)
......
...@@ -511,7 +511,7 @@ isdn_v110_encode(isdn_v110_stream * v, struct sk_buff *skb) ...@@ -511,7 +511,7 @@ isdn_v110_encode(isdn_v110_stream * v, struct sk_buff *skb)
} }
int int
isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c) isdn_v110_stat_callback(int sl, struct isdn_v110 *iv110, isdn_ctrl *c)
{ {
isdn_v110_stream *v = NULL; isdn_v110_stream *v = NULL;
int i; int i;
...@@ -543,7 +543,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c) ...@@ -543,7 +543,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
else else
skb = isdn_v110_idle(v); skb = isdn_v110_idle(v);
if (skb) { if (skb) {
if (isdn_drv_writebuf_skb(c->driver, c->arg, 1, skb) <= 0) { if (isdn_slot_write(sl, skb) <= 0) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
break; break;
} else { } else {
...@@ -570,8 +570,8 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c) ...@@ -570,8 +570,8 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
break; break;
case ISDN_STAT_BCONN: case ISDN_STAT_BCONN:
if (iv110->v110emu && (iv110->v110 == NULL)) { if (iv110->v110emu && (iv110->v110 == NULL)) {
int hdrlen = isdn_drv_hdrlen(c->driver); int hdrlen = isdn_slot_hdrlen(sl);
int maxsize = isdn_drv_maxbufsize(c->driver); int maxsize = isdn_slot_maxbufsize(sl);
atomic_inc(&iv110->v110use); atomic_inc(&iv110->v110use);
switch (iv110->v110emu) { switch (iv110->v110emu) {
case ISDN_PROTO_L2_V11096: case ISDN_PROTO_L2_V11096:
...@@ -588,7 +588,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c) ...@@ -588,7 +588,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
if ((v = iv110->v110)) { if ((v = iv110->v110)) {
while (v->SyncInit) { while (v->SyncInit) {
struct sk_buff *skb = isdn_v110_sync(v); struct sk_buff *skb = isdn_v110_sync(v);
if (isdn_drv_writebuf_skb(c->driver, c->arg, 1, skb) <= 0) { if (isdn_slot_write(sl, skb) <= 0) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
/* Unable to send, try later */ /* Unable to send, try later */
break; break;
......
...@@ -26,7 +26,7 @@ extern struct sk_buff *isdn_v110_encode(isdn_v110_stream *, struct sk_buff *); ...@@ -26,7 +26,7 @@ extern struct sk_buff *isdn_v110_encode(isdn_v110_stream *, struct sk_buff *);
*/ */
extern struct sk_buff *isdn_v110_decode(isdn_v110_stream *, struct sk_buff *); extern struct sk_buff *isdn_v110_decode(isdn_v110_stream *, struct sk_buff *);
extern int isdn_v110_stat_callback(struct isdn_v110 *v110, isdn_ctrl *); extern int isdn_v110_stat_callback(int sl, struct isdn_v110 *v110, isdn_ctrl *);
extern void isdn_v110_close(isdn_v110_stream * v); extern void isdn_v110_close(isdn_v110_stream * v);
#endif #endif
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