Re: [PATCH v2 1/2] rust: introduce abstractions for fwctlg

Jason Gunthorpe
2026-01-28T17:39:30Z

On Wed, Jan 28, 2026 at 07:30:11PM +0200, Zhi Wang wrote:
> On Wed, 28 Jan 2026 17:35:04 +0100
> "Danilo Krummrich" <dakr@kernel.org> wrote:
>
> > On Wed Jan 28, 2026 at 4:56 PM CET, Jason Gunthorpe wrote:
> > > On Wed, Jan 28, 2026 at 04:49:07PM +0100, Danilo Krummrich wrote:
>
> snip
>
> > > Or is it needed to add the typestate?
> >
> > This is something we should consider when a fwctl::Device would have
> > different states it can be in, where calling certain methods of a
> > fwctl::Device is only valid for a certain state and would cause
> > undefined behavior if called from the wrong state.
>
> Are you saying we should define typestate like Device<Bound/Core> also for
> fwctl device? I haven't thought about this and some design consideration
> would be helpful, as the rust PCI subsystem has it, while some of other
> abstractions don't have it. I could start to picture about this if this
> is necessary.

I think it is not necessary right now

Jason