Re: [PATCH v6 3/6] rust: irq: add support for non-threaded IRQs and handlers

Boqun Feng
2025-07-04T16:41:53Z

On Fri, Jul 04, 2025 at 09:39:01AM -0700, Boqun Feng wrote:
> On Thu, Jul 03, 2025 at 04:30:01PM -0300, Daniel Almeida wrote:
> [...]
> > +#[pin_data]
> > +pub struct Registration<T: Handler + 'static> {
> > + #[pin]
> > + inner: Devres<RegistrationInner>,
> > +
> > + #[pin]
> > + handler: T,
>
> IIRC, as a certain point, we want this to be a `UnsafePinned<T>`, is
> that requirement gone or we still need that but 1) `UnsafePinned` is not
> available and 2) we can rely on the whole struct being !Unpin for the
> address stability temporarily?
>
> I think it was not a problem until we switched to `try_pin_init!()`
> instead of `pin_init_from_closure()` because we then had to pass the
> address of `handler` instead of the whole struct.
>
> Since we certainly want to use `try_pin_init!()` and we certainly will
> have `UnsafePinned`, I think we should just keep this as it is for now,

Of course the assumption is we want to it in before `UnsafePinned` ;-)
Alternatively we can do what `Devres` did:

https://lore.kernel.org/rust-for-linux/20250626200054.243480-4-dakr@kernel.org/

using an `Opaque` and manually drop for now.

Regards,
Boqun

> and add a TODO so that we can clean it up later when we have
> `UnsafePinned`?
>
> Thoughts?
>
> Regards,
> Boqun