USB: serial: stop reporting legacy UART types
authorJohan Hovold <johan@kernel.org>
Wed, 7 Apr 2021 10:39:22 +0000 (12:39 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 8 Apr 2021 07:46:02 +0000 (09:46 +0200)
The TIOCGSERIAL ioctl can be used to set and retrieve the UART type for
legacy UARTs, but some USB serial drivers have been reporting back
random types in order to "make user-space happy".

Some applications have historically expected TIOCGSERIAL to be
implemented, but judging from the Debian sources, the port type not
being PORT_UNKNOWN is only used to check for the existence of legacy
serial ports (ttySn).

Drivers like ftdi_sio have been using PORT_UNKNOWN for twenty years (and
option for 10 years) without anyone complaining so let's stop reporting
back anything else.

In the unlikely event that this do cause problems, this should be fixed
tree-wide anyway (e.g. for all USB serial drivers and also CDC-ACM).

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ark3116.c
drivers/usb/serial/f81232.c
drivers/usb/serial/f81534.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/opticon.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/whiteheat.c

index c0cf60e9273d4e53c1a28ab14f409cc3897d4614..5dd710e9fe7d4f2246d601beaa7c373b1ce8d065 100644 (file)
@@ -385,12 +385,6 @@ err_free:
        return result;
 }
 
-static void ark3116_get_serial_info(struct tty_struct *tty,
-                       struct serial_struct *ss)
-{
-       ss->type = PORT_16654;
-}
-
 static int ark3116_tiocmget(struct tty_struct *tty)
 {
        struct usb_serial_port *port = tty->driver_data;
@@ -627,7 +621,6 @@ static struct usb_serial_driver ark3116_device = {
        .port_probe =           ark3116_port_probe,
        .port_remove =          ark3116_port_remove,
        .set_termios =          ark3116_set_termios,
-       .get_serial =           ark3116_get_serial_info,
        .tiocmget =             ark3116_tiocmget,
        .tiocmset =             ark3116_tiocmset,
        .tiocmiwait =           usb_serial_generic_tiocmiwait,
index 5e34b364d94d058f19dc9636798d87f26d944876..b4b847dce4bcae70ef6288a651e6ea23922c696e 100644 (file)
@@ -825,7 +825,6 @@ static void f81232_get_serial(struct tty_struct *tty, struct serial_struct *ss)
        struct usb_serial_port *port = tty->driver_data;
        struct f81232_private *priv = usb_get_serial_port_data(port);
 
-       ss->type = PORT_16550A;
        ss->baud_base = priv->baud_base;
 }
 
index 633de52feaad6f9c2f88c5388092c1085dc55f0a..c0bca52ef92aa905b5302779e416b6cb235d4504 100644 (file)
@@ -1147,7 +1147,6 @@ static void f81534_get_serial_info(struct tty_struct *tty, struct serial_struct
 
        port_priv = usb_get_serial_port_data(port);
 
-       ss->type = PORT_16550A;
        ss->baud_base = port_priv->baud_base;
 }
 
index 6b86e68ee2e8eed020af6b5ff1bd1a8126c5e870..e6fe3882bf691d3913a12352eed9f712cda0a9cb 100644 (file)
@@ -1594,12 +1594,6 @@ static int edge_tiocmget(struct tty_struct *tty)
        return result;
 }
 
-static void get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
-{
-       ss->type = PORT_16550A;
-}
-
-
 /*****************************************************************************
  * SerialIoctl
  *     this function handles any ioctl calls to the driver
@@ -3061,7 +3055,6 @@ static struct usb_serial_driver edgeport_2port_device = {
        .set_termios            = edge_set_termios,
        .tiocmget               = edge_tiocmget,
        .tiocmset               = edge_tiocmset,
-       .get_serial             = get_serial_info,
        .tiocmiwait             = usb_serial_generic_tiocmiwait,
        .get_icount             = usb_serial_generic_get_icount,
        .write                  = edge_write,
@@ -3097,7 +3090,6 @@ static struct usb_serial_driver edgeport_4port_device = {
        .set_termios            = edge_set_termios,
        .tiocmget               = edge_tiocmget,
        .tiocmset               = edge_tiocmset,
-       .get_serial             = get_serial_info,
        .tiocmiwait             = usb_serial_generic_tiocmiwait,
        .get_icount             = usb_serial_generic_get_icount,
        .write                  = edge_write,
@@ -3133,7 +3125,6 @@ static struct usb_serial_driver edgeport_8port_device = {
        .set_termios            = edge_set_termios,
        .tiocmget               = edge_tiocmget,
        .tiocmset               = edge_tiocmset,
-       .get_serial             = get_serial_info,
        .tiocmiwait             = usb_serial_generic_tiocmiwait,
        .get_icount             = usb_serial_generic_get_icount,
        .write                  = edge_write,
@@ -3169,7 +3160,6 @@ static struct usb_serial_driver epic_device = {
        .set_termios            = edge_set_termios,
        .tiocmget               = edge_tiocmget,
        .tiocmset               = edge_tiocmset,
-       .get_serial             = get_serial_info,
        .tiocmiwait             = usb_serial_generic_tiocmiwait,
        .get_icount             = usb_serial_generic_get_icount,
        .write                  = edge_write,
index dce994c29afe06d4c61d866495a5e5e58f1cdaf8..f548cdbf0a51989797946b047bc9f09a12b465df 100644 (file)
@@ -2433,11 +2433,6 @@ static int edge_tiocmget(struct tty_struct *tty)
        return result;
 }
 
-static void get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
-{
-       ss->type = PORT_16550A;
-}
-
 static void edge_break(struct tty_struct *tty, int break_state)
 {
        struct usb_serial_port *port = tty->driver_data;
@@ -2696,7 +2691,6 @@ static struct usb_serial_driver edgeport_1port_device = {
        .release                = edge_release,
        .port_probe             = edge_port_probe,
        .port_remove            = edge_port_remove,
-       .get_serial             = get_serial_info,
        .set_termios            = edge_set_termios,
        .tiocmget               = edge_tiocmget,
        .tiocmset               = edge_tiocmset,
@@ -2735,7 +2729,6 @@ static struct usb_serial_driver edgeport_2port_device = {
        .release                = edge_release,
        .port_probe             = edge_port_probe,
        .port_remove            = edge_port_remove,
-       .get_serial             = get_serial_info,
        .set_termios            = edge_set_termios,
        .tiocmget               = edge_tiocmget,
        .tiocmset               = edge_tiocmset,
index 4012b448388a88e2d2dc023d87c865251a728d5a..d3f1bdb26fd4fddd15b226829ab2344f0493b7eb 100644 (file)
@@ -1634,11 +1634,6 @@ static int mos7720_tiocmset(struct tty_struct *tty,
        return 0;
 }
 
-static void get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
-{
-       ss->type = PORT_16550A;
-}
-
 static int mos7720_ioctl(struct tty_struct *tty,
                         unsigned int cmd, unsigned long arg)
 {
@@ -1778,7 +1773,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
        .ioctl                  = mos7720_ioctl,
        .tiocmget               = mos7720_tiocmget,
        .tiocmset               = mos7720_tiocmset,
-       .get_serial             = get_serial_info,
        .set_termios            = mos7720_set_termios,
        .write                  = mos7720_write,
        .write_room             = mos7720_write_room,
index d20fb0a678dc196443423713ca3b3d2ed6f742e8..28e4093794e079eca8b32c7f6d18350b4ac535c8 100644 (file)
@@ -1383,16 +1383,6 @@ static int mos7840_get_lsr_info(struct tty_struct *tty,
        return 0;
 }
 
-/*****************************************************************************
- * mos7840_get_serial_info
- *      function to get information about serial port
- *****************************************************************************/
-
-static void mos7840_get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
-{
-       ss->type = PORT_16550A;
-}
-
 /*****************************************************************************
  * SerialIoctl
  *     this function handles any ioctl calls to the driver
@@ -1771,7 +1761,6 @@ static struct usb_serial_driver moschip7840_4port_device = {
        .probe = mos7840_probe,
        .attach = mos7840_attach,
        .ioctl = mos7840_ioctl,
-       .get_serial = mos7840_get_serial_info,
        .set_termios = mos7840_set_termios,
        .break_ctl = mos7840_break,
        .tiocmget = mos7840_tiocmget,
index db84afcf7f1ab9c88210ad5d00659eba6d676f2a..40c713fae0c38ff00d0b81916e269f82d383944b 100644 (file)
@@ -352,12 +352,6 @@ static int opticon_tiocmset(struct tty_struct *tty,
        return 0;
 }
 
-static void get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
-{
-       /* fake emulate a 16550 uart to make userspace code happy */
-       ss->type = PORT_16550A;
-}
-
 static int opticon_port_probe(struct usb_serial_port *port)
 {
        struct opticon_private *priv;
@@ -399,7 +393,6 @@ static struct usb_serial_driver opticon_device = {
        .chars_in_buffer =      opticon_chars_in_buffer,
        .throttle =             usb_serial_generic_throttle,
        .unthrottle =           usb_serial_generic_unthrottle,
-       .get_serial =           get_serial_info,
        .tiocmget =             opticon_tiocmget,
        .tiocmset =             opticon_tiocmset,
        .process_read_urb =     opticon_process_read_urb,
index 64f08a45eb4698b66a8de2c1d2347c9f1badcfc3..fd773d252691b86a42d4b17da31a2e1a6bc68217 100644 (file)
@@ -1048,11 +1048,6 @@ static int pl2303_carrier_raised(struct usb_serial_port *port)
        return 0;
 }
 
-static void pl2303_get_serial(struct tty_struct *tty, struct serial_struct *ss)
-{
-       ss->type = PORT_16654;
-}
-
 static void pl2303_set_break(struct usb_serial_port *port, bool enable)
 {
        struct usb_serial *serial = port->serial;
@@ -1236,7 +1231,6 @@ static struct usb_serial_driver pl2303_device = {
        .close =                pl2303_close,
        .dtr_rts =              pl2303_dtr_rts,
        .carrier_raised =       pl2303_carrier_raised,
-       .get_serial =           pl2303_get_serial,
        .break_ctl =            pl2303_break_ctl,
        .set_termios =          pl2303_set_termios,
        .tiocmget =             pl2303_tiocmget,
index 6df316bdb40f11d7d52a20c1ffe3bf47f6a3ca6f..c312d0cce5fbd86e4f2e6a2d7353a1102153de8c 100644 (file)
@@ -1393,7 +1393,6 @@ 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);
 
-       ss->type = PORT_16550A;
        ss->baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800;
 }
 
index 6a95c5a0056f0dc9a0a36dbe711bfd9618b65993..5116ed9db3eb41e0bb1e4570a69b67af00c9392a 100644 (file)
@@ -441,7 +441,6 @@ static int whiteheat_tiocmset(struct tty_struct *tty,
 
 static void whiteheat_get_serial(struct tty_struct *tty, struct serial_struct *ss)
 {
-       ss->type = PORT_16654;
        ss->baud_base = 460800;
 }