Skip to contentSkip to conversation

USB: serial: closing-wait cleanups

PATCH In review Johan Hovold 2 participants 7 messages Apr 7, 2021 – Apr 8, 2021

Subsystems (2)
lore
Share & tools
lore

Johan Hovold

author maintainer
#0 lore raw

cover USB: serial: closing-wait cleanups

Now that all USB serial drivers supports changing the closing_wait parameter through TIOCSSERIAL (setserial), we can remove the related driver-specific module parameters and settings.

These depend on the recently posted TIOCSSERIAL series.

Johan

Johan Hovold (4):
USB: serial: io_ti: drop closing_wait module parameter
USB: serial: io_ti: switch to 30-second closing wait
USB: serial: ti_usb_3410_5052: drop closing_wait module parameter
USB: serial: ti_usb_3410_5052: switch to 30-second closing wait

 drivers/usb/serial/io_ti.c            | 7 -------
 drivers/usb/serial/ti_usb_3410_5052.c | 9 ---------
 2 files changed, 16 deletions(-)
Signature · 1 line
2.26.3
author maintainer
#1 lore raw

PATCH 1/4 USB: serial: io_ti: drop closing_wait module parameter

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.

---
 drivers/usb/serial/io_ti.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/usb/serial/io_ti.c +1 -5
index f548cdbf0a51..6eff0e5a7545 100644
@@ -211,7 +211,6 @@ static const struct usb_device_id id_table_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static int closing_wait = EDGE_CLOSING_WAIT;
 static bool ignore_cpu_rev;
 static int default_uart_mode;		/* RS232 */
 
@@ -2593,7 +2592,7 @@ static int edge_port_probe(struct usb_serial_port *port)
 	if (ret)
 		goto err;
 
-	port->port.closing_wait = msecs_to_jiffies(closing_wait * 10);
+	port->port.closing_wait = msecs_to_jiffies(EDGE_CLOSING_WAIT * 10);
 	port->port.drain_delay = 1;
 
 	return 0;
@@ -2759,9 +2758,6 @@ MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 MODULE_FIRMWARE("edgeport/down3.bin");
 
-module_param(closing_wait, int, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs");
-
 module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(ignore_cpu_rev,
 			"Ignore the cpu revision when connecting to a device");
Signature · 1 line
2.26.3
author maintainer
#2 lore raw

PATCH 2/4 USB: serial: io_ti: switch to 30-second closing wait

In reply to Johan Hovold

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.

---
 drivers/usb/serial/io_ti.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/usb/serial/io_ti.c +0 -3
index 6eff0e5a7545..75325c2b295e 100644
@@ -60,8 +60,6 @@
 #define EDGE_READ_URB_STOPPING	1
 #define EDGE_READ_URB_STOPPED	2
 
-#define EDGE_CLOSING_WAIT	4000	/* in .01 sec */
-
 
 /* Product information read from the Edgeport */
 struct product_info {
@@ -2592,7 +2590,6 @@ static int edge_port_probe(struct usb_serial_port *port)
 	if (ret)
 		goto err;
 
-	port->port.closing_wait = msecs_to_jiffies(EDGE_CLOSING_WAIT * 10);
 	port->port.drain_delay = 1;
 
 	return 0;
Signature · 1 line
2.26.3
author maintainer
#3 lore raw

PATCH 3/4 USB: serial: ti_usb_3410_5052: drop closing_wait module parameter

In reply to Johan Hovold

The ti_usb_3410_5052 has supported changing the closing_wait parameter through TIOCSSERIAL (setserial) for about a decade and commit f1175daa5312 ("USB: ti_usb_3410_5052: kill custom closing_wait").

It's time to drop the corresponding driver-specific module parameter.

---
 drivers/usb/serial/ti_usb_3410_5052.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/usb/serial/ti_usb_3410_5052.c +1 -7
index c312d0cce5fb..35cc1be738ef 100644
@@ -344,8 +344,6 @@ static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev,
 
 static int ti_download_firmware(struct ti_device *tdev);
 
-static int closing_wait = TI_DEFAULT_CLOSING_WAIT;
-
 static const struct usb_device_id ti_id_table_3410[] = {
 	{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
 	{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
@@ -497,10 +495,6 @@ MODULE_FIRMWARE("moxa/moxa-1131.fw");
 MODULE_FIRMWARE("moxa/moxa-1150.fw");
 MODULE_FIRMWARE("moxa/moxa-1151.fw");
 
-module_param(closing_wait, int, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(closing_wait,
-    "Maximum wait for data to drain in close, in .01 secs, default is 4000");
-
 MODULE_DEVICE_TABLE(usb, ti_id_table_combined);
 
 module_usb_serial_driver(serial_drivers, ti_id_table_combined);
@@ -608,7 +602,7 @@ static int ti_port_probe(struct usb_serial_port *port)
 		tport->tp_uart_base_addr = TI_UART1_BASE_ADDR;
 	else
 		tport->tp_uart_base_addr = TI_UART2_BASE_ADDR;
-	port->port.closing_wait = msecs_to_jiffies(10 * closing_wait);
+	port->port.closing_wait = msecs_to_jiffies(10 * TI_DEFAULT_CLOSING_WAIT);
 	tport->tp_port = port;
 	tport->tp_tdev = usb_get_serial_data(port->serial);
 
Signature · 1 line
2.26.3
author maintainer
#4 lore raw

PATCH 4/4 USB: serial: ti_usb_3410_5052: switch to 30-second closing wait

In reply to Johan Hovold

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.

---
 drivers/usb/serial/ti_usb_3410_5052.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/usb/serial/ti_usb_3410_5052.c +0 -3
index 35cc1be738ef..03839289d6c0 100644
@@ -270,8 +270,6 @@ struct ti_firmware_header {
 
 #define TI_TRANSFER_TIMEOUT	2
 
-#define TI_DEFAULT_CLOSING_WAIT	4000		/* in .01 secs */
-
 /* read urb states */
 #define TI_READ_URB_RUNNING	0
 #define TI_READ_URB_STOPPING	1
@@ -602,7 +600,6 @@ static int ti_port_probe(struct usb_serial_port *port)
 		tport->tp_uart_base_addr = TI_UART1_BASE_ADDR;
 	else
 		tport->tp_uart_base_addr = TI_UART2_BASE_ADDR;
-	port->port.closing_wait = msecs_to_jiffies(10 * TI_DEFAULT_CLOSING_WAIT);
 	tport->tp_port = port;
 	tport->tp_tdev = usb_get_serial_data(port->serial);
 
Signature · 1 line
2.26.3
maintainer Reviewed-by on the v1 series
#5 lore raw
In reply to Johan Hovold
Quoted 5 lines · Johan Hovold

Now that all USB serial drivers supports changing the closing_wait parameter through TIOCSSERIAL (setserial), we can remove the related driver-specific module parameters and settings.

These depend on the recently posted TIOCSSERIAL series.

Yes! Getting rid of the module parameter is so good...

author maintainer
#6 lore raw
Quoted 10 lines · Greg Kroah-Hartman
Quoted 5 lines · Johan Hovold

Now that all USB serial drivers supports changing the closing_wait parameter through TIOCSSERIAL (setserial), we can remove the related driver-specific module parameters and settings.

These depend on the recently posted TIOCSSERIAL series.

Yes! Getting rid of the module parameter is so good...

Thanks for reviewing these. All three sets now applied.

Johan