{
        struct uart_8250_port *up = up_to_u8250p(port);
        unsigned int iir, lsr;
-       int space, count;
+       unsigned int space, count;
 
        iir = serial_port_in(port, UART_IIR);
 
                                          jiffies + unthrottle_timeout);
 
                } else {
-                       count = min(space, 256);
+                       count = min(space, 256U);
 
                        do {
                                serial8250_read_char(up, lsr);
 
  *     pre-allocate if memory guarantee is required).
  */
 
-int tty_buffer_space_avail(struct tty_port *port)
+unsigned int tty_buffer_space_avail(struct tty_port *port)
 {
        int space = port->buf.mem_limit - atomic_read(&port->buf.mem_used);
        return max(space, 0);
 
 #define _LINUX_TTY_FLIP_H
 
 extern int tty_buffer_set_limit(struct tty_port *port, int limit);
-extern int tty_buffer_space_avail(struct tty_port *port);
+extern unsigned int tty_buffer_space_avail(struct tty_port *port);
 extern int tty_buffer_request_room(struct tty_port *port, size_t size);
 extern int tty_insert_flip_string_flags(struct tty_port *port,
                const unsigned char *chars, const char *flags, size_t size);