Skip to content

Commit 4d822b0

Browse files
committed
USB: serial: ftdi_sio: drop NDI quirk module parameter
NDI devices have been using a latency timer of 1 ms since commit b760dac ("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>
1 parent cde2437 commit 4d822b0

1 file changed

Lines changed: 3 additions & 38 deletions

File tree

drivers/usb/serial/ftdi_sio.c

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ struct ftdi_quirk {
107107
};
108108

109109
static int ftdi_jtag_probe(struct usb_serial *serial);
110-
static int ftdi_ndi_probe(struct usb_serial *serial);
111110
static int ftdi_stmclite_probe(struct usb_serial *serial);
112111
static int ftdi_8u2232c_probe(struct usb_serial *serial);
113112
static void ftdi_usb_uirt_setup(struct ftdi_private *priv);
@@ -118,7 +117,6 @@ static const struct ftdi_quirk ftdi_jtag_quirk = {
118117
};
119118

120119
static const struct ftdi_quirk ftdi_ndi_quirk = {
121-
.probe = ftdi_ndi_probe,
122120
};
123121

124122
static const struct ftdi_quirk ftdi_usb_uirt_quirk = {
@@ -2204,7 +2202,9 @@ static int ftdi_port_probe(struct usb_serial_port *port)
22042202
goto err_free;
22052203

22062204
ftdi_set_max_packet_size(port);
2207-
if (read_latency_timer(port) < 0)
2205+
if (quirk == &ftdi_ndi_quirk)
2206+
priv->latency = 1;
2207+
else if (read_latency_timer(port) < 0)
22082208
priv->latency = 16;
22092209
write_latency_timer(port);
22102210

@@ -2246,38 +2246,6 @@ static void ftdi_he_tira1_setup(struct ftdi_private *priv)
22462246
priv->force_rtscts = 1;
22472247
}
22482248

2249-
/*
2250-
* Module parameter to control latency timer for NDI FTDI-based USB devices.
2251-
* If this value is not set in /etc/modprobe.d/ its value will be set
2252-
* to 1ms.
2253-
*/
2254-
static int ndi_latency_timer = 1;
2255-
2256-
/*
2257-
* Setup for the NDI FTDI-based USB devices, which requires hardwired
2258-
* baudrate (19200 gets mapped to 1200000).
2259-
*/
2260-
static int ftdi_ndi_probe(struct usb_serial *serial)
2261-
{
2262-
struct usb_device *udev = serial->dev;
2263-
int latency = ndi_latency_timer;
2264-
2265-
if (latency == 0)
2266-
latency = 1;
2267-
if (latency > 99)
2268-
latency = 99;
2269-
2270-
dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
2271-
dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
2272-
2273-
/* FIXME: errors are not returned */
2274-
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
2275-
FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
2276-
FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
2277-
latency, 0, NULL, 0, WDR_TIMEOUT);
2278-
return 0;
2279-
}
2280-
22812249
/*
22822250
* First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko
22832251
* 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);
29052873
MODULE_AUTHOR(DRIVER_AUTHOR);
29062874
MODULE_DESCRIPTION(DRIVER_DESC);
29072875
MODULE_LICENSE("GPL");
2908-
2909-
module_param(ndi_latency_timer, int, 0644);
2910-
MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");

0 commit comments

Comments
 (0)