From: Johan Hovold <johan@kernel.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-usb <linux-usb@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Michał Pecio" <michal.pecio@gmail.com>
Subject: Re: [PATCH v3] USB: serial: pl2303: account for deficits of clones
Date: Wed, 6 Nov 2024 17:28:31 +0100 [thread overview]
Message-ID: <ZyuZL7CGLqe3J_ck@hovoldconsulting.com> (raw)
In-Reply-To: <b555ae8e-67a1-4dd3-804c-6db5a82b0625@siemens.com>
On Thu, Sep 12, 2024 at 10:37:39AM +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.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. Detect them during startup
> and then use the line_settings cache instead of GET_LINE_REQUEST. Signal
> missing break support via -ENOTTY.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Changes in v3:
> - use quirks field instead of new type (suggested by Michal)
> #define PL2303_QUIRK_UART_STATE_IDX0 BIT(0)
> #define PL2303_QUIRK_LEGACY BIT(1)
> #define PL2303_QUIRK_ENDPOINT_HACK BIT(2)
> +#define PL2304_QUIRK_NO_BREAK_GETLINE BIT(3)
I believe you meant to use a "PL2303" prefix here as well.
> +static bool pl2303_is_hxd_clone(struct usb_serial *serial)
> +{
> + struct usb_device *udev = serial->dev;
> + unsigned char *buf;
> + int ret;
> +
> + buf = kmalloc(7, GFP_KERNEL);
> + if (!buf) {
> + dev_err(&serial->interface->dev,
> + "could not check for clone type, not enough memory\n");
And there's no need to log out-of-memory errors (e.g. which would
already have been logged by allocator).
> + return false;
> + }
> +
> + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> + GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE,
> + 0, 0, buf, 7, 100);
> +
> + kfree(buf);
> +
> + return ret == -EPIPE;
> +}
I fixed up the above when applying. Looks nice and clean otherwise.
Thanks.
Johan
prev parent reply other threads:[~2024-11-06 16:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 8:37 Jan Kiszka
2024-11-06 16:28 ` Johan Hovold [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyuZL7CGLqe3J_ck@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michal.pecio@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®