Re: [PATCH v5 1/4] firmware: arm_sdei: add sdei_is_present()

Kiryl Shutsemau <[email protected]>
Newsgroups org.infradead.lists.kexec,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <akOgOWIsP9HBVxp-@thinkstation>
On Tue, Jun 30, 2026 at 03:47:11AM -0700, Usama Arif wrote:
> On Mon, 29 Jun 2026 16:07:15 +0100 Kiryl Shutsemau <[email protected]> wrote:
> 
> > From: "Kiryl Shutsemau (Meta)" <[email protected]>
> > 
> > invoke_sdei_fn() returns -EIO when no SDEI conduit was probed, and the
> > core warns ("Failed to create event ...") on any registration that hits
> > that. An optional consumer that registers an event from an unconditional
> > initcall would therefore make every boot on a non-SDEI system emit that
> > warning for what is simply absent firmware.
> > 
> > Expose whether SDEI firmware is present so such a consumer can skip
> > registration -- and the warning -- when there is nothing to talk to.
> > 
> > Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
> > Reviewed-by: Douglas Anderson <[email protected]>
> > ---
> 
> Can this be merged in patch 3 where this function is actually used?

I can do it either way. Standalone commit looks good to me.

But if maintainer wants, I can fold it.

> >  drivers/firmware/arm_sdei.c | 10 ++++++++++
> >  include/linux/arm_sdei.h    |  3 +++
> >  2 files changed, 13 insertions(+)
> > 
> > diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> > index f39ed7ba3a38..c161cf263547 100644
> > --- a/drivers/firmware/arm_sdei.c
> > +++ b/drivers/firmware/arm_sdei.c
> > @@ -339,6 +339,16 @@ static void _ipi_unmask_cpu(void *ignored)
> >  	sdei_unmask_local_cpu();
> >  }
> >  
> > +/*
> > + * Was SDEI firmware probed and is it usable?  Lets optional consumers skip
> > + * registering an event -- and the warning a failed registration emits -- on
> > + * systems with no SDEI.
> > + */
> > +bool sdei_is_present(void)
> > +{
> > +	return sdei_firmware_call;
> 
> sdei_firmware_call is a function pointer. The above is correct, but
> can we make it sdei_firmware_call != NULL? I think that looks a lot better.

Again, I don't care much, but checkpatch doesn't like comparison to NULL.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.