tty: make everyone's write_room return >= 0

The tty line disciplines don't expect tty_operations::write_room to
return negative values. Fix the five drivers which violate this.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210302062214.29627-44-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby 2021-03-02 07:22:14 +01:00 committed by Greg Kroah-Hartman
parent 10eb63e5a9
commit 6bfbfcfc58
5 changed files with 6 additions and 6 deletions

View File

@ -188,7 +188,7 @@ static int gdm_tty_write_room(struct tty_struct *tty)
struct gdm *gdm = tty->driver_data;
if (!GDM_TTY_READY(gdm))
return -ENODEV;
return 0;
return WRITE_SIZE;
}

View File

@ -235,10 +235,10 @@ static int ipw_write_room(struct tty_struct *linux_tty)
/* FIXME: Exactly how is the tty object locked here .. */
if (!tty)
return -ENODEV;
return 0;
if (!tty->port.count)
return -EINVAL;
return 0;
room = IPWIRELESS_TX_QUEUE_SIZE - tty->tx_bytes_queued;
if (room < 0)

View File

@ -3048,7 +3048,7 @@ static int gsmtty_write_room(struct tty_struct *tty)
{
struct gsm_dlci *dlci = tty->driver_data;
if (dlci->state == DLCI_CLOSED)
return -EINVAL;
return 0;
return TX_SIZE - kfifo_len(&dlci->fifo);
}

View File

@ -878,7 +878,7 @@ static int vcc_write_room(struct tty_struct *tty)
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: write_room: Failed to find VCC port\n");
return -ENODEV;
return 0;
}
num = VCC_BUFF_LEN - port->chars_in_buffer;

View File

@ -1042,7 +1042,7 @@ static int mos7720_write_room(struct tty_struct *tty)
mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL)
return -ENODEV;
return 0;
/* FIXME: Locking */
for (i = 0; i < NUM_URBS; ++i) {