Re: [PATCH v11 1/3] rust: add basic serial device bus abstractions

From: Danilo Krummrich

Date: Sun May 31 2026 - 17:49:19 EST


On Sun May 31, 2026 at 9:42 PM CEST, Markus Probst wrote:
> I just noticed, is it even possible to use SRCU here? Currently the mutex not
> only ensures that no drvdata access happens after drvdata drop, but also that
> the receive_buf waits for the probe to complete, as the drvdata hasn't been
> initialized yet.

Yeah, if you drop the completion, you need the mutex.

(In case it wasn't discussed in previous versions already, there is also the
option to just attach separate private data to the receive callback, which would
avoid this synchonization problem in the first place.

You could have serdev::Device<Core>::open(), which takes its own private data
and a corresponding close(), this way you'd allow drivers to control whether
they want the serial line "open" or not. You just need to make sure it is closed
eventually.)

That said, I don't know what turns out to be the better approach. And maybe it
simply isn't something this initial series has to tackle? I think your driver
does not implement the receive callback?