From: Greg KH <gregkh@linuxfoundation.org>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Johan Hovold <johan@kernel.org>,
Corentin Labbe <clabbe@baylibre.com>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
david@ixit.cz
Subject: Re: [PATCH v8 1/2] usb: serial: add support for CH348
Date: Wed, 16 Jul 2025 09:44:27 +0200 [thread overview]
Message-ID: <2025071631-thesaurus-blissful-58f3@gregkh> (raw)
In-Reply-To: <CAFBinCAUNNfOp4qvn2p8AETossePv2aL7jBkFxVZV_XzzULgVg@mail.gmail.com>
On Tue, Jul 15, 2025 at 11:20:33PM +0200, Martin Blumenstingl wrote:
> Hi Johan,
>
> I'm excluding comments that are clear to me in this reply.
>
> On Mon, May 12, 2025 at 12:03 PM Johan Hovold <johan@kernel.org> wrote:
> [...]
> > > + if (ret) {
> > > + dev_err(&port->serial->dev->dev,
> > > + "Failed to configure UART_MCR, err=%d\n", ret);
> > > + return ret;
> > > + }
> >
> > The read urbs should be submitted at first open and stopped at last
> > close to avoid wasting resources when no one is using the device.
> >
> > I know we have a few drivers that do not do this currently, but it
> > shouldn't be that hard to get this right from the start.
> If you're aware of an easy approach or you can recommend an existing
> driver that implements the desired behavior then please let me know.
>
> The speciality about ch348 is that all ports share the RX/TX URBs.
> My current idea is to implement this using a ref count (for the number
> of open ports) and mutex for locking.
How do you know if a port is "open" or not and keep track of them all?
Trying to manage that is a pain and a refcount shouldn't need locking if
you use the proper refcount_t type in a sane way.
Try to keep it simple please.
> > With this implementation writing data continuously to one port will
> > starve the others.
> >
> > The vendor implementation appears to write to more than one port in
> > parallel and track THRE per port which would avoid the starvation issue
> > and should also be much more efficient.
> >
> > Just track THRE per port and only submit the write urb when it the
> > transmitter is empty or when it becomes empty.
> I'm trying as you suggest:
> - submit the URB synchronously for port N
> - submit the URB synchronously for port N + 1
> - ...
>
> This seems to work (using usb_bulk_msg). What doesn't work is
> submitting URBs in parallel (this is what the vendor driver prevents
> as well).
Why would submitting urbs in parallel not work? Is the device somehow
broken and can't accept multiple requests at the same time?
thanks,
greg k-h
next prev parent reply other threads:[~2025-07-16 7:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 13:58 [PATCH v8 0/2] usb: serial: add support for CH348 Corentin Labbe
2025-02-04 13:58 ` [PATCH v8 1/2] " Corentin Labbe
2025-03-20 12:56 ` David Heidelberg
2025-05-12 10:03 ` Johan Hovold
2025-07-15 21:20 ` Martin Blumenstingl
2025-07-16 7:44 ` Greg KH [this message]
2025-07-16 8:28 ` Martin Blumenstingl
2025-07-16 8:57 ` Greg KH
2025-07-16 9:31 ` Martin Blumenstingl
2025-07-16 10:00 ` Greg KH
2025-07-16 11:24 ` Martin Blumenstingl
2025-07-25 10:14 ` Johan Hovold
2025-07-25 10:07 ` Johan Hovold
2025-07-26 14:54 ` Martin Blumenstingl
2025-07-29 9:43 ` Johan Hovold
2025-07-29 20:45 ` Martin Blumenstingl
2025-08-04 12:32 ` Johan Hovold
2025-08-04 21:35 ` Martin Blumenstingl
2025-08-27 10:07 ` Johan Hovold
2025-11-29 15:59 ` Martin Blumenstingl
2025-12-01 14:10 ` Johan Hovold
2025-12-15 2:10 ` Martin Blumenstingl
2026-01-13 15:31 ` Johan Hovold
2026-04-22 12:55 ` David Heidelberg
2025-02-04 13:58 ` [PATCH v8 2/2] usb: serial: add Martin and myself as maintainers of CH348 Corentin Labbe
2025-03-30 1:24 ` [PATCH v8 1/2] usb: serial: add support for CH348 Nicolas Frattaroli
2025-03-30 22:11 ` David Heidelberg
[not found] ` <CA+j61XMwrtRJhGiJu_T5tt3g14fseOqvOJZLbb2bQGduSJsmxQ@mail.gmail.com>
2025-05-04 21:26 ` [PATCH v8 0/2] " Martin Blumenstingl
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=2025071631-thesaurus-blissful-58f3@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=clabbe@baylibre.com \
--cc=david@ixit.cz \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.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