compatibility to 2.3 kernel

This commit is contained in:
Karsten Keil 1999-07-01 08:30:00 +00:00
parent 3b2de079d3
commit a89743e569
4 changed files with 75 additions and 0 deletions

View File

@ -21,6 +21,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.76 1999/06/29 16:16:44 calle
* Let ISDN_CMD_UNLOAD work with open isdn devices without crash again.
* Also right unlocking (ISDN_CMD_UNLOCK) is done now.
* isdnlog should check returncode of read(2) calls.
*
* Revision 1.75 1999/04/18 14:06:47 fritz
* Removed TIMRU stuff.
*
@ -949,7 +954,9 @@ isdn_status_callback(isdn_ctrl * c)
isdn_free_queue(&dev->drv[di]->rpqueue[i]);
kfree(dev->drv[di]->rpqueue);
kfree(dev->drv[di]->rcv_waitq);
#ifndef COMPAT_HAS_NEW_WAITQ
kfree(dev->drv[di]->snd_waitq);
#endif
kfree(dev->drv[di]);
dev->drv[di] = NULL;
dev->drvid[di][0] = '\0';
@ -995,7 +1002,11 @@ isdn_getnum(char **p)
* of the mapping (di,ch)<->minor, happen during the sleep? --he
*/
int
#ifdef COMPAT_HAS_NEW_WAITQ
isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_queue_head_t *sleep)
#else
isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, struct wait_queue **sleep)
#endif
{
int left;
int count;
@ -2134,6 +2145,9 @@ isdn_add_channels(driver *d, int drvidx, int n, int adding)
int j, k, m;
ulong flags;
#ifdef COMPAT_HAS_NEW_WAITQ
init_waitqueue_head(&d->st_waitq);
#endif
if (d->flags & DRV_FLAG_RUNNING)
return -1;
if (n < 1)
@ -2184,8 +2198,14 @@ isdn_add_channels(driver *d, int drvidx, int n, int adding)
if ((adding) && (d->rcv_waitq))
kfree(d->rcv_waitq);
#ifdef COMPAT_HAS_NEW_WAITQ
d->rcv_waitq = (wait_queue_head_t *)
kmalloc(sizeof(wait_queue_head_t) * 2 * m, GFP_KERNEL);
if (!d->rcv_waitq) {
#else
if (!(d->rcv_waitq = (struct wait_queue **)
kmalloc(sizeof(struct wait_queue *) * m, GFP_KERNEL))) {
#endif
printk(KERN_WARNING "register_isdn: Could not alloc rcv_waitq\n");
if (!adding) {
kfree(d->rpqueue);
@ -2194,6 +2214,13 @@ isdn_add_channels(driver *d, int drvidx, int n, int adding)
}
return -1;
}
#ifdef COMPAT_HAS_NEW_WAITQ
d->snd_waitq = d->rcv_waitq + m;
for (j = 0; j < m; j++) {
init_waitqueue_head(&d->rcv_waitq[m]);
init_waitqueue_head(&d->snd_waitq[m]);
}
#else
memset((char *) d->rcv_waitq, 0, sizeof(struct wait_queue *) * m);
if ((adding) && (d->snd_waitq))
@ -2210,6 +2237,7 @@ isdn_add_channels(driver *d, int drvidx, int n, int adding)
return -1;
}
memset((char *) d->snd_waitq, 0, sizeof(struct wait_queue *) * m);
#endif
dev->channels += n;
save_flags(flags);
@ -2337,12 +2365,21 @@ isdn_init(void)
memset((char *) dev, 0, sizeof(isdn_dev));
init_timer(&dev->timer);
dev->timer.function = isdn_timer_funct;
#ifdef COMPAT_HAS_NEW_WAITQ
init_MUTEX(&dev->sem);
init_waitqueue_head(&dev->info_waitq);
#else
dev->sem = MUTEX;
#endif
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
dev->drvmap[i] = -1;
dev->chanmap[i] = -1;
dev->m_idx[i] = -1;
strcpy(dev->num[i], "???");
#ifdef COMPAT_HAS_NEW_WAITQ
init_waitqueue_head(&dev->mdm.info[i].open_wait);
init_waitqueue_head(&dev->mdm.info[i].close_wait);
#endif
}
if (register_chrdev(ISDN_MAJOR, "isdn", &isdn_fops)) {
printk(KERN_WARNING "isdn: Could not register control devices\n");

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.15 1999/04/18 14:06:50 fritz
* Removed TIMRU stuff.
*
* Revision 1.14 1999/04/12 12:33:18 fritz
* Changes from 2.0 tree.
*
@ -112,7 +115,11 @@ extern char *isdn_map_eaz2msn(char *msn, int di);
extern void isdn_timer_ctrl(int tf, int onoff);
extern void isdn_unexclusive_channel(int di, int ch);
extern int isdn_getnum(char **);
#ifdef COMPAT_HAS_NEW_WAITQ
extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
#else
extern int isdn_readbchan(int, int, u_char *, u_char *, int, struct wait_queue**);
#endif
extern int isdn_get_free_channel(int, int, int, int, int);
extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
extern int register_isdn(isdn_if * i);

View File

@ -19,6 +19,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.47 1999/04/18 14:06:59 fritz
* Removed TIMRU stuff.
*
* Revision 1.46 1999/04/12 12:33:35 fritz
* Changes from 2.0 tree.
*
@ -427,7 +430,9 @@ isdn_ppp_wakeup_daemon(isdn_net_local * lp)
ippp_table[lp->ppp_slot]->state = IPPP_OPEN | IPPP_CONNECT | IPPP_NOBLOCK;
#ifndef COMPAT_HAS_NEW_WAITQ
if (ippp_table[lp->ppp_slot]->wq)
#endif
wake_up_interruptible(&ippp_table[lp->ppp_slot]->wq);
}
@ -445,7 +450,11 @@ isdn_ppp_closewait(int slot)
return 0;
is = ippp_table[slot];
#ifdef COMPAT_HAS_NEW_WAITQ
if (is->state)
#else
if (is->state && is->wq)
#endif
wake_up_interruptible(&is->wq);
is->state = IPPP_CLOSEWAIT;
@ -510,7 +519,11 @@ isdn_ppp_open(int min, struct file *file)
is->mru = 1524; /* MRU, default 1524 */
is->maxcid = 16; /* VJ: maxcid */
is->tk = current;
#ifdef COMPAT_HAS_NEW_WAITQ
init_waitqueue_head(&is->wq);
#else
is->wq = NULL; /* read() wait queue */
#endif
is->first = is->rq + NUM_RCV_BUFFS - 1; /* receive queue */
is->last = is->rq;
is->minor = min;
@ -878,7 +891,9 @@ isdn_ppp_fill_rq(unsigned char *buf, int len, int proto, int slot)
is->last = bl->next;
restore_flags(flags);
#ifndef COMPAT_HAS_NEW_WAITQ
if (is->wq)
#endif
wake_up_interruptible(&is->wq);
return len;

View File

@ -20,6 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.63 1999/04/12 12:33:39 fritz
* Changes from 2.0 tree.
*
* Revision 1.62 1999/03/02 12:04:48 armin
* -added ISDN_STAT_ADDCH to increase supported channels after
* register_isdn().
@ -1860,8 +1863,12 @@ isdn_tty_set_termios(struct tty_struct *tty, struct termios *old_termios)
static int
isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info * info)
{
#ifdef COMPAT_HAS_NEW_WAITQ
DECLARE_WAITQUEUE(wait, NULL);
#else
struct wait_queue wait =
{current, NULL};
#endif
int do_clocal = 0;
unsigned long flags;
int retval;
@ -2284,7 +2291,11 @@ isdn_tty_modem_init(void)
}
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
info = &m->info[i];
#ifdef COMPAT_HAS_NEW_WAITQ
init_MUTEX(&info->write_sem);
#else
info->write_sem = MUTEX;
#endif
sprintf(info->last_cause, "0000");
sprintf(info->last_num, "none");
info->last_dir = 0;
@ -2301,9 +2312,14 @@ isdn_tty_modem_init(void)
info->blocked_open = 0;
info->callout_termios = m->cua_modem.init_termios;
info->normal_termios = m->tty_modem.init_termios;
#ifdef COMPAT_HAS_NEW_WAITQ
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
#else
info->open_wait = 0;
info->close_wait = 0;
info->isdn_driver = -1;
#endif
info->isdn_channel = -1;
info->drv_index = -1;
info->xmit_size = ISDN_SERIAL_XMIT_SIZE;