Commit cd5869cb authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move more slot-specific data into the per-slot struct

parent 33c7e1fa
......@@ -44,11 +44,20 @@ MODULE_LICENSE("GPL");
isdn_dev *dev;
static struct {
struct isdn_slot {
int di; /* driver index */
int ch; /* channel index (per driver */
int ch; /* channel index (per driver) */
int usage; /* how is it used */
} slot[ISDN_MAX_CHANNELS];
char num[ISDN_MSNLEN]; /* the current phone number */
unsigned long ibytes; /* Statistics incoming bytes */
unsigned long obytes; /* Statistics outgoing bytes */
struct isdn_v110 iv110; /* For V.110 */
int m_idx; /* Index for mdm.... */
isdn_net_dev *rx_netdev; /* rx netdev-pointers */
isdn_net_dev *st_netdev; /* stat netdev-pointers */
};
static struct isdn_slot slot[ISDN_MAX_CHANNELS];
static char *isdn_revision = "$Revision: 1.114.6.16 $";
......@@ -324,7 +333,7 @@ isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb)
return;
}
/* Update statistics */
dev->ibytes[i] += skb->len;
slot[i].ibytes += skb->len;
/* First, try to deliver data to network-device */
if (isdn_net_rcv_skb(i, skb))
......@@ -334,10 +343,10 @@ isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb)
* makes sense for async streams only, so it is
* called after possible net-device delivery.
*/
if (dev->v110[i]) {
atomic_inc(&dev->v110use[i]);
skb = isdn_v110_decode(dev->v110[i], skb);
atomic_dec(&dev->v110use[i]);
if (slot[i].iv110.v110) {
atomic_inc(&slot[i].iv110.v110use);
skb = isdn_v110_decode(slot[i].iv110.v110, skb);
atomic_dec(&slot[i].iv110.v110use);
if (!skb)
return;
}
......@@ -381,11 +390,11 @@ isdn_command(isdn_ctrl *cmd)
* Layer-2 to transparent
*/
if (!(features & l2_feature)) {
dev->v110emu[idx] = l2prot;
slot[idx].iv110.v110emu = l2prot;
cmd->arg = (cmd->arg & 255) |
(ISDN_PROTO_L2_TRANS << 8);
} else
dev->v110emu[idx] = 0;
slot[idx].iv110.v110emu = 0;
}
}
return dev->drv[cmd->driver]->interface->command(cmd);
......@@ -435,7 +444,7 @@ isdn_status_callback(isdn_ctrl * c)
return 0;
if (isdn_net_stat_callback(i, c))
return 0;
if (isdn_v110_stat_callback(i, c))
if (isdn_v110_stat_callback(&slot[i].iv110, c))
return 0;
if (isdn_tty_stat_callback(i, c))
return 0;
......@@ -578,7 +587,7 @@ isdn_status_callback(isdn_ctrl * c)
/* Find any net-device, waiting for D-channel setup */
if (isdn_net_stat_callback(i, c))
break;
isdn_v110_stat_callback(i, c);
isdn_v110_stat_callback(&slot[i].iv110, c);
/* Find any ttyI, waiting for D-channel setup */
if (isdn_tty_stat_callback(i, c)) {
cmd.driver = di;
......@@ -601,7 +610,7 @@ isdn_status_callback(isdn_ctrl * c)
/* Signal hangup to network-devices */
if (isdn_net_stat_callback(i, c))
break;
isdn_v110_stat_callback(i, c);
isdn_v110_stat_callback(&slot[i].iv110, c);
if (isdn_tty_stat_callback(i, c))
break;
#ifdef CONFIG_ISDN_DIVERSION
......@@ -623,7 +632,7 @@ isdn_status_callback(isdn_ctrl * c)
isdn_info_update();
if (isdn_net_stat_callback(i, c))
break;
isdn_v110_stat_callback(i, c);
isdn_v110_stat_callback(&slot[i].iv110, c);
if (isdn_tty_stat_callback(i, c))
break;
break;
......@@ -642,7 +651,7 @@ isdn_status_callback(isdn_ctrl * c)
if (isdn_net_stat_callback(i, c))
break;
#endif
isdn_v110_stat_callback(i, c);
isdn_v110_stat_callback(&slot[i].iv110, c);
if (isdn_tty_stat_callback(i, c))
break;
break;
......@@ -914,7 +923,7 @@ isdn_statstr(void)
sprintf(p, "\nphone:\t");
p = istatbuf + strlen(istatbuf);
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
sprintf(p, "%s ", dev->num[i]);
sprintf(p, "%s ", isdn_slot_num(i));
p = istatbuf + strlen(istatbuf);
}
sprintf(p, "\n");
......@@ -1071,8 +1080,8 @@ isdn_status_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
sizeof(ulong) * ISDN_MAX_CHANNELS * 2)))
return ret;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
put_user(dev->ibytes[i], p++);
put_user(dev->obytes[i], p++);
put_user(slot[i].ibytes, p++);
put_user(slot[i].obytes, p++);
}
return 0;
} else
......@@ -1719,7 +1728,7 @@ isdn_map_eaz2msn(char *msn, int di)
int
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)
{
int i;
ulong flags;
......@@ -1786,14 +1795,14 @@ isdn_slot_free(int sl, int usage)
save_flags(flags);
cli();
if (!usage || (slot[sl].usage & ISDN_USAGE_MASK) == usage) {
strcpy(dev->num[sl], "???");
dev->ibytes[sl] = 0;
dev->obytes[sl] = 0;
strcpy(isdn_slot_num(sl), "???");
slot[sl].ibytes = 0;
slot[sl].obytes = 0;
// 20.10.99 JIM, try to reinitialize v110 !
dev->v110emu[sl] = 0;
atomic_set(&(dev->v110use[sl]), 0);
isdn_v110_close(dev->v110[sl]);
dev->v110[sl] = NULL;
slot[sl].iv110.v110emu = 0;
atomic_set(&slot[sl].iv110.v110use, 0);
isdn_v110_close(slot[sl].iv110.v110);
slot[sl].iv110.v110 = NULL;
// 20.10.99 JIM, try to reinitialize v110 !
isdn_slot_set_usage(sl, isdn_slot_usage(sl) & (ISDN_USAGE_NONE | ISDN_USAGE_EXCLUSIVE));
skb_queue_purge(&dev->drv[isdn_slot_driver(sl)]->rpqueue[isdn_slot_channel(sl)]);
......@@ -1836,10 +1845,10 @@ isdn_slot_write(int sl, struct sk_buff *skb)
BUG_ON(sl < 0);
if (dev->v110[sl]) {
atomic_inc(&dev->v110use[sl]);
nskb = isdn_v110_encode(dev->v110[sl], skb);
atomic_dec(&dev->v110use[sl]);
if (slot[sl].iv110.v110) {
atomic_inc(&slot[sl].iv110.v110use);
nskb = isdn_v110_encode(slot[sl].iv110.v110, skb);
atomic_dec(&slot[sl].iv110.v110use);
if (!nskb)
return 0;
v110_ret = *((int *)nskb->data);
......@@ -1878,11 +1887,11 @@ isdn_slot_write(int sl, struct sk_buff *skb)
}
}
if (ret > 0) {
dev->obytes[di] += ret;
if (dev->v110[sl]) {
atomic_inc(&dev->v110use[sl]);
dev->v110[sl]->skbuser++;
atomic_dec(&dev->v110use[sl]);
slot[sl].obytes += ret;
if (slot[sl].iv110.v110) {
atomic_inc(&slot[sl].iv110.v110use);
slot[sl].iv110.v110->skbuser++;
atomic_dec(&slot[sl].iv110.v110use);
/* For V.110 return unencoded data length */
ret = v110_ret;
/* if the complete frame was send we free the skb;
......@@ -1891,7 +1900,7 @@ isdn_slot_write(int sl, struct sk_buff *skb)
dev_kfree_skb(skb);
}
} else
if (dev->v110[sl])
if (slot[sl].iv110.v110)
dev_kfree_skb(nskb);
return ret;
}
......@@ -2183,6 +2192,38 @@ isdn_slot_set_usage(int sl, int usage)
isdn_info_update();
}
void
isdn_slot_set_rx_netdev(int sl, isdn_net_dev *nd)
{
BUG_ON(sl < 0);
slot[sl].rx_netdev = nd;
}
isdn_net_dev *
isdn_slot_rx_netdev(int sl)
{
BUG_ON(sl < 0);
return slot[sl].rx_netdev;
}
void
isdn_slot_set_st_netdev(int sl, isdn_net_dev *nd)
{
BUG_ON(sl < 0);
slot[sl].rx_netdev = nd;
}
isdn_net_dev *
isdn_slot_st_netdev(int sl)
{
BUG_ON(sl < 0);
return slot[sl].st_netdev;
}
/*
*****************************************************************************
* And now the modules code.
......@@ -2306,8 +2347,8 @@ static int __init isdn_init(void)
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
slot[i].di = -1;
slot[i].ch = -1;
dev->m_idx[i] = -1;
strcpy(dev->num[i], "???");
slot[i].m_idx = -1;
strcpy(isdn_slot_num(i), "???");
init_waitqueue_head(&dev->mdm.info[i].open_wait);
init_waitqueue_head(&dev->mdm.info[i].close_wait);
}
......
......@@ -54,3 +54,11 @@ extern int isdn_slot_driver(int slot);
extern int isdn_slot_channel(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 int isdn_slot_set_m_idx(int slot, int midx);
extern void isdn_slot_set_rx_netdev(int sl, isdn_net_dev *nd);
extern void isdn_slot_set_st_netdev(int sl, isdn_net_dev *nd);
extern isdn_net_dev *isdn_slot_rx_netdev(int sl);
extern isdn_net_dev *isdn_slot_st_netdev(int sl);
......@@ -281,8 +281,8 @@ isdn_net_bind_channel(isdn_net_local * lp, int idx)
cli();
lp->flags |= ISDN_NET_CONNECTED;
lp->isdn_slot = idx;
dev->rx_netdev[idx] = lp->netdev;
dev->st_netdev[idx] = lp->netdev;
isdn_slot_set_rx_netdev(lp->isdn_slot, lp->netdev);
isdn_slot_set_st_netdev(lp->isdn_slot, lp->netdev);
restore_flags(flags);
}
......@@ -306,8 +306,8 @@ isdn_net_unbind_channel(isdn_net_local * lp)
qdisc_reset(lp->netdev->dev.qdisc);
}
lp->dialstate = 0;
dev->rx_netdev[lp->isdn_slot] = NULL;
dev->st_netdev[lp->isdn_slot] = NULL;
isdn_slot_set_rx_netdev(lp->isdn_slot, NULL);
isdn_slot_set_st_netdev(lp->isdn_slot, NULL);
isdn_slot_free(lp->isdn_slot, ISDN_USAGE_NET);
lp->flags &= ~ISDN_NET_CONNECTED;
lp->isdn_slot = -1;
......@@ -405,7 +405,7 @@ static void isdn_net_lp_disconnected(isdn_net_local *lp)
int
isdn_net_stat_callback(int idx, isdn_ctrl *c)
{
isdn_net_dev *p = dev->st_netdev[idx];
isdn_net_dev *p = isdn_slot_st_netdev(idx);
int cmd = c->command;
if (p) {
......@@ -491,7 +491,7 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
if (lp->dialstate <= 6)
isdn_slot_set_usage(idx, isdn_slot_usage(idx) | ISDN_USAGE_OUTGOING);
else
dev->rx_netdev[idx] = p;
isdn_slot_set_rx_netdev(idx, p);
lp->dialstate = 0;
isdn_timer_ctrl(ISDN_TIMER_NETHANGUP, 1);
if (lp->p_encap == ISDN_NET_ENCAP_CISCOHDLCK)
......@@ -696,7 +696,7 @@ isdn_net_dial(void)
sprintf(cmd.parm.setup.eazmsn, "%s",
isdn_slot_map_eaz2msn(lp->isdn_slot, lp->msn));
if (lp->isdn_slot >= 0) {
strcpy(dev->num[lp->isdn_slot], cmd.parm.setup.phone);
strcpy(isdn_slot_num(lp->isdn_slot), cmd.parm.setup.phone);
isdn_slot_set_usage(lp->isdn_slot, isdn_slot_usage(lp->isdn_slot) | ISDN_USAGE_OUTGOING);
}
printk(KERN_INFO "%s: dialing %d %s... %s\n", lp->name,
......@@ -1859,7 +1859,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
int
isdn_net_rcv_skb(int idx, struct sk_buff *skb)
{
isdn_net_dev *p = dev->rx_netdev[idx];
isdn_net_dev *p = isdn_slot_rx_netdev(idx);
if (p) {
isdn_net_local *lp = p->local;
......@@ -2403,9 +2403,9 @@ p = dev->netdev;
isdn_slot_free(lp->isdn_slot,
ISDN_USAGE_NET);
}
strcpy(dev->num[idx], nr);
strcpy(isdn_slot_num(idx), nr);
isdn_slot_set_usage(idx, (isdn_slot_usage(idx) & ISDN_USAGE_EXCLUSIVE) | ISDN_USAGE_NET);
dev->st_netdev[idx] = lp->netdev;
isdn_slot_set_st_netdev(idx, lp->netdev);
lp->isdn_slot = slot;
lp->ppp_slot = -1;
lp->flags |= ISDN_NET_CONNECTED;
......@@ -3022,8 +3022,8 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer)
idx = p->local->isdn_slot;
if (idx<0) return -ENOTCONN;
/* for pre-bound channels, we need this extra check */
if ( strncmp(dev->num[idx],"???",3) == 0 ) return -ENOTCONN;
strncpy(phone->phone,dev->num[idx],ISDN_MSNLEN);
if (strncmp(isdn_slot_num(idx),"???",3) == 0 ) return -ENOTCONN;
strncpy(phone->phone,isdn_slot_num(idx),ISDN_MSNLEN);
phone->outgoing=USG_OUTGOING(isdn_slot_usage(idx));
if ( copy_to_user(peer,phone,sizeof(*peer)) ) return -EFAULT;
return 0;
......
......@@ -128,7 +128,7 @@ isdn_tty_readmodem(void)
modem_info *info;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if ((midx = dev->m_idx[i]) >= 0) {
if ((midx = isdn_slot_m_idx(i)) >= 0) {
info = &dev->mdm.info[midx];
if (info->online) {
r = 0;
......@@ -182,7 +182,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb)
#endif
modem_info *info;
if ((midx = dev->m_idx[i]) < 0) {
if ((midx = isdn_slot_m_idx(i)) < 0) {
/* if midx is invalid, packet is not for tty */
return 0;
}
......@@ -657,7 +657,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else {
info->isdn_slot = i;
dev->m_idx[i] = info->line;
isdn_slot_set_m_idx(i, info->line);
info->last_dir = 1;
strcpy(info->last_num, n);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
......@@ -683,7 +683,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
cmd.parm.setup.si2 = m->mdmreg[REG_SI2];
info->dialing = 1;
info->emu.carrierwait = 0;
strcpy(dev->num[i], n);
strcpy(isdn_slot_num(i), n);
isdn_info_update();
isdn_slot_command(info->isdn_slot, ISDN_CMD_DIAL, &cmd);
isdn_timer_ctrl(ISDN_TIMER_CARRIER, 1);
......@@ -754,7 +754,7 @@ isdn_tty_modem_hup(modem_info * info, int local)
isdn_slot_all_eaz(slot);
info->emu.mdmreg[REG_RINGCNT] = 0;
isdn_slot_free(slot, 0);
dev->m_idx[slot] = -1;
isdn_slot_set_m_idx(slot, -1);
info->isdn_slot = -1;
}
......@@ -847,7 +847,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else {
info->isdn_slot = i;
dev->m_idx[i] = info->line;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1;
// strcpy(info->last_num, n);
......@@ -926,7 +926,7 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else {
info->isdn_slot = i;
dev->m_idx[i] = info->line;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_usage(i, isdn_slot_usage(i) | ISDN_USAGE_OUTGOING);
info->last_dir = 1;
restore_flags(flags);
......@@ -2210,8 +2210,8 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
wret = matchret;
if (!matchret) { /* EAZ is matching */
info->isdn_slot = idx;
dev->m_idx[idx] = info->line;
strcpy(dev->num[idx], nr);
isdn_slot_set_m_idx(idx, info->line);
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;
......@@ -2246,7 +2246,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
if (i < 0)
return 0;
if ((mi = dev->m_idx[i]) >= 0) {
if ((mi = isdn_slot_m_idx(i)) >= 0) {
info = &dev->mdm.info[mi];
switch (c->command) {
case ISDN_STAT_CINF:
......@@ -2682,7 +2682,7 @@ isdn_tty_modem_result(int code, modem_info * info)
/* print CID, _before_ _every_ ring */
if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) {
isdn_tty_at_cout("\r\nCALLER NUMBER: ", info);
isdn_tty_at_cout(dev->num[info->isdn_slot], info);
isdn_tty_at_cout(isdn_slot_num(info->isdn_slot), info);
if (m->mdmreg[REG_CDN] & BIT_CDN) {
isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
isdn_tty_at_cout(info->emu.cpn, info);
......@@ -2711,7 +2711,7 @@ isdn_tty_modem_result(int code, modem_info * info)
(m->mdmreg[REG_RINGCNT] == 1)) {
isdn_tty_at_cout("\r\n", info);
isdn_tty_at_cout("CALLER NUMBER: ", info);
isdn_tty_at_cout(dev->num[info->isdn_slot], info);
isdn_tty_at_cout(isdn_slot_num(info->isdn_slot), info);
if (m->mdmreg[REG_CDN] & BIT_CDN) {
isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
isdn_tty_at_cout(info->emu.cpn, info);
......@@ -3223,7 +3223,7 @@ isdn_tty_cmd_ATA(modem_info * info)
if (info->msr & UART_MSR_RI) {
/* Accept incoming call */
info->last_dir = 0;
strcpy(info->last_num, dev->num[info->isdn_slot]);
strcpy(info->last_num, isdn_slot_num(info->isdn_slot));
m->mdmreg[REG_RINGCNT] = 0;
info->msr &= ~UART_MSR_RI;
l2 = m->mdmreg[REG_L2PROT];
......@@ -3936,7 +3936,7 @@ isdn_tty_modem_escape(void)
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (USG_MODEM(isdn_slot_usage(i)))
if ((midx = dev->m_idx[i]) >= 0) {
if ((midx = isdn_slot_m_idx(i)) >= 0) {
modem_info *info = &dev->mdm.info[midx];
if (info->online) {
ton = 1;
......
......@@ -380,10 +380,10 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
PARSE_ERROR1;
}
info->isdn_slot = i;
dev->m_idx[i] = info->line;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_command(info->isdn_slot, ISDN_CMD_FAXCMD, &c);
isdn_slot_free(info->isdn_slot, ISDN_USAGE_FAX);
dev->m_idx[info->isdn_slot] = -1;
isdn_slot_set_m_idx(i, -1);
info->isdn_slot = -1;
restore_flags(flags);
} else {
......
......@@ -515,14 +515,12 @@ isdn_v110_encode(isdn_v110_stream * v, struct sk_buff *skb)
}
int
isdn_v110_stat_callback(int idx, isdn_ctrl * c)
isdn_v110_stat_callback(struct isdn_v110 *iv110, isdn_ctrl *c)
{
isdn_v110_stream *v = NULL;
int i;
int ret;
if (idx < 0)
return 0;
switch (c->command) {
case ISDN_STAT_BSENT:
/* Keep the send-queue of the driver filled
......@@ -531,9 +529,9 @@ isdn_v110_stat_callback(int idx, isdn_ctrl * c)
* send down an Idle-Frame (or an Sync-Frame, if
* v->SyncInit != 0).
*/
if (!(v = dev->v110[idx]))
if (!(v = iv110->v110))
return 0;
atomic_inc(&dev->v110use[idx]);
atomic_inc(&iv110->v110use);
if (v->skbidle > 0) {
v->skbidle--;
ret = 1;
......@@ -560,38 +558,38 @@ isdn_v110_stat_callback(int idx, isdn_ctrl * c)
} else
break;
}
atomic_dec(&dev->v110use[idx]);
atomic_dec(&iv110->v110use);
return ret;
case ISDN_STAT_DHUP:
case ISDN_STAT_BHUP:
while (1) {
atomic_inc(&dev->v110use[idx]);
if (atomic_dec_and_test(&dev->v110use[idx])) {
isdn_v110_close(dev->v110[idx]);
dev->v110[idx] = NULL;
atomic_inc(&iv110->v110use);
if (atomic_dec_and_test(&iv110->v110use)) {
isdn_v110_close(iv110->v110);
iv110->v110 = NULL;
break;
}
sti();
}
break;
case ISDN_STAT_BCONN:
if (dev->v110emu[idx] && (dev->v110[idx] == NULL)) {
if (iv110->v110emu && (iv110->v110 == NULL)) {
int hdrlen = dev->drv[c->driver]->interface->hl_hdrlen;
int maxsize = dev->drv[c->driver]->interface->maxbufsize;
atomic_inc(&dev->v110use[idx]);
switch (dev->v110emu[idx]) {
atomic_inc(&iv110->v110use);
switch (iv110->v110emu) {
case ISDN_PROTO_L2_V11096:
dev->v110[idx] = isdn_v110_open(V110_9600, hdrlen, maxsize);
iv110->v110 = isdn_v110_open(V110_9600, hdrlen, maxsize);
break;
case ISDN_PROTO_L2_V11019:
dev->v110[idx] = isdn_v110_open(V110_19200, hdrlen, maxsize);
iv110->v110 = isdn_v110_open(V110_19200, hdrlen, maxsize);
break;
case ISDN_PROTO_L2_V11038:
dev->v110[idx] = isdn_v110_open(V110_38400, hdrlen, maxsize);
iv110->v110 = isdn_v110_open(V110_38400, hdrlen, maxsize);
break;
default:;
}
if ((v = dev->v110[idx])) {
if ((v = iv110->v110)) {
while (v->SyncInit) {
struct sk_buff *skb = isdn_v110_sync(v);
if (dev->drv[c->driver]->interface->writebuf_skb(c->driver, c->arg, 1, skb) <= 0) {
......@@ -603,8 +601,8 @@ isdn_v110_stat_callback(int idx, isdn_ctrl * c)
v->skbidle++;
}
} else
printk(KERN_WARNING "isdn_v110: Couldn't open stream for chan %d\n", idx);
atomic_dec(&dev->v110use[idx]);
printk(KERN_WARNING "isdn_v110: Couldn't open stream\n");
atomic_dec(&iv110->v110use);
}
break;
default:
......
......@@ -9,8 +9,14 @@
*
*/
#ifndef _isdn_v110_h_
#define _isdn_v110_h_
#ifndef ISDN_V110_H
#define ISDN_V110_H
struct isdn_v110 {
int v110emu; /* V.110 emulator-mode 0=none */
atomic_t v110use; /* Usage-Semaphore for stream */
isdn_v110_stream *v110; /* V.110 private data */
};
/*
* isdn_v110_encode will take raw data and encode it using V.110
......@@ -23,7 +29,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(int, isdn_ctrl *);
extern int isdn_v110_stat_callback(struct isdn_v110 *v110, isdn_ctrl *);
extern void isdn_v110_close(isdn_v110_stream * v);
#endif
......@@ -605,21 +605,11 @@ typedef struct isdn_devt {
infostruct *infochain; /* List of open info-devs. */
wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
struct timer_list timer; /* Misc.-function Timer */
char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
/* Remote number of active ch.*/
int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */
driver *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
isdn_net_dev *netdev; /* Linked list of net-if's */
char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
struct task_struct *profd; /* For iprofd */
modem mdm; /* tty-driver-data */
isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */
isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */
ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */
ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */
int v110emu[ISDN_MAX_CHANNELS];/* V.110 emulator-mode 0=none */
atomic_t v110use[ISDN_MAX_CHANNELS];/* Usage-Semaphore for stream */
isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */
struct semaphore sem; /* serialize list access*/
unsigned long global_features;
#ifdef CONFIG_DEVFS_FS
......
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