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

Danilo Krummrich
2026-01-27T20:09:53Z

On Tue Jan 27, 2026 at 8:57 PM CET, Zhi Wang wrote:
> On Mon, 26 Jan 2026 14:19:12 -0400
> Jason Gunthorpe <jgg@nvidia.com> wrote:
>> fwctl_unregister is not safe from any context, it must be called
>> while the Device is still bound.
>>
>
> The registration is wrapped in Devres<> in the sample driver, which
> guarantees that drop is called while the Device is still bound.
>
> I agree that the current abstraction itself does not strictly enforce this
> (e.g., if the object is moved out of Devres). I will investigate an
> approach to enforce this requirement in the next re-spin.

The code is fine, the Registration object can't be moved out of devres safely.
You just need to update the safety comment accordingly. :)