Re: [PATCH v8 3/5] rust: add basic serial device bus abstractions

From: Markus Probst

Date: Sat May 30 2026 - 10:28:40 EST


On Sat, 2026-05-30 at 16:08 +0200, Danilo Krummrich wrote:
> On Sat May 30, 2026 at 4:00 PM CEST, Markus Probst wrote:
> > On Sat, 2026-05-30 at 15:53 +0200, Markus Probst wrote:
> > > On Sat, 2026-05-30 at 15:37 +0200, Markus Probst wrote:
> > > > If I think about it, I can't even close it inside remove_callback after
> > > > `T::unbind`. With the driver lifetimes, the driver could store the
> > > > `serdev::Device<Bound>` pointer in its DriverData and could still make
> > > > calls to the device.
> > > >
> > > > Any suggestions?
>
> Now that there is no public drvdata() accessor anymore, all bus device private
> data accesses go through the bus abstraction.
>
> So, you could go back to your original approach and wrap the state in a bus
> specific bus device private data wrapper type, which would also get you rid of
> the rust_private_data pointer you add to struct serdev_device.
This would work, but I don't see how it would get rid of
rust_private_data in this way. The device private data will
automatically be dropped after the remove_callback, but the private bus
abstraction data needs to outlive the devres callbacks (which is done
by rust_private_data).

Thanks
- Markus Probst

Attachment: signature.asc
Description: This is a digitally signed message part