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

From: Danilo Krummrich
Date: Fri Jul 04 2025 - 14:17:55 EST


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@xxxxxxxxxxxxx>
>
> One question below. With that answered:
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>
> > + /// 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.