static int     stli_open(struct tty_struct *tty, struct file *filp);
 static void    stli_close(struct tty_struct *tty, struct file *filp);
 static int     stli_write(struct tty_struct *tty, const unsigned char *buf, int count);
-static void    stli_putchar(struct tty_struct *tty, unsigned char ch);
+static int     stli_putchar(struct tty_struct *tty, unsigned char ch);
 static void    stli_flushchars(struct tty_struct *tty);
 static int     stli_writeroom(struct tty_struct *tty);
 static int     stli_charsinbuffer(struct tty_struct *tty);
  */
        portp->port.tty = tty;
        tty->driver_data = portp;
-       portp->refcount++;
+       portp->port.count++;
 
        wait_event_interruptible(portp->raw_wait,
                        !test_bit(ST_INITIALIZING, &portp->state));
                spin_unlock_irqrestore(&stli_lock, flags);
                return;
        }
-       if ((tty->count == 1) && (portp->refcount != 1))
-               portp->refcount = 1;
-       if (portp->refcount-- > 1) {
+       if ((tty->count == 1) && (portp->port.count != 1))
+               portp->port.count = 1;
+       if (portp->port.count-- > 1) {
                spin_unlock_irqrestore(&stli_lock, flags);
                return;
        }
        clear_bit(ST_TXBUSY, &portp->state);
        clear_bit(ST_RXSTOP, &portp->state);
        set_bit(TTY_IO_ERROR, &tty->flags);
-       if (tty->ldisc.flush_buffer)
-               (tty->ldisc.flush_buffer)(tty);
+       if (tty->ldisc.ops->flush_buffer)
+               (tty->ldisc.ops->flush_buffer)(tty);
        set_bit(ST_DOFLUSHRX, &portp->state);
        stli_flushbuffer(tty);
 
        spin_lock_irqsave(&stli_lock, flags);
        portp->openwaitcnt++;
        if (! tty_hung_up_p(filp))
-               portp->refcount--;
+               portp->port.count--;
        spin_unlock_irqrestore(&stli_lock, flags);
 
        for (;;) {
 
        spin_lock_irqsave(&stli_lock, flags);
        if (! tty_hung_up_p(filp))
-               portp->refcount++;
+               portp->port.count++;
        portp->openwaitcnt--;
        spin_unlock_irqrestore(&stli_lock, flags);
 
  *     first them do the new ports.
  */
 
-static void stli_putchar(struct tty_struct *tty, unsigned char ch)
+static int stli_putchar(struct tty_struct *tty, unsigned char ch)
 {
        if (tty != stli_txcooktty) {
                if (stli_txcooktty != NULL)
        }
 
        stli_txcookbuf[stli_txcooksize++] = ch;
+       return 0;
 }
 
 /*****************************************************************************/
 {
        struct stliport *portp;
        struct stlibrd *brdp;
-       unsigned int ival;
        int rc;
        void __user *argp = (void __user *)arg;
 
        set_bit(TTY_IO_ERROR, &tty->flags);
        portp->port.tty = NULL;
        portp->port.flags &= ~ASYNC_NORMAL_ACTIVE;
-       portp->refcount = 0;
+       portp->port.count = 0;
        spin_unlock_irqrestore(&stli_lock, flags);
 
        wake_up_interruptible(&portp->port.open_wait);
        stli_comstats.panel = portp->panelnr;
        stli_comstats.port = portp->portnr;
        stli_comstats.state = portp->state;
-       stli_comstats.flags = portp->port.flag;
+       stli_comstats.flags = portp->port.flags;
 
        spin_lock_irqsave(&brd_lock, flags);
        if (portp->port.tty != NULL) {