]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: serial: ftdi_sio: drop NDI quirk module parameter
authorJohan Hovold <johan@kernel.org>
Mon, 10 Nov 2025 11:12:12 +0000 (12:12 +0100)
committerJohan Hovold <johan@kernel.org>
Mon, 17 Nov 2025 10:23:26 +0000 (11:23 +0100)
NDI devices have been using a latency timer of 1 ms since commit
b760dac290c3 ("USB: ftdi: support NDI devices"), which also added a
vendor specific module parameter that could be used to override the
default value for these devices.

Module parameters should generally be avoided as they apply to all
devices managed by a driver and vendor specific hacks should be kept out
of mainline.

Drop the module parameter in favour of the generic sysfs interface for
setting the latency timer (e.g. using udev rules) while keeping the
default 1 ms timer for NDI devices.

Note that there seems to be no (correct) public references to the module
parameter and most likely no one is using it.

Cc: Ryan Mann <rmann@ndigital.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ftdi_sio.c

index d77c1ccafe0514e51f9fc94b553d6340a74e95be..be79a8746098c205f2e52b6ccba94c2f50b43936 100644 (file)
@@ -107,7 +107,6 @@ struct ftdi_quirk {
 };
 
 static int   ftdi_jtag_probe(struct usb_serial *serial);
-static int   ftdi_ndi_probe(struct usb_serial *serial);
 static int   ftdi_stmclite_probe(struct usb_serial *serial);
 static int   ftdi_8u2232c_probe(struct usb_serial *serial);
 static void  ftdi_usb_uirt_setup(struct ftdi_private *priv);
@@ -118,7 +117,6 @@ static const struct ftdi_quirk ftdi_jtag_quirk = {
 };
 
 static const struct ftdi_quirk ftdi_ndi_quirk = {
-       .probe  = ftdi_ndi_probe,
 };
 
 static const struct ftdi_quirk ftdi_usb_uirt_quirk = {
@@ -2204,7 +2202,9 @@ static int ftdi_port_probe(struct usb_serial_port *port)
                goto err_free;
 
        ftdi_set_max_packet_size(port);
-       if (read_latency_timer(port) < 0)
+       if (quirk == &ftdi_ndi_quirk)
+               priv->latency = 1;
+       else if (read_latency_timer(port) < 0)
                priv->latency = 16;
        write_latency_timer(port);
 
@@ -2246,38 +2246,6 @@ static void ftdi_he_tira1_setup(struct ftdi_private *priv)
        priv->force_rtscts = 1;
 }
 
-/*
- * Module parameter to control latency timer for NDI FTDI-based USB devices.
- * If this value is not set in /etc/modprobe.d/ its value will be set
- * to 1ms.
- */
-static int ndi_latency_timer = 1;
-
-/*
- * Setup for the NDI FTDI-based USB devices, which requires hardwired
- * baudrate (19200 gets mapped to 1200000).
- */
-static int ftdi_ndi_probe(struct usb_serial *serial)
-{
-       struct usb_device *udev = serial->dev;
-       int latency = ndi_latency_timer;
-
-       if (latency == 0)
-               latency = 1;
-       if (latency > 99)
-               latency = 99;
-
-       dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
-       dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
-
-       /* FIXME: errors are not returned */
-       usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-                               FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
-                               FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
-                               latency, 0, NULL, 0, WDR_TIMEOUT);
-       return 0;
-}
-
 /*
  * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko
  * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from
@@ -2905,6 +2873,3 @@ module_usb_serial_driver(serial_drivers, id_table_combined);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-
-module_param(ndi_latency_timer, int, 0644);
-MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");