summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/ti_usb_3410_5052.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2021-04-07 12:39:21 +0200
committerJohan Hovold <johan@kernel.org>2021-04-08 09:46:02 +0200
commit01fd45f676f1b3785b7cdd5d815f9c31ddcd9dd1 (patch)
tree8cca03627d0c94db2a67b33c0d9578ecc6b56070 /drivers/usb/serial/ti_usb_3410_5052.c
parent5f92aee93a68c3f3b13dc28a7e220adbdc3433b0 (diff)
USB: serial: add generic support for TIOCSSERIAL
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 closing_wait parameter determines how long to wait for the transfer buffers to drain during close and the default timeout of 30 seconds may not be sufficient at low line speeds. In other cases, when for example flow is stopped, the default timeout may instead be too long. Add generic support for TIOCSSERIAL and TIOCGSERIAL with handling of the three common parameters close_delay, closing_wait and line for the benefit of all USB serial drivers while still allowing drivers to implement further functionality through the existing callbacks. This currently includes a few drivers that report their base baud clock rate even if that is really only of interest when setting custom divisors through the deprecated ASYNC_SPD_CUST interface; an interface which only the FTDI driver actually implements. Some drivers have also been reporting back a fake UART type, something which should no longer be needed and will be dropped by a follow-on patch. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/ti_usb_3410_5052.c')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index bb50098a0ce6..6df316bdb40f 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -328,10 +328,7 @@ static void ti_recv(struct usb_serial_port *port, unsigned char *data,
static void ti_send(struct ti_port *tport);
static int ti_set_mcr(struct ti_port *tport, unsigned int mcr);
static int ti_get_lsr(struct ti_port *tport, u8 *lsr);
-static int ti_get_serial_info(struct tty_struct *tty,
- struct serial_struct *ss);
-static int ti_set_serial_info(struct tty_struct *tty,
- struct serial_struct *ss);
+static void ti_get_serial_info(struct tty_struct *tty, struct serial_struct *ss);
static void ti_handle_new_msr(struct ti_port *tport, u8 msr);
static void ti_stop_read(struct ti_port *tport, struct tty_struct *tty);
@@ -435,7 +432,6 @@ static struct usb_serial_driver ti_1port_device = {
.throttle = ti_throttle,
.unthrottle = ti_unthrottle,
.get_serial = ti_get_serial_info,
- .set_serial = ti_set_serial_info,
.set_termios = ti_set_termios,
.tiocmget = ti_tiocmget,
.tiocmset = ti_tiocmset,
@@ -469,7 +465,6 @@ static struct usb_serial_driver ti_2port_device = {
.throttle = ti_throttle,
.unthrottle = ti_unthrottle,
.get_serial = ti_get_serial_info,
- .set_serial = ti_set_serial_info,
.set_termios = ti_set_termios,
.tiocmget = ti_tiocmget,
.tiocmset = ti_tiocmset,
@@ -1393,46 +1388,13 @@ free_data:
}
-static int ti_get_serial_info(struct tty_struct *tty,
- struct serial_struct *ss)
+static void ti_get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
{
struct usb_serial_port *port = tty->driver_data;
struct ti_port *tport = usb_get_serial_port_data(port);
- unsigned cwait;
-
- cwait = port->port.closing_wait;
- if (cwait != ASYNC_CLOSING_WAIT_NONE)
- cwait = jiffies_to_msecs(cwait) / 10;
ss->type = PORT_16550A;
- ss->line = port->minor;
ss->baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800;
- ss->close_delay = 50;
- ss->closing_wait = cwait;
-
- return 0;
-}
-
-
-static int ti_set_serial_info(struct tty_struct *tty,
- struct serial_struct *ss)
-{
- struct usb_serial_port *port = tty->driver_data;
- struct tty_port *tport = &port->port;
- unsigned cwait;
-
- cwait = ss->closing_wait;
- if (cwait != ASYNC_CLOSING_WAIT_NONE)
- cwait = msecs_to_jiffies(10 * ss->closing_wait);
-
- if (!capable(CAP_SYS_ADMIN)) {
- if (cwait != tport->closing_wait)
- return -EPERM;
- }
-
- tport->closing_wait = cwait;
-
- return 0;
}