[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <a07922bd-4550-41d8-a7cd-8943baf6f8fb@siemens.com>
Date: Sun, 1 Sep 2024 23:11:29 +0200
From: Jan Kiszka <jan.kiszka@...mens.com>
To: Johan Hovold <johan@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] USB: serial: pl2303: account for deficits of clones
From: Jan Kiszka <jan.kiszka@...mens.com>
There are apparently incomplete clones of the HXD type chip in use.
Those return -EPIPE on GET_LINE_REQUEST and BREAK_REQUEST. Avoid
flooding the kernel log with those errors. Rather use the
line_settings cache for GET_LINE_REQUEST and signal missing support by
returning -ENOTTY from pl2303_set_break.
Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>
---
drivers/usb/serial/pl2303.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index d93f5d584557..04cafa819390 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -731,12 +731,13 @@ static int pl2303_get_line_request(struct usb_serial_port *port,
GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
0, 0, buf, 7, 100);
if (ret != 7) {
- dev_err(&port->dev, "%s - failed: %d\n", __func__, ret);
+ struct pl2303_private *priv = usb_get_serial_port_data(port);
- if (ret >= 0)
- ret = -EIO;
+ dev_dbg(&port->dev, "%s - failed, falling back on cache: %d\n",
+ __func__, ret);
+ memcpy(buf, priv->line_settings, 7);
- return ret;
+ return 0;
}
dev_dbg(&port->dev, "%s - %7ph\n", __func__, buf);
@@ -1078,8 +1079,8 @@ static int pl2303_set_break(struct usb_serial_port *port, bool enable)
BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
0, NULL, 0, 100);
if (result) {
- dev_err(&port->dev, "error sending break = %d\n", result);
- return result;
+ dev_dbg(&port->dev, "error sending break = %d\n", result);
+ return -ENOTTY;
}
return 0;
--
2.43.0
Powered by blists - more mailing lists