提交 5e84a66f 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

staging: fwserial: fix TIOCGSERIAL implementation

TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
serial devices is only useful for setting the close_delay and
closing_wait parameters.

The xmit_fifo_size parameter could be used to set the hardware transmit
fifo size of a legacy UART when it could not be detected, but the
interface is limited to eight bits and should be left unset when not
used.

Fix the fwserial implementation by dropping its custom interpretation of
the unused xmit_fifo_size field, which was overflowed with the driver
FIFO size. Also leave the type and flags fields unset as these cannot be
changed.

The close_delay and closing_wait parameters returned by TIOCGSERIAL are
specified in centiseconds. The driver does not yet support changing
closing_wait, but let's report back the default value actually used (30
seconds).

Fixes: 7355ba34 ("staging: fwserial: Add TTY-over-Firewire serial driver")
Signed-off-by: NJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210407102334.32361-5-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a7eaaa9d
...@@ -1218,13 +1218,12 @@ static int get_serial_info(struct tty_struct *tty, ...@@ -1218,13 +1218,12 @@ static int get_serial_info(struct tty_struct *tty,
struct fwtty_port *port = tty->driver_data; struct fwtty_port *port = tty->driver_data;
mutex_lock(&port->port.mutex); mutex_lock(&port->port.mutex);
ss->type = PORT_UNKNOWN; ss->line = port->index;
ss->line = port->port.tty->index;
ss->flags = port->port.flags;
ss->xmit_fifo_size = FWTTY_PORT_TXFIFO_LEN;
ss->baud_base = 400000000; ss->baud_base = 400000000;
ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10; ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10;
ss->closing_wait = 3000;
mutex_unlock(&port->port.mutex); mutex_unlock(&port->port.mutex);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册