return room;
 }
 
-int line_chars_in_buffer(struct tty_struct *tty)
+unsigned int line_chars_in_buffer(struct tty_struct *tty)
 {
        struct line *line = tty->driver_data;
        unsigned long flags;
-       int ret;
+       unsigned int ret;
 
        spin_lock_irqsave(&line->lock, flags);
        /* write_room subtracts 1 for the needed NULL, so we readd it.*/
 
 extern int line_write(struct tty_struct *tty, const unsigned char *buf,
                      int len);
 extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
-extern int line_chars_in_buffer(struct tty_struct *tty);
+extern unsigned int line_chars_in_buffer(struct tty_struct *tty);
 extern void line_flush_buffer(struct tty_struct *tty);
 extern void line_flush_chars(struct tty_struct *tty);
 extern unsigned int line_write_room(struct tty_struct *tty);
 
 
 /* Return the count of bytes in transmit buffer
  */
-static int mgslpc_chars_in_buffer(struct tty_struct *tty)
+static unsigned int mgslpc_chars_in_buffer(struct tty_struct *tty)
 {
        MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
-       int rc;
+       unsigned int rc;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_chars_in_buffer(%s)\n",
                rc = info->tx_count;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n",
+               printk("%s(%d):mgslpc_chars_in_buffer(%s)=%u\n",
                         __FILE__, __LINE__, info->device_name, rc);
 
        return rc;
 
        return PAGE_SIZE - channel->nb_bytes;
 }
 
-static int ipoctal_chars_in_buffer(struct tty_struct *tty)
+static unsigned int ipoctal_chars_in_buffer(struct tty_struct *tty)
 {
        struct ipoctal_channel *channel = tty->driver_data;
 
 
        return room;
 }
 
-static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int capinc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct capiminor *mp = tty->driver_data;
 
 
        return FIFO_SIZE - kfifo_len(&port->xmit_fifo);
 }
 
-static int sdio_uart_chars_in_buffer(struct tty_struct *tty)
+static unsigned int sdio_uart_chars_in_buffer(struct tty_struct *tty)
 {
        struct sdio_uart_port *port = tty->driver_data;
        return kfifo_len(&port->xmit_fifo);
 
 }
 
 /* how many characters in the buffer */
-static int hso_serial_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hso_serial_chars_in_buffer(struct tty_struct *tty)
 {
        struct hso_serial *serial = tty->driver_data;
-       int chars;
        unsigned long flags;
+       unsigned int chars;
 
        /* sanity check */
        if (serial == NULL)
 
 /*
  * Returns the number of characters in the output buffer
  */
-static int tty3215_chars_in_buffer(struct tty_struct *tty)
+static unsigned int tty3215_chars_in_buffer(struct tty_struct *tty)
 {
        struct raw3215_info *raw = tty->driver_data;
 
 
 /*
  * Return number of characters in buffer
  */
-int
+unsigned int
 sclp_chars_in_buffer(struct sclp_buffer *buffer)
 {
-       int count;
+       unsigned int count;
 
        count = buffer->char_sum;
        if (buffer->current_line != NULL)
 
 int sclp_buffer_space(struct sclp_buffer *);
 int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int);
 int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int));
-int sclp_chars_in_buffer(struct sclp_buffer *);
+unsigned int sclp_chars_in_buffer(struct sclp_buffer *);
 
 #ifdef CONFIG_SCLP_CONSOLE
 void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event);
 
  * characters in the write buffer (will not be written as long as there is a
  * final line feed missing).
  */
-static int
+static unsigned int
 sclp_tty_chars_in_buffer(struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
        struct sclp_buffer *t;
-       int count;
+       unsigned int count = 0;
 
        spin_lock_irqsave(&sclp_tty_lock, flags);
-       count = 0;
        if (sclp_ttybuf != NULL)
                count = sclp_chars_in_buffer(sclp_ttybuf);
        list_for_each(l, &sclp_tty_outqueue) {
 
 /*
  * Return number of buffered chars.
  */
-static int
+static unsigned int
 sclp_vt220_chars_in_buffer(struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
        struct sclp_vt220_request *r;
-       int count;
+       unsigned int count = 0;
 
        spin_lock_irqsave(&sclp_vt220_lock, flags);
-       count = 0;
        if (sclp_vt220_current_request != NULL)
                count = sclp_vt220_chars_stored(sclp_vt220_current_request);
        list_for_each(l, &sclp_vt220_outqueue) {
 
        return n;
 }
 
-static int fwtty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int fwtty_chars_in_buffer(struct tty_struct *tty)
 {
        struct fwtty_port *port = tty->driver_data;
-       int n;
+       unsigned int n;
 
        spin_lock_bh(&port->lock);
        n = dma_fifo_level(&port->tx_fifo);
        spin_unlock_bh(&port->lock);
 
-       fwtty_dbg(port, "%d\n", n);
+       fwtty_dbg(port, "%u\n", n);
 
        return n;
 }
 
        return room;
 }
 
-static int gb_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int gb_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct gb_tty *gb_tty = tty->driver_data;
        unsigned long flags;
-       int chars;
+       unsigned int chars;
 
        spin_lock_irqsave(&gb_tty->write_lock, flags);
        chars = kfifo_len(&gb_tty->write_fifo);
 
        return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
 }
 
-static int rs_chars_in_buffer(struct tty_struct *tty)
+static unsigned int rs_chars_in_buffer(struct tty_struct *tty)
 {
        struct serial_state *info = tty->driver_data;
 
 
        return 0x10000;
 }
 
-static int goldfish_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int goldfish_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct goldfish_tty *qtty = &goldfish_ttys[tty->index];
        void __iomem *base = qtty->base;
 
        return hp->outbuf_size - hp->n_outbuf;
 }
 
-static int hvc_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hvc_chars_in_buffer(struct tty_struct *tty)
 {
        struct hvc_struct *hp = tty->driver_data;
 
 
        return HVCS_BUFF_LEN - hvcsd->chars_in_buffer;
 }
 
-static int hvcs_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hvcs_chars_in_buffer(struct tty_struct *tty)
 {
        struct hvcs_struct *hvcsd = tty->driver_data;
 
 
        return N_OUTBUF - hp->n_outbuf;
 }
 
-static int hvsi_chars_in_buffer(struct tty_struct *tty)
+static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty)
 {
        struct hvsi_struct *hp = tty->driver_data;
 
 
        return 0;       /* Keeps the PCMCIA scripts happy. */
 }
 
-static int ipw_chars_in_buffer(struct tty_struct *linux_tty)
+static unsigned int ipw_chars_in_buffer(struct tty_struct *linux_tty)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
 
 
        return room;
 }
 
-static int mips_ejtag_fdc_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int mips_ejtag_fdc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct mips_ejtag_fdc_tty_port *dport = tty->driver_data;
-       int chars;
+       unsigned int chars;
 
        /* Report the number of bytes in the xmit buffer */
        spin_lock(&dport->xmit_lock);
 
 static int moxa_write(struct tty_struct *, const unsigned char *, int);
 static unsigned int moxa_write_room(struct tty_struct *);
 static void moxa_flush_buffer(struct tty_struct *);
-static int moxa_chars_in_buffer(struct tty_struct *);
+static unsigned int moxa_chars_in_buffer(struct tty_struct *);
 static void moxa_set_termios(struct tty_struct *, struct ktermios *);
 static void moxa_stop(struct tty_struct *);
 static void moxa_start(struct tty_struct *);
 static void MoxaPortFlushData(struct moxa_port *, int);
 static int MoxaPortWriteData(struct tty_struct *, const unsigned char *, int);
 static int MoxaPortReadData(struct moxa_port *);
-static int MoxaPortTxQueue(struct moxa_port *);
+static unsigned int MoxaPortTxQueue(struct moxa_port *);
 static int MoxaPortRxQueue(struct moxa_port *);
 static unsigned int MoxaPortTxFree(struct moxa_port *);
 static void MoxaPortTxDisable(struct moxa_port *);
        tty_wakeup(tty);
 }
 
-static int moxa_chars_in_buffer(struct tty_struct *tty)
+static unsigned int moxa_chars_in_buffer(struct tty_struct *tty)
 {
        struct moxa_port *ch = tty->driver_data;
-       int chars;
+       unsigned int chars;
 
        chars = MoxaPortTxQueue(ch);
        if (chars)
 }
 
 
-static int MoxaPortTxQueue(struct moxa_port *port)
+static unsigned int MoxaPortTxQueue(struct moxa_port *port)
 {
        void __iomem *ofsAddr = port->tableAddr;
        u16 rptr, wptr, mask;
 
        return ret < 0 ? 0 : ret;
 }
 
-static int mxser_chars_in_buffer(struct tty_struct *tty)
+static unsigned int mxser_chars_in_buffer(struct tty_struct *tty)
 {
        struct mxser_port *info = tty->driver_data;
        return info->xmit_cnt;
 
        return TX_SIZE - kfifo_len(&dlci->fifo);
 }
 
-static int gsmtty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int gsmtty_chars_in_buffer(struct tty_struct *tty)
 {
        struct gsm_dlci *dlci = tty->driver_data;
        if (dlci->state == DLCI_CLOSED)
 
 }
 
 /* Returns number of chars in buffer, called by tty layer */
-static s32 ntty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int ntty_chars_in_buffer(struct tty_struct *tty)
 {
        struct port *port = tty->driver_data;
        struct nozomi *dc = get_dc_by_tty(tty);
 
        return ret;
 }
 
-static int uart_chars_in_buffer(struct tty_struct *tty)
+static unsigned int uart_chars_in_buffer(struct tty_struct *tty)
 {
        struct uart_state *state = tty->driver_data;
        struct uart_port *port;
        unsigned long flags;
-       int ret;
+       unsigned int ret;
 
        port = uart_port_lock(state, flags);
        ret = uart_circ_chars_pending(&state->xmit);
 
 /*
  * return count of bytes in transmit buffer
  */
-static int chars_in_buffer(struct tty_struct *tty)
+static unsigned int chars_in_buffer(struct tty_struct *tty)
 {
        struct slgt_info *info = tty->driver_data;
-       int count;
+       unsigned int count;
        if (sanity_check(info, tty->name, "chars_in_buffer"))
                return 0;
        count = tbuf_bytes(info);
-       DBGINFO(("%s chars_in_buffer()=%d\n", info->device_name, count));
+       DBGINFO(("%s chars_in_buffer()=%u\n", info->device_name, count));
        return count;
 }
 
 
  *     to be no queue on the device.
  */
 
-int tty_chars_in_buffer(struct tty_struct *tty)
+unsigned int tty_chars_in_buffer(struct tty_struct *tty)
 {
        if (tty->ops->chars_in_buffer)
                return tty->ops->chars_in_buffer(tty);
 
        return num;
 }
 
-static int vcc_chars_in_buffer(struct tty_struct *tty)
+static unsigned int vcc_chars_in_buffer(struct tty_struct *tty)
 {
        struct vcc_port *port;
-       u64 num;
+       unsigned int num;
 
        port = vcc_get_ne(tty->index);
        if (unlikely(!port)) {
 
        return acm_wb_is_avail(acm) ? acm->writesize : 0;
 }
 
-static int acm_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int acm_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct acm *acm = tty->driver_data;
        /*
 
        return room;
 }
 
-static int gs_chars_in_buffer(struct tty_struct *tty)
+static unsigned int gs_chars_in_buffer(struct tty_struct *tty)
 {
        struct gs_port  *port = tty->driver_data;
        unsigned long   flags;
-       int             chars = 0;
+       unsigned int    chars;
 
        spin_lock_irqsave(&port->port_lock, flags);
        chars = kfifo_len(&port->port_write_buf);
        spin_unlock_irqrestore(&port->port_lock, flags);
 
-       pr_vdebug("gs_chars_in_buffer: (%d,%p) chars=%d\n",
+       pr_vdebug("gs_chars_in_buffer: (%d,%p) chars=%u\n",
                port->port_num, tty, chars);
 
        return chars;
 
        return room;
 }
 
-static int dbc_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int dbc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct dbc_port         *port = tty->driver_data;
        unsigned long           flags;
-       int                     chars = 0;
+       unsigned int            chars;
 
        spin_lock_irqsave(&port->port_lock, flags);
        chars = kfifo_len(&port->write_fifo);
 
        return port->serial->type->write_room(tty);
 }
 
-static int serial_chars_in_buffer(struct tty_struct *tty)
+static unsigned int serial_chars_in_buffer(struct tty_struct *tty)
 {
        struct usb_serial_port *port = tty->driver_data;
        struct usb_serial *serial = port->serial;
 
 extern void tty_write_message(struct tty_struct *tty, char *msg);
 extern int tty_send_xchar(struct tty_struct *tty, char ch);
 extern int tty_put_char(struct tty_struct *tty, unsigned char c);
-extern int tty_chars_in_buffer(struct tty_struct *tty);
+extern unsigned int tty_chars_in_buffer(struct tty_struct *tty);
 extern unsigned int tty_write_room(struct tty_struct *tty);
 extern void tty_driver_flush_buffer(struct tty_struct *tty);
 extern void tty_throttle(struct tty_struct *tty);
 
        int  (*put_char)(struct tty_struct *tty, unsigned char ch);
        void (*flush_chars)(struct tty_struct *tty);
        unsigned int (*write_room)(struct tty_struct *tty);
-       int  (*chars_in_buffer)(struct tty_struct *tty);
+       unsigned int (*chars_in_buffer)(struct tty_struct *tty);
        int  (*ioctl)(struct tty_struct *tty,
                    unsigned int cmd, unsigned long arg);
        long (*compat_ioctl)(struct tty_struct *tty,
 
        rfcomm_dlc_unthrottle(dev->dlc);
 }
 
-static int rfcomm_tty_chars_in_buffer(struct tty_struct *tty)
+static unsigned int rfcomm_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;