1. 13 Apr, 2021 10 commits
  2. 12 Apr, 2021 2 commits
  3. 09 Apr, 2021 1 commit
  4. 08 Apr, 2021 27 commits
    • Johan Hovold's avatar
      USB: serial: io_edgeport: drop unused definitions · f8edbd51
      Johan Hovold authored
      Drop unused definitions relating to a never mainlined custom
      proc-interface and some likewise unused string descriptor definitions.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      f8edbd51
    • Johan Hovold's avatar
      USB: serial: ti_usb_3410_5052: switch to 30-second closing wait · 8665444b
      Johan Hovold authored
      Switch to using the system-wide default 30-second closing-wait timeout
      instead of the driver specific 40-second timeout.
      
      The timeout can be changed per port using TIOCSSERIAL (setserial) if
      needed.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      8665444b
    • Johan Hovold's avatar
      USB: serial: ti_usb_3410_5052: drop closing_wait module parameter · 9b31f8cd
      Johan Hovold authored
      The ti_usb_3410_5052 has supported changing the closing_wait parameter
      through TIOCSSERIAL (setserial) for about a decade and commit
      f1175daa ("USB: ti_usb_3410_5052: kill custom closing_wait").
      
      It's time to drop the corresponding driver-specific module parameter.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      9b31f8cd
    • Johan Hovold's avatar
      USB: serial: io_ti: switch to 30-second closing wait · 2813b165
      Johan Hovold authored
      Switch to using the system-wide default 30-second closing-wait timeout
      instead of the driver specific 40-second timeout.
      
      The timeout can be changed per port using TIOCSSERIAL (setserial) if
      needed.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      2813b165
    • Johan Hovold's avatar
      USB: serial: io_ti: drop closing_wait module parameter · d669a51d
      Johan Hovold authored
      Now that all USB serial drivers supports setting the closing_wait
      parameter through TIOCSSERIAL (setserial) it's time to drop the
      corresponding io_ti module parameter.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      d669a51d
    • Johan Hovold's avatar
      USB: serial: ftdi_sio: clean up TIOCSSERIAL · 0428bf68
      Johan Hovold authored
      The TIOCSSERIAL implementation needs to compare the old flag and divisor
      settings with the new to detect ASYNC_SPD changes, but there's no need
      to copy all driver state to the stack for that.
      
      While at it, unbreak the function parameter list.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      0428bf68
    • Johan Hovold's avatar
      USB: serial: ftdi_sio: simplify TIOCGSERIAL permission check · c12860c0
      Johan Hovold authored
      Changing the deprecated custom_divisor field is an unprivileged
      operation so after verifying that flag field does not contain any
      privileged changes both updates can be carried out by any user.
      
      Combine the two branches and drop the erroneous comment.
      
      Note that private flags field is only used for ASYNC flags so there's no
      need to try to retain any other bits when updating the flags.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      c12860c0
    • Johan Hovold's avatar
      USB: serial: ftdi_sio: ignore baud_base changes · 9378379b
      Johan Hovold authored
      The TIOCSSERIAL error handling is inconsistent at best, but drivers tend
      to ignore requests to change parameters which cannot be changed rather
      than return an error.
      
      The FTDI driver ignores change requests for all immutable parameters but
      baud_base so return success also in this case for consistency.
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      9378379b
    • Johan Hovold's avatar
      USB: serial: stop reporting legacy UART types · f64d74a5
      Johan Hovold authored
      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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      f64d74a5
    • Johan Hovold's avatar
      USB: serial: add generic support for TIOCSSERIAL · 01fd45f6
      Johan Hovold authored
      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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      01fd45f6
    • Johan Hovold's avatar
      USB: serial: fix return value for unsupported ioctls · 5f92aee9
      Johan Hovold authored
      Drivers should return -ENOTTY ("Inappropriate I/O control operation")
      when an ioctl isn't supported, while -EINVAL is used for invalid
      arguments.
      
      Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned
      -EINVAL when a USB serial driver did not implement the corresponding
      methods.
      
      Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a
      corresponding Fixes tag below.
      
      Fixes: d281da7f ("tty: Make tiocgicount a handler")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      5f92aee9
    • Johan Hovold's avatar
      USB: serial: whiteheat: fix TIOCGSERIAL implementation · 6f9f8aea
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      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.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      6f9f8aea
    • Johan Hovold's avatar
      USB: serial: usb_wwan: fix TIOCGSERIAL implementation · b6be5562
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      The baud_base parameter could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      Fix the usb_wwan TIOCGSERIAL implementation by dropping its custom
      interpretation of the unused port and baud_base fields, which were set
      to the port index and current line speed, respectively.
      
      Fixes: 02303f73 ("usb-wwan: implement TIOCGSERIAL and TIOCSSERIAL to avoid blocking close(2)")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      b6be5562
    • Johan Hovold's avatar
      USB: serial: usb_wwan: fix unprivileged TIOCCSERIAL · a3cb01e2
      Johan Hovold authored
      TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
      serial devices is only useful for setting the close_delay and
      closing_wait parameters.
      
      A non-privileged user has only ever been able to set the since long
      deprecated ASYNC_SPD flags and trying to change any other *supported*
      feature should result in -EPERM being returned. Setting the current
      values for any supported features should return success.
      
      Fix the usb_wwan implementation which instead indicated that the
      TIOCSSERIAL ioctl was not even implemented when a non-privileged user
      set the current values.
      
      Fixes: 02303f73 ("usb-wwan: implement TIOCGSERIAL and TIOCSSERIAL to avoid blocking close(2)")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      a3cb01e2
    • Johan Hovold's avatar
      USB: serial: usb_wwan: fix TIOCSSERIAL jiffies conversions · 3d732690
      Johan Hovold authored
      The port close_delay and closing_wait parameters set by TIOCSSERIAL are
      specified in jiffies and not milliseconds.
      
      Add the missing conversions so that the TIOCSSERIAL works as expected
      also when HZ is not 1000.
      
      Fixes: 02303f73 ("usb-wwan: implement TIOCGSERIAL and TIOCSSERIAL to avoid blocking close(2)")
      Cc: stable@vger.kernel.org      # 2.6.38
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      3d732690
    • Johan Hovold's avatar
      USB: serial: ti_usb_3410_5052: fix TIOCSSERIAL permission check · d370c90d
      Johan Hovold authored
      Changing the port closing-wait parameter is a privileged operation so
      make sure to return -EPERM if a regular user tries to change it.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      d370c90d
    • Johan Hovold's avatar
      USB: serial: ti_usb_3410_5052: fix TIOCGSERIAL implementation · 4c47dc2a
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      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.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds. The driver does not yet support changing
      close_delay, but let's report back the default value actually used (0.5
      seconds).
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      4c47dc2a
    • Johan Hovold's avatar
      USB: serial: ssu100: fix TIOCGSERIAL implementation · 67a94877
      Johan Hovold authored
      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.
      
      Similarly, baud_base could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      
      Fixes: 52af9545 ("USB: add USB serial ssu100 driver")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      67a94877
    • Johan Hovold's avatar
      USB: serial: quatech2: fix TIOCGSERIAL implementation · 4065158c
      Johan Hovold authored
      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.
      
      Similarly, baud_base could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      
      Fixes: f7a33e60 ("USB: serial: add quatech2 usb to serial driver")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      4065158c
    • Johan Hovold's avatar
      USB: serial: pl2303: fix TIOCGSERIAL implementation · 5b489012
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      The baud_base parameter could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds. The driver does not yet support changing
      these, but let's report back the default values actually used (0.5 and
      30 seconds, respectively).
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      5b489012
    • Johan Hovold's avatar
      USB: serial: opticon: fix TIOCGSERIAL implementation · aa6a4585
      Johan Hovold authored
      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.
      
      Similarly, baud_base could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      
      Fixes: faac64ad ("USB: serial: opticon: add serial line ioctls")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      aa6a4585
    • Johan Hovold's avatar
      USB: serial: mos7840: fix TIOCGSERIAL implementation · a804834b
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      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.
      
      Similarly, baud_base could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      
      Fixes: 3f542974 ("USB: Moschip 7840 USB-Serial Driver")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      a804834b
    • Johan Hovold's avatar
      USB: serial: mos7720: fix TIOCGSERIAL implementation · 8458e354
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      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.
      
      Similarly, baud_base could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      
      Fixes: 0f64478c ("USB: add USB serial mos7720 driver")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      8458e354
    • Johan Hovold's avatar
      USB: serial: io_ti: fix TIOCGSERIAL implementation · c2f58d24
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      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.
      
      Similarly, baud_base could be used to set the UART base clock when it
      could not be detected but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing close_delay, but let's report back the default value actually
      used (0.5 seconds).
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      c2f58d24
    • Johan Hovold's avatar
      USB: serial: io_edgeport: fix TIOCGSERIAL implementation · e54fbdbf
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      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.
      
      Similarly, baud_base could be used to set the uart base clock when it
      could not be detected, but might as well be left unset when it is not
      known.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds (not jiffies). The driver does not yet support
      changing these, but let's report back the default values actually used
      (0.5 and 30 seconds, respectively).
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      e54fbdbf
    • Johan Hovold's avatar
      USB: serial: ftdi_sio: fix TIOCGSERIAL implementation · 2ab58361
      Johan Hovold authored
      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 FTDI driver is the only USB serial driver supporting the deprecated
      ASYNC_SPD flags, which are reported back as they should by TIOCGSERIAL,
      but the returned parameters did not include the line number.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds. The driver does not yet support changing
      these, but let's report back the default values actually used (0.5 and
      30 seconds, respectively).
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      2ab58361
    • Johan Hovold's avatar
      USB: serial: f81534: fix TIOCGSERIAL implementation · 5c1426df
      Johan Hovold authored
      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 port parameter is used to set the I/O port and does not make any
      sense to use for USB serial devices.
      
      The close_delay and closing_wait parameters returned by TIOCGSERIAL are
      specified in centiseconds. The driver does not yet support changing
      these, but let's report back the default values actually used (0.5 and
      30 seconds, respectively).
      
      Fixes: aac1fc38 ("USB: serial: add Fintek F81232 usb to serial driver")
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      5c1426df