Re: [PATCH v6 5/6] rust: platform: add irq accessors

Danilo Krummrich
2025-07-04T18:17:30Z

On Fri, Jul 04, 2025 at 07:56:11AM +0000, Alice Ryhl wrote:
> On Thu, Jul 03, 2025 at 04:30:03PM -0300, Daniel Almeida wrote:
> > These accessors can be used to retrieve a irq::Registration and
> > irq::ThreadedRegistration from a platform device by
> > index or name. Alternatively, drivers can retrieve an IrqRequest from a
> > bound platform device for later use.
> >
> > These accessors ensure that only valid IRQ lines can ever be registered.
> >
> > Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
>
> One question below. With that answered:
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
>
> > + /// Returns an [`IrqRequest`] for the IRQ with the given name, if any.
> > + pub fn request_irq_by_name(&self, name: &'static CStr) -> Result<IrqRequest<'_>> {
>
> Does the name need to be static? That's surprising - isn't it just a
> lookup that needs to be valid during this call?

The string used to lookup the irq number is only used for comparison, and hence
doesn't need to have a static lifetime.