return count;
 }
 
-static int
+static unsigned int
 srmcons_write_room(struct tty_struct *tty)
 {
        return 512;
 
        return 1;
 }
 
-static int nfcon_tty_write_room(struct tty_struct *tty)
+static unsigned int nfcon_tty_write_room(struct tty_struct *tty)
 {
        return 64;
 }
 
        return count;
 }
 
-static int pdc_console_tty_write_room(struct tty_struct *tty)
+static unsigned int pdc_console_tty_write_room(struct tty_struct *tty)
 {
        return 32768; /* no limit, no buffer used */
 }
 
  *
  * Should be called while holding line->lock (this does not modify data).
  */
-static int write_room(struct line *line)
+static unsigned int write_room(struct line *line)
 {
        int n;
 
        return n - 1;
 }
 
-int line_write_room(struct tty_struct *tty)
+unsigned int line_write_room(struct tty_struct *tty)
 {
        struct line *line = tty->driver_data;
        unsigned long flags;
-       int room;
+       unsigned int room;
 
        spin_lock_irqsave(&line->lock, flags);
        room = write_room(line);
 
 extern 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 int line_write_room(struct tty_struct *tty);
+extern unsigned int line_write_room(struct tty_struct *tty);
 extern void line_throttle(struct tty_struct *tty);
 extern void line_unthrottle(struct tty_struct *tty);
 
 
 {
 }
 
-static int rs_write_room(struct tty_struct *tty)
+static unsigned int rs_write_room(struct tty_struct *tty)
 {
        /* Let's say iss can always accept 2K characters.. */
        return 2 * 1024;
 
 
 /* Return the count of free bytes in transmit buffer
  */
-static int mgslpc_write_room(struct tty_struct *tty)
+static unsigned int mgslpc_write_room(struct tty_struct *tty)
 {
        MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
        int ret;
 
 /*
  * TTY operations write_room function.
  */
-static int tpk_write_room(struct tty_struct *tty)
+static unsigned int tpk_write_room(struct tty_struct *tty)
 {
        return TPK_MAX_ROOM;
 }
 
        return char_copied;
 }
 
-static int ipoctal_write_room(struct tty_struct *tty)
+static unsigned int ipoctal_write_room(struct tty_struct *tty)
 {
        struct ipoctal_channel *channel = tty->driver_data;
 
 
        handle_minor_recv(mp);
 }
 
-static int capinc_tty_write_room(struct tty_struct *tty)
+static unsigned int capinc_tty_write_room(struct tty_struct *tty)
 {
        struct capiminor *mp = tty->driver_data;
-       int room;
+       unsigned int room;
 
        room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue);
        room *= CAPI_MAX_BLKSIZE;
-       pr_debug("capinc_tty_write_room = %d\n", room);
+       pr_debug("capinc_tty_write_room = %u\n", room);
        return room;
 }
 
 
        return count;
 }
 
-static int bcm_vk_tty_write_room(struct tty_struct *tty)
+static unsigned int bcm_vk_tty_write_room(struct tty_struct *tty)
 {
        struct bcm_vk *vk = dev_get_drvdata(tty->dev);
 
 
        return ret;
 }
 
-static int sdio_uart_write_room(struct tty_struct *tty)
+static unsigned int sdio_uart_write_room(struct tty_struct *tty)
 {
        struct sdio_uart_port *port = tty->driver_data;
        return FIFO_SIZE - kfifo_len(&port->xmit_fifo);
 
 }
 
 /* how much room is there for writing */
-static int hso_serial_write_room(struct tty_struct *tty)
+static unsigned int hso_serial_write_room(struct tty_struct *tty)
 {
        struct hso_serial *serial = tty->driver_data;
-       int room;
+       unsigned int room;
        unsigned long flags;
 
        spin_lock_irqsave(&serial->serial_lock, flags);
 
 /*
  * Returns the amount of free space in the output buffer.
  */
-static int tty3215_write_room(struct tty_struct *tty)
+static unsigned int tty3215_write_room(struct tty_struct *tty)
 {
        struct raw3215_info *raw = tty->driver_data;
 
 
  * a string of newlines. Every newline creates a new message which
  * needs 82 bytes.
  */
-static int
+static unsigned int
 sclp_tty_write_room (struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
-       int count;
+       unsigned int count;
 
        spin_lock_irqsave(&sclp_tty_lock, flags);
        count = 0;
 
  * to change as output buffers get emptied, or if the output flow
  * control is acted.
  */
-static int
+static unsigned int
 sclp_vt220_write_room(struct tty_struct *tty)
 {
        unsigned long flags;
        struct list_head *l;
-       int count;
+       unsigned int count;
 
        spin_lock_irqsave(&sclp_vt220_lock, flags);
        count = 0;
 
 /*
  * We always have room.
  */
-static int
+static unsigned int
 tty3270_write_room(struct tty_struct *tty)
 {
        return INT_MAX;
 
        return (n < 0) ? 0 : n;
 }
 
-static int fwtty_write_room(struct tty_struct *tty)
+static unsigned int fwtty_write_room(struct tty_struct *tty)
 {
        struct fwtty_port *port = tty->driver_data;
-       int n;
+       unsigned int n;
 
        spin_lock_bh(&port->lock);
        n = dma_fifo_avail(&port->tx_fifo);
        spin_unlock_bh(&port->lock);
 
-       fwtty_dbg(port, "%d\n", n);
+       fwtty_dbg(port, "%u\n", n);
 
        return n;
 }
 
        return len;
 }
 
-static int gdm_tty_write_room(struct tty_struct *tty)
+static unsigned int gdm_tty_write_room(struct tty_struct *tty)
 {
        struct gdm *gdm = tty->driver_data;
 
 
        return count;
 }
 
-static int gb_tty_write_room(struct tty_struct *tty)
+static unsigned int gb_tty_write_room(struct tty_struct *tty)
 {
        struct gb_tty *gb_tty = tty->driver_data;
        unsigned long flags;
 
        return ret;
 }
 
-static int rs_write_room(struct tty_struct *tty)
+static unsigned int rs_write_room(struct tty_struct *tty)
 {
        struct serial_state *info = tty->driver_data;
 
 
  * how much write room the driver can guarantee will be sent OR BUFFERED.  This
  * driver MUST honor the return value.
  */
-static int ehv_bc_tty_write_room(struct tty_struct *ttys)
+static unsigned int ehv_bc_tty_write_room(struct tty_struct *ttys)
 {
        struct ehv_bc_data *bc = ttys->driver_data;
        unsigned long flags;
-       int count;
+       unsigned int count;
 
        spin_lock_irqsave(&bc->lock, flags);
        count = CIRC_SPACE(bc->head, bc->tail, BUF_SIZE);
 
        return count;
 }
 
-static int goldfish_tty_write_room(struct tty_struct *tty)
+static unsigned int goldfish_tty_write_room(struct tty_struct *tty)
 {
        return 0x10000;
 }
 
  * how much write room the driver can guarantee will be sent OR BUFFERED.  This
  * driver MUST honor the return value.
  */
-static int hvc_write_room(struct tty_struct *tty)
+static unsigned int hvc_write_room(struct tty_struct *tty)
 {
        struct hvc_struct *hp = tty->driver_data;
 
 
  * absolutely WILL BUFFER if we can't send it.  This driver MUST honor the
  * return value, hence the reason for hvcs_struct buffering.
  */
-static int hvcs_write_room(struct tty_struct *tty)
+static unsigned int hvcs_write_room(struct tty_struct *tty)
 {
        struct hvcs_struct *hvcsd = tty->driver_data;
 
 
        spin_unlock_irqrestore(&hp->lock, flags);
 }
 
-static int hvsi_write_room(struct tty_struct *tty)
+static unsigned int hvsi_write_room(struct tty_struct *tty)
 {
        struct hvsi_struct *hp = tty->driver_data;
 
         * will see there is no room in outbuf and return.
         */
        while ((count > 0) && (hvsi_write_room(tty) > 0)) {
-               int chunksize = min(count, hvsi_write_room(tty));
+               int chunksize = min_t(int, count, hvsi_write_room(tty));
 
                BUG_ON(hp->n_outbuf < 0);
                memcpy(hp->outbuf + hp->n_outbuf, source, chunksize);
 
        return count;
 }
 
-static int ipw_write_room(struct tty_struct *linux_tty)
+static unsigned int ipw_write_room(struct tty_struct *linux_tty)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
        int room;
 
        return total;
 }
 
-static int mips_ejtag_fdc_tty_write_room(struct tty_struct *tty)
+static unsigned int mips_ejtag_fdc_tty_write_room(struct tty_struct *tty)
 {
        struct mips_ejtag_fdc_tty_port *dport = tty->driver_data;
        struct mips_ejtag_fdc_tty *priv = dport->driver;
-       int room;
+       unsigned int room;
 
        /* Report the space in the xmit buffer */
        spin_lock(&dport->xmit_lock);
 
 static int moxa_open(struct tty_struct *, struct file *);
 static void moxa_close(struct tty_struct *, struct file *);
 static int moxa_write(struct tty_struct *, const unsigned char *, int);
-static int moxa_write_room(struct tty_struct *);
+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 void moxa_set_termios(struct tty_struct *, struct ktermios *);
 static int MoxaPortReadData(struct moxa_port *);
 static int MoxaPortTxQueue(struct moxa_port *);
 static int MoxaPortRxQueue(struct moxa_port *);
-static int MoxaPortTxFree(struct moxa_port *);
+static unsigned int MoxaPortTxFree(struct moxa_port *);
 static void MoxaPortTxDisable(struct moxa_port *);
 static void MoxaPortTxEnable(struct moxa_port *);
 static int moxa_get_serial_info(struct tty_struct *, struct serial_struct *);
        return len;
 }
 
-static int moxa_write_room(struct tty_struct *tty)
+static unsigned int moxa_write_room(struct tty_struct *tty)
 {
        struct moxa_port *ch;
 
        return (wptr - rptr) & mask;
 }
 
-static int MoxaPortTxFree(struct moxa_port *port)
+static unsigned int MoxaPortTxFree(struct moxa_port *port)
 {
        void __iomem *ofsAddr = port->tableAddr;
        u16 rptr, wptr, mask;
 
        spin_unlock_irqrestore(&info->slock, flags);
 }
 
-static int mxser_write_room(struct tty_struct *tty)
+static unsigned int mxser_write_room(struct tty_struct *tty)
 {
        struct mxser_port *info = tty->driver_data;
        int ret;
 
        return sent;
 }
 
-static int gsmtty_write_room(struct tty_struct *tty)
+static unsigned int gsmtty_write_room(struct tty_struct *tty)
 {
        struct gsm_dlci *dlci = tty->driver_data;
        if (dlci->state == DLCI_CLOSED)
 
  * If the port is unplugged report lots of room and let the bits
  * dribble away so we don't block anything.
  */
-static int ntty_write_room(struct tty_struct *tty)
+static unsigned int ntty_write_room(struct tty_struct *tty)
 {
        struct port *port = tty->driver_data;
-       int room = 4096;
+       unsigned int room = 4096;
        const struct nozomi *dc = get_dc_by_tty(tty);
 
        if (dc)
 
  *     the other device.
  */
 
-static int pty_write_room(struct tty_struct *tty)
+static unsigned int pty_write_room(struct tty_struct *tty)
 {
        if (tty->flow.stopped)
                return 0;
 
        tty_port_hangup(&priv->port);
 }
 
-static int kgdb_nmi_tty_write_room(struct tty_struct *tty)
+static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty)
 {
        /* Actually, we can handle any amount as we use polled writes. */
        return 2048;
 
        return ret;
 }
 
-static int uart_write_room(struct tty_struct *tty)
+static unsigned int uart_write_room(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_free(&state->xmit);
 
        DBGINFO(("%s wait_until_sent exit\n", info->device_name));
 }
 
-static int write_room(struct tty_struct *tty)
+static unsigned int write_room(struct tty_struct *tty)
 {
        struct slgt_info *info = tty->driver_data;
-       int ret;
+       unsigned int ret;
 
        if (sanity_check(info, tty->name, "write_room"))
                return 0;
        ret = (info->tx_active) ? 0 : HDLC_MAX_FRAME_SIZE;
-       DBGINFO(("%s write_room=%d\n", info->device_name, ret));
+       DBGINFO(("%s write_room=%u\n", info->device_name, ret));
        return ret;
 }
 
 
  *     returned and data may be lost as there will be no flow control.
  */
  
-int tty_write_room(struct tty_struct *tty)
+unsigned int tty_write_room(struct tty_struct *tty)
 {
        if (tty->ops->write_room)
                return tty->ops->write_room(tty);
 
        return count;
 }
 
-static int ttynull_write_room(struct tty_struct *tty)
+static unsigned int ttynull_write_room(struct tty_struct *tty)
 {
        return 65536;
 }
 
        return total_sent ? total_sent : rv;
 }
 
-static int vcc_write_room(struct tty_struct *tty)
+static unsigned int vcc_write_room(struct tty_struct *tty)
 {
        struct vcc_port *port;
-       u64 num;
+       unsigned int num;
 
        port = vcc_get_ne(tty->index);
        if (unlikely(!port)) {
 
        return do_con_write(tty, &ch, 1);
 }
 
-static int con_write_room(struct tty_struct *tty)
+static unsigned int con_write_room(struct tty_struct *tty)
 {
        if (tty->flow.stopped)
                return 0;
 
        return count;
 }
 
-static int acm_tty_write_room(struct tty_struct *tty)
+static unsigned int acm_tty_write_room(struct tty_struct *tty)
 {
        struct acm *acm = tty->driver_data;
        /*
 
        spin_unlock_irqrestore(&port->port_lock, flags);
 }
 
-static int gs_write_room(struct tty_struct *tty)
+static unsigned int gs_write_room(struct tty_struct *tty)
 {
        struct gs_port  *port = tty->driver_data;
        unsigned long   flags;
-       int             room = 0;
+       unsigned int room = 0;
 
        spin_lock_irqsave(&port->port_lock, flags);
        if (port->port_usb)
                room = kfifo_avail(&port->port_write_buf);
        spin_unlock_irqrestore(&port->port_lock, flags);
 
-       pr_vdebug("gs_write_room: (%d,%p) room=%d\n",
+       pr_vdebug("gs_write_room: (%d,%p) room=%u\n",
                port->port_num, tty, room);
 
        return room;
 
        spin_unlock_irqrestore(&port->port_lock, flags);
 }
 
-static int dbc_tty_write_room(struct tty_struct *tty)
+static unsigned int dbc_tty_write_room(struct tty_struct *tty)
 {
        struct dbc_port         *port = tty->driver_data;
        unsigned long           flags;
-       int                     room = 0;
+       unsigned int            room;
 
        spin_lock_irqsave(&port->port_lock, flags);
        room = kfifo_avail(&port->write_fifo);
 
        return retval;
 }
 
-static int serial_write_room(struct tty_struct *tty)
+static unsigned int serial_write_room(struct tty_struct *tty)
 {
        struct usb_serial_port *port = tty->driver_data;
 
 
 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 int tty_write_room(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);
 extern void tty_unthrottle(struct tty_struct *tty);
 
  *
  *     Note: Do not call this function directly, call tty_driver_flush_chars
  * 
- * int  (*write_room)(struct tty_struct *tty);
+ * unsigned int  (*write_room)(struct tty_struct *tty);
  *
  *     This routine returns the numbers of characters the tty driver
  *     will accept for queuing to be written.  This number is subject
                      const unsigned char *buf, int count);
        int  (*put_char)(struct tty_struct *tty, unsigned char ch);
        void (*flush_chars)(struct tty_struct *tty);
-       int  (*write_room)(struct tty_struct *tty);
+       unsigned int (*write_room)(struct tty_struct *tty);
        int  (*chars_in_buffer)(struct tty_struct *tty);
        int  (*ioctl)(struct tty_struct *tty,
                    unsigned int cmd, unsigned long arg);
 
        return sent;
 }
 
-static int rfcomm_tty_write_room(struct tty_struct *tty)
+static unsigned int rfcomm_tty_write_room(struct tty_struct *tty)
 {
        struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
        int room = 0;