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)
dtmf_state *s;
int silence;
int i;
int di;
int ch;
unsigned long flags;
int grp[2];
char what;
......@@ -563,8 +561,6 @@ isdn_audio_eval_dtmf(modem_info * info)
ISDN_AUDIO_SKB_LOCK(skb) = 0;
save_flags(flags);
cli();
di = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
isdn_tty_queue_tail(info, skb, 2);
restore_flags(flags);
/* Schedule dequeuing */
......@@ -658,8 +654,6 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
{
struct sk_buff *skb;
unsigned long flags;
int di;
int ch;
char *p;
skb = dev_alloc_skb(2);
......@@ -682,8 +676,6 @@ isdn_audio_put_dle_code(modem_info * info, u_char code)
ISDN_AUDIO_SKB_LOCK(skb) = 0;
save_flags(flags);
cli();
di = isdn_slot_driver(info->isdn_slot);
ch = isdn_slot_channel(info->isdn_slot);
isdn_tty_queue_tail(info, skb, 2);
restore_flags(flags);
/* Schedule dequeuing */
......
......@@ -35,9 +35,9 @@ MODULE_LICENSE("GPL");
isdn_dev *dev;
static int isdn_command(isdn_ctrl *cmd);
static void isdn_register_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)
static int
slot_acceptd(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
int retval;
retval = isdn_command(ctrl);
retval = __slot_command(slot, ctrl);
if (retval >= 0)
fsm_change_state(fi, ST_SLOT_WAIT_DCONN);
......@@ -222,10 +223,11 @@ slot_acceptd(struct fsm_inst *fi, int pr, void *arg)
static int
slot_acceptb(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
int retval;
retval = isdn_command(ctrl);
retval = __slot_command(slot, ctrl);
if (retval >= 0)
fsm_change_state(fi, ST_SLOT_WAIT_BCONN);
......@@ -235,10 +237,11 @@ slot_acceptb(struct fsm_inst *fi, int pr, void *arg)
static int
slot_actv_hangup(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
int retval;
retval = isdn_command(ctrl);
retval = __slot_command(slot, ctrl);
if (retval >= 0)
fsm_change_state(fi, ST_SLOT_WAIT_BHUP);
......@@ -384,7 +387,6 @@ static int
slot_unbind(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
int sl = slot - slots;
strcpy(slot->num, "???");
slot->ibytes = 0;
......@@ -395,7 +397,8 @@ slot_unbind(struct fsm_inst *fi, int pr, void *arg)
isdn_v110_close(slot->iv110.v110);
slot->iv110.v110 = NULL;
// 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;
}
......@@ -491,22 +494,16 @@ struct isdn_driver {
int maxbufsize; /* Maximum Buffersize supported*/
int stavail; /* Chars avail on Status-device*/
isdn_if *interface; /* Interface to driver */
char msn2eaz[10][ISDN_MSNLEN]; /* MSN->EAZ */
struct fsm_inst fi;
char msn2eaz[10][ISDN_MSNLEN]; /* MSN->EAZ */
struct fsm_inst fi;
} driver;
static int __drv_command(struct isdn_driver *drv, isdn_ctrl *cmd);
static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED;
static struct isdn_driver *drivers[ISDN_MAX_DRIVERS];
int
isdn_drv_maxbufsize(int di)
{
BUG_ON(di < 0);
return drivers[di]->maxbufsize;
}
int
static int
isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb)
{
struct sk_buff *skb2;
......@@ -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 retval;
if( skb_headroom(skb) >= hl )
if (skb_headroom(skb) >= hl)
return drivers[di]->interface->writebuf_skb(di, ch, 1, skb);
skb2 = skb_realloc_headroom(skb, hl);
......@@ -530,12 +527,6 @@ isdn_drv_writebuf_skb(int di, int ch, int x, struct sk_buff *skb)
return retval;
}
int
isdn_drv_hdrlen(int di)
{
return drivers[di]->interface->hl_hdrlen;
}
int
__isdn_drv_lookup(char *drvid)
{
......@@ -638,7 +629,6 @@ set_global_features(void)
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 int isdn_status_callback(isdn_ctrl * c);
static void set_global_features(void);
static int
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)
cmd.driver = drv->di;
cmd.arg = 0;
cmd.command = ISDN_CMD_UNLOCK;
isdn_command(&cmd);
__drv_command(drv, &cmd);
drv->locks--;
}
// isdn_tty_stat_callback(i, c); FIXME?
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if (slots[i].di == drv->di) {
slots[i].di = -1;
......@@ -958,9 +947,9 @@ isdn_status_callback(isdn_ctrl *c)
if ((slots[i].di == di) &&
(slots[i].ch == c->arg)) {
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)))
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_DISABLED);
slots[i].usage |= ISDN_USAGE_DISABLED;
else
retval = -1;
break;
......@@ -1064,7 +1053,7 @@ isdn_lock_drivers(void)
cmd.driver = i;
cmd.arg = 0;
cmd.command = ISDN_CMD_LOCK;
isdn_command(&cmd);
__drv_command(drivers[i], &cmd);
drivers[i]->locks++;
}
spin_unlock_irqrestore(&drivers_lock, flags);
......@@ -1093,7 +1082,7 @@ isdn_unlock_drivers(void)
cmd.driver = i;
cmd.arg = 0;
cmd.command = ISDN_CMD_UNLOCK;
isdn_command(&cmd);
__drv_command(drivers[i], &cmd);
drivers[i]->locks--;
}
}
......@@ -1354,41 +1343,6 @@ __slot_command(struct isdn_slot *slot, isdn_ctrl *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
* supplementary service (CAPI 2.0 part III)
......@@ -1425,8 +1379,6 @@ isdn_getnum(char **p)
return v;
}
#define DLE 0x10
static __inline int
isdn_minor2drv(int minor)
{
......@@ -1484,7 +1436,7 @@ isdn_statstr(void)
sprintf(p, "\nphone:\t");
p = istatbuf + strlen(istatbuf);
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);
}
sprintf(p, "\n");
......@@ -2015,7 +1967,7 @@ isdn_ctrl_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
c.command = ISDN_CMD_IOCTL;
c.arg = cmd;
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));
if (copy_to_user((char *) arg, &iocts, sizeof(isdn_ioctl_struct)))
return -EFAULT;
......@@ -2111,6 +2063,7 @@ int
isdn_get_free_slot(int usage, int l2_proto, int l3_proto,
int pre_dev, int pre_chan, char *msn)
{
struct isdn_slot *slot;
int i;
ulong flags;
ulong features;
......@@ -2126,28 +2079,36 @@ isdn_get_free_slot(int usage, int l2_proto, int l3_proto,
* because we can emulate this in linklevel.
*/
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (USG_NONE(slots[i].usage) &&
(slots[i].di != -1)) {
int d = slots[i].di;
if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
continue;
if (slots[i].usage & ISDN_USAGE_DISABLED)
continue; /* usage not allowed */
if (drivers[d]->fi.state != ST_DRV_RUNNING)
continue;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
slot = &slots[i];
if (((drivers[d]->interface->features & features) == features) ||
(((drivers[d]->interface->features & vfeatures) == vfeatures) &&
(drivers[d]->interface->features & ISDN_FEATURE_L2_TRANS))) {
if (pre_dev < 0 || pre_chan < 0 ||
(pre_dev == d && pre_chan == slots[i].ch)) {
isdn_slot_set_usage(i, usage);
fsm_event(&slots[i].fi, EV_SLOT_BIND, NULL);
return i;
}
if (drivers[slot->di]->fi.state != ST_DRV_RUNNING)
continue;
if (!USG_NONE(slots[i].usage))
continue;
if (slots[i].usage & ISDN_USAGE_DISABLED)
continue;
if (slots[i].di == -1)
continue;
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 ||
(pre_dev == slot->di && pre_chan == slot->ch)) {
slot->usage = usage;
isdn_info_update();
fsm_event(&slot->fi, EV_SLOT_BIND, NULL);
return i;
}
}
}
restore_flags(flags);
return -1;
}
......@@ -2341,48 +2302,46 @@ EXPORT_SYMBOL(isdn_ppp_unregister_compressor);
#endif
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);
return slots[sl].ch;
return slots[sl].drv->maxbufsize;
}
int
isdn_slot_hdrlen(int sl)
{
int di = isdn_slot_driver(sl);
struct isdn_slot *slot = &slots[sl];
BUG_ON(sl < 0);
return drivers[di]->interface->hl_hdrlen;
return slot->drv->interface->hl_hdrlen;
}
char *
isdn_slot_map_eaz2msn(int sl, char *msn)
{
int di = isdn_slot_driver(sl);
return isdn_map_eaz2msn(msn, di);
struct isdn_slot *slot = &slots[sl];
BUG_ON(sl < 0);
return isdn_map_eaz2msn(msn, slot->di);
}
int
isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
{
struct isdn_slot *slot = &slots[sl];
ctrl->command = cmd;
ctrl->driver = isdn_slot_driver(sl);
ctrl->driver = slot->di;
switch (cmd) {
case ISDN_CMD_SETL2:
case ISDN_CMD_SETL3:
case ISDN_CMD_PROT_IO:
ctrl->arg &= ~0xff; ctrl->arg |= isdn_slot_channel(sl);
ctrl->arg &= ~0xff; ctrl->arg |= slot->ch;
break;
case ISDN_CMD_DIAL:
if (dev->global_flags & ISDN_GLOBAL_STOPPED)
......@@ -2390,26 +2349,26 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
/* fall through */
default:
ctrl->arg = isdn_slot_channel(sl);
ctrl->arg = slot->ch;
break;
}
switch (cmd) {
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:
return fsm_event(&slots[sl].fi, EV_CMD_SETEAZ, ctrl);
return fsm_event(&slot->fi, EV_CMD_SETEAZ, ctrl);
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:
return fsm_event(&slots[sl].fi, EV_CMD_SETL3, ctrl);
return fsm_event(&slot->fi, EV_CMD_SETL3, ctrl);
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:
return fsm_event(&slots[sl].fi, EV_CMD_ACCEPTD, ctrl);
return fsm_event(&slot->fi, EV_CMD_ACCEPTD, ctrl);
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:
return fsm_event(&slots[sl].fi, EV_CMD_HANGUP, ctrl);
return fsm_event(&slot->fi, EV_CMD_HANGUP, ctrl);
}
HERE;
return -1;
......@@ -2418,18 +2377,22 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
int
isdn_slot_dial(int sl, struct dial_info *dial)
{
struct isdn_slot *slot = &slots[sl];
isdn_ctrl cmd;
int retval;
char *msn = isdn_slot_map_eaz2msn(sl, dial->msn);
BUG_ON(sl < 0);
/* check for DOV */
if (dial->si1 == 7 && tolower(dial->phone[0]) == 'v') { /* DOV call */
dial->si1 = 1;
dial->phone++; /* skip v/V */
}
strcpy(isdn_slot_num(sl), dial->phone);
isdn_slot_set_usage(sl, isdn_slot_usage(sl) | ISDN_USAGE_OUTGOING);
strcpy(slot->num, dial->phone);
slot->usage |= ISDN_USAGE_OUTGOING;
isdn_info_update();
retval = isdn_slot_command(sl, ISDN_CMD_CLREAZ, &cmd);
if (retval)
......@@ -2479,15 +2442,6 @@ isdn_slot_usage(int sl)
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
isdn_slot_m_idx(int sl)
{
......@@ -2665,7 +2619,7 @@ static int __init isdn_init(void)
slots[i].di = -1;
slots[i].ch = -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].close_wait);
slots[i].fi.fsm = &slot_fsm;
......@@ -2718,23 +2672,15 @@ static int __init isdn_init(void)
*/
static void __exit isdn_exit(void)
{
unsigned long flags;
#ifdef CONFIG_ISDN_PPP
isdn_ppp_cleanup();
#endif
save_flags(flags);
cli();
isdn_net_lib_exit();
isdn_tty_exit();
if (unregister_chrdev(ISDN_MAJOR, "isdn"))
BUG();
unregister_chrdev(ISDN_MAJOR, "isdn");
isdn_cleanup_devfs();
del_timer(&dev->timer);
restore_flags(flags);
/* call vfree with interrupts enabled, else it will hang */
del_timer_sync(&dev->timer);
vfree(dev);
fsm_free(&drv_fsm);
fsm_free(&slot_fsm);
......
......@@ -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 char *isdn_slot_map_eaz2msn(int slot, char *msn);
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_driver(int slot);
extern int isdn_slot_channel(int slot);
extern int isdn_slot_maxbufsize(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 int isdn_slot_m_idx(int slot);
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
extern void *isdn_slot_priv(int sl);
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);
char *isdn_drv_drvid(int di);
......@@ -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')
my_eaz++; /* skip to allow a match */
}
if (!USG_NONE(isdn_slot_usage(slot))) // FIXME?
return 0;
/* check called number */
switch (isdn_msncmp(eaz, my_eaz)) {
case 1: /* no match */
......
......@@ -873,7 +873,6 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m)
cmd.parm.cmsg.Length = l+18;
cmd.parm.cmsg.Command = CAPI_FACILITY;
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[1] = 0;
cmd.parm.cmsg.para[2] = l + 3;
......@@ -933,7 +932,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
info->isdn_slot = i;
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_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1;
// strcpy(info->last_num, n);
restore_flags(flags);
......@@ -945,7 +943,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
cmd.parm.cmsg.Length = l+18;
cmd.parm.cmsg.Command = CAPI_FACILITY;
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[1] = 0;
cmd.parm.cmsg.para[2] = l+3;
......@@ -1010,7 +1007,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
info->isdn_slot = i;
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_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1;
restore_flags(flags);
info->last_l2 = l2;
......@@ -1021,7 +1017,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
cmd.parm.cmsg.Length = l+14;
cmd.parm.cmsg.Command = CAPI_MANUFACTURER;
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;
strncpy(&cmd.parm.cmsg.para[1], msg, l);
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
{
int c;
int total = 0;
int di;
modem_info *info = (modem_info *) tty->driver_data;
atemu *m = &info->emu;
......@@ -1207,12 +1201,8 @@ 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_slot >= 0)
di = isdn_slot_driver(info->isdn_slot);
else
di = -1;
if (di >= 0 && c > isdn_drv_maxbufsize(di))
c = isdn_drv_maxbufsize(di);
if (info->isdn_slot >= 0 && c > isdn_slot_maxbufsize(info->isdn_slot))
c = isdn_slot_maxbufsize(info->isdn_slot);
if (c <= 0)
break;
if ((info->online > 1)
......@@ -2295,13 +2285,12 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
if (!matchret) { /* EAZ is matching */
info->isdn_slot = idx;
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(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1];
info->emu.mdmreg[REG_PLAN] = setup->plan;
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);
printk(KERN_INFO "isdn_tty: call from %s, -> RING on ttyI%d\n", nr,
info->line);
......@@ -2450,18 +2439,6 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
return 1;
}
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
case ISDN_STAT_FAXIND:
if (TTY_IS_ACTIVE(info)) {
......@@ -2508,7 +2485,6 @@ 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");
......@@ -2524,11 +2500,6 @@ 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 */
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) ||
(!skb_queue_empty(&info->rpqueue)))) {
skb = alloc_skb(strlen(msg)
......
......@@ -511,7 +511,7 @@ isdn_v110_encode(isdn_v110_stream * v, struct sk_buff *skb)
}
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;
int i;
......@@ -543,7 +543,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
else
skb = isdn_v110_idle(v);
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);
break;
} else {
......@@ -570,8 +570,8 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
break;
case ISDN_STAT_BCONN:
if (iv110->v110emu && (iv110->v110 == NULL)) {
int hdrlen = isdn_drv_hdrlen(c->driver);
int maxsize = isdn_drv_maxbufsize(c->driver);
int hdrlen = isdn_slot_hdrlen(sl);
int maxsize = isdn_slot_maxbufsize(sl);
atomic_inc(&iv110->v110use);
switch (iv110->v110emu) {
case ISDN_PROTO_L2_V11096:
......@@ -588,7 +588,7 @@ isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
if ((v = iv110->v110)) {
while (v->SyncInit) {
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);
/* Unable to send, try later */
break;
......
......@@ -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 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);
#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