Re: [PATCH 0/3] USB-Serial serdev support

Johan Hovold
2025-10-24T08:21:19Z

On Thu, Oct 23, 2025 at 03:48:28PM +0200, Marco Felsch wrote:
> On 25-10-23, Johan Hovold wrote:
> > On Thu, Mar 13, 2025 at 08:40:44PM +0100, Marco Felsch wrote:
> > > On 25-03-11, Johan Hovold wrote:
> > > > On Tue, Sep 17, 2024 at 06:49:48AM +0200, Marco Felsch wrote:
> > > > > On 24-09-09, Johan Hovold wrote:

> > > > > > First, as the commit message you refer to below explain, we need some
> > > > > > way to describe multiport controllers. Just dropping the 'serial' node
> > > > > > does not make that issue go away.

> > There are other USB serial devices that support multiple ports over a
> > single USB interface. The DT bindings need to account for that case as
> > well, and that probably means we should not be describing the interfaces
> > at all but rather the physical ports.
>
> Ah okay, I wasn't even aware that this possible too. However this is DT
> description and another topic.

It's still one of the issues that need to addressed.

> > > > > > Second, and more importantly, you do not address the main obstacle for
> > > > > > enabling serdev for USB serial which is that the serdev cannot handle
> > > > > > hotplugging.

> > You will also see the following kind of warnings in the logs:
> >
> > ttyUSB ttyUSB0: tty_hangup: tty->count(1) != (#fd's(0) + #kopen's(0))
> > ttyUSB ttyUSB0: tty_port_close_start: tty->count = 1 port count = 0
> >
> > which are due to the fact that serdev does not support hangups which are
> > used during teardown of USB serial ports.
>
> IIRC I added the following patch to solve this:
>
> - [PATCH 1/3] serdev: ttyport: make use of tty_kopen_exclusive
>
> Sorry for not remembering the details since this conversation/patchset
> is quite old but still one of our top prios.

That suppresses the first warning but doesn't address the underlying
issue (that hangups are built around file handles which serdev does not
use). And you will still see the second one when the serdev driver tries
to close the already hung up port during deregistration.

Also, that commit message needs to more work since you don't really
motivate why you think it's needed (e.g. as serdev ports can't be shared
with user space).

If it's just about suppressing the warning you could possibly just have
set that new flag.

Johan