* [PATCH 0/6] USB: serial: drop short control-transfer checks
@ 2021-01-18 11:14 Johan Hovold
2021-01-18 11:14 ` [PATCH 1/6] USB: serial: mxuport: drop short control-transfer check Johan Hovold
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
There's no need to check for short control transfers when sending data
so remove the redundant sanity checks from the drivers that had them.
Included is also a related fix of a copy-paste error in a debug message.
Johan
Johan Hovold (6):
USB: serial: mxuport: drop short control-transfer check
USB: serial: upd78f0730: drop short control-transfer check
USB: serial: io_ti: drop short control-transfer check
USB: serial: io_ti: fix a debug-message copy-paste error
USB: serial: f81232: drop short control-transfer checks
USB: serial: f81534: drop short control-transfer check
drivers/usb/serial/f81232.c | 12 ++----------
drivers/usb/serial/f81534.c | 4 +---
drivers/usb/serial/io_ti.c | 8 ++------
drivers/usb/serial/mxuport.c | 7 -------
drivers/usb/serial/upd78f0730.c | 5 +----
5 files changed, 6 insertions(+), 30 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] USB: serial: mxuport: drop short control-transfer check
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
@ 2021-01-18 11:14 ` Johan Hovold
2021-01-18 11:14 ` [PATCH 2/6] USB: serial: upd78f0730: " Johan Hovold
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
There's no need to check for short control transfers when sending data
so remove the redundant sanity check.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/mxuport.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c
index 5d38c2a0f590..eb45a9b0005c 100644
--- a/drivers/usb/serial/mxuport.c
+++ b/drivers/usb/serial/mxuport.c
@@ -261,13 +261,6 @@ static int mxuport_send_ctrl_data_urb(struct usb_serial *serial,
return status;
}
- if (status != size) {
- dev_err(&serial->interface->dev,
- "%s - short write (%d / %zd)\n",
- __func__, status, size);
- return -EIO;
- }
-
return 0;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/6] USB: serial: upd78f0730: drop short control-transfer check
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
2021-01-18 11:14 ` [PATCH 1/6] USB: serial: mxuport: drop short control-transfer check Johan Hovold
@ 2021-01-18 11:14 ` Johan Hovold
2021-01-18 11:14 ` [PATCH 3/6] USB: serial: io_ti: " Johan Hovold
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
There's no need to check for short control transfers when sending data
so remove the redundant sanity check.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/upd78f0730.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/serial/upd78f0730.c b/drivers/usb/serial/upd78f0730.c
index 0a2268c479af..1ca9c1881621 100644
--- a/drivers/usb/serial/upd78f0730.c
+++ b/drivers/usb/serial/upd78f0730.c
@@ -145,14 +145,11 @@ static int upd78f0730_send_ctl(struct usb_serial_port *port,
kfree(buf);
- if (res != size) {
+ if (res < 0) {
struct device *dev = &port->dev;
dev_err(dev, "failed to send control request %02x: %d\n",
*(u8 *)data, res);
- /* The maximum expected length of a transfer is 6 bytes */
- if (res >= 0)
- res = -EIO;
return res;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] USB: serial: io_ti: drop short control-transfer check
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
2021-01-18 11:14 ` [PATCH 1/6] USB: serial: mxuport: drop short control-transfer check Johan Hovold
2021-01-18 11:14 ` [PATCH 2/6] USB: serial: upd78f0730: " Johan Hovold
@ 2021-01-18 11:14 ` Johan Hovold
2021-01-18 11:14 ` [PATCH 4/6] USB: serial: io_ti: fix a debug-message copy-paste error Johan Hovold
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
There's no need to check for short control transfers when sending data
so remove the redundant sanity check.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/io_ti.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index c327d4cf7928..0c4062698603 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -283,11 +283,7 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value,
value, index, data, size, timeout);
if (status < 0)
return status;
- if (status != size) {
- dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
- __func__, size, status);
- return -ECOMM;
- }
+
return 0;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] USB: serial: io_ti: fix a debug-message copy-paste error
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
` (2 preceding siblings ...)
2021-01-18 11:14 ` [PATCH 3/6] USB: serial: io_ti: " Johan Hovold
@ 2021-01-18 11:14 ` Johan Hovold
2021-01-18 11:14 ` [PATCH 5/6] USB: serial: f81232: drop short control-transfer checks Johan Hovold
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
Fix a copy-paste error in the ti_vread_sync() debug message.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/io_ti.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 0c4062698603..0bbfa47e04b7 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -266,7 +266,7 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request,
if (status < 0)
return status;
if (status != size) {
- dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n",
+ dev_dbg(&dev->dev, "%s - wanted to read %d, but only read %d\n",
__func__, size, status);
return -ECOMM;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] USB: serial: f81232: drop short control-transfer checks
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
` (3 preceding siblings ...)
2021-01-18 11:14 ` [PATCH 4/6] USB: serial: io_ti: fix a debug-message copy-paste error Johan Hovold
@ 2021-01-18 11:14 ` Johan Hovold
2021-01-18 11:14 ` [PATCH 6/6] USB: serial: f81534: drop short control-transfer check Johan Hovold
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
There's no need to check for short control transfers when sending data
so remove the redundant sanity checks.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/f81232.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 0c7eacc630e0..6a8f39147d8e 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -192,13 +192,9 @@ static int f81232_set_register(struct usb_serial_port *port, u16 reg, u8 val)
tmp,
sizeof(val),
USB_CTRL_SET_TIMEOUT);
- if (status != sizeof(val)) {
+ if (status < 0) {
dev_err(&port->dev, "%s failed status: %d\n", __func__, status);
-
- if (status < 0)
- status = usb_translate_errors(status);
- else
- status = -EIO;
+ status = usb_translate_errors(status);
} else {
status = 0;
}
@@ -886,10 +882,6 @@ static int f81534a_ctrl_set_register(struct usb_interface *intf, u16 reg,
status = usb_translate_errors(status);
if (status == -EIO)
continue;
- } else if (status != size) {
- /* Retry on short transfers */
- status = -EIO;
- continue;
} else {
status = 0;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] USB: serial: f81534: drop short control-transfer check
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
` (4 preceding siblings ...)
2021-01-18 11:14 ` [PATCH 5/6] USB: serial: f81232: drop short control-transfer checks Johan Hovold
@ 2021-01-18 11:14 ` Johan Hovold
2021-01-18 11:23 ` [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
2021-01-18 12:46 ` Greg Kroah-Hartman
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:14 UTC (permalink / raw)
To: linux-usb; +Cc: Greg Kroah-Hartman, Johan Hovold
There's no need to check for short control transfers when sending data
so remove the redundant sanity check.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/f81534.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c
index 5661fd03e545..dd7e55e822ef 100644
--- a/drivers/usb/serial/f81534.c
+++ b/drivers/usb/serial/f81534.c
@@ -235,11 +235,9 @@ static int f81534_set_register(struct usb_serial *serial, u16 reg, u8 data)
USB_TYPE_VENDOR | USB_DIR_OUT,
reg, 0, tmp, sizeof(u8),
F81534_USB_TIMEOUT);
- if (status > 0) {
+ if (status == sizeof(u8)) {
status = 0;
break;
- } else if (status == 0) {
- status = -EIO;
}
}
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] USB: serial: drop short control-transfer checks
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
` (5 preceding siblings ...)
2021-01-18 11:14 ` [PATCH 6/6] USB: serial: f81534: drop short control-transfer check Johan Hovold
@ 2021-01-18 11:23 ` Johan Hovold
2021-01-18 12:46 ` Greg Kroah-Hartman
7 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 11:23 UTC (permalink / raw)
To: Himadri Pandya; +Cc: Greg Kroah-Hartman, Johan Hovold, linux-usb
Hi Himadri,
On Mon, Jan 18, 2021 at 12:14:20PM +0100, Johan Hovold wrote:
> There's no need to check for short control transfers when sending data
> so remove the redundant sanity checks from the drivers that had them.
>
> Included is also a related fix of a copy-paste error in a debug message.
>
> Johan
>
>
> Johan Hovold (6):
> USB: serial: mxuport: drop short control-transfer check
> USB: serial: upd78f0730: drop short control-transfer check
> USB: serial: io_ti: drop short control-transfer check
> USB: serial: io_ti: fix a debug-message copy-paste error
> USB: serial: f81232: drop short control-transfer checks
> USB: serial: f81534: drop short control-transfer check
>
> drivers/usb/serial/f81232.c | 12 ++----------
> drivers/usb/serial/f81534.c | 4 +---
> drivers/usb/serial/io_ti.c | 8 ++------
> drivers/usb/serial/mxuport.c | 7 -------
> drivers/usb/serial/upd78f0730.c | 5 +----
> 5 files changed, 6 insertions(+), 30 deletions(-)
I intended to CC you on this series, but forgot to do so before hitting
send.
The series can be found here:
https://lore.kernel.org/r/20210118111426.5147-1-johan@kernel.org
I checked to make sure it doesn't interfere too much with your revised
series.
Johan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] USB: serial: drop short control-transfer checks
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
` (6 preceding siblings ...)
2021-01-18 11:23 ` [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
@ 2021-01-18 12:46 ` Greg Kroah-Hartman
2021-01-18 13:36 ` Johan Hovold
7 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2021-01-18 12:46 UTC (permalink / raw)
To: Johan Hovold; +Cc: linux-usb
On Mon, Jan 18, 2021 at 12:14:20PM +0100, Johan Hovold wrote:
> There's no need to check for short control transfers when sending data
> so remove the redundant sanity checks from the drivers that had them.
It seems impossible to do a "short write", so I wonder why we even check
it...
Anyway, nice cleanups:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] USB: serial: drop short control-transfer checks
2021-01-18 12:46 ` Greg Kroah-Hartman
@ 2021-01-18 13:36 ` Johan Hovold
0 siblings, 0 replies; 10+ messages in thread
From: Johan Hovold @ 2021-01-18 13:36 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Johan Hovold, linux-usb
On Mon, Jan 18, 2021 at 01:46:28PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Jan 18, 2021 at 12:14:20PM +0100, Johan Hovold wrote:
> > There's no need to check for short control transfers when sending data
> > so remove the redundant sanity checks from the drivers that had them.
>
> It seems impossible to do a "short write", so I wonder why we even check
> it...
Right, and this series removes precisely those redundant checks. Or what
did you mean? :)
> Anyway, nice cleanups:
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks for reviewing, now applied.
Johan
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-01-18 20:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-18 11:14 [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
2021-01-18 11:14 ` [PATCH 1/6] USB: serial: mxuport: drop short control-transfer check Johan Hovold
2021-01-18 11:14 ` [PATCH 2/6] USB: serial: upd78f0730: " Johan Hovold
2021-01-18 11:14 ` [PATCH 3/6] USB: serial: io_ti: " Johan Hovold
2021-01-18 11:14 ` [PATCH 4/6] USB: serial: io_ti: fix a debug-message copy-paste error Johan Hovold
2021-01-18 11:14 ` [PATCH 5/6] USB: serial: f81232: drop short control-transfer checks Johan Hovold
2021-01-18 11:14 ` [PATCH 6/6] USB: serial: f81534: drop short control-transfer check Johan Hovold
2021-01-18 11:23 ` [PATCH 0/6] USB: serial: drop short control-transfer checks Johan Hovold
2021-01-18 12:46 ` Greg Kroah-Hartman
2021-01-18 13:36 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).