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

Kiryl Shutsemau kirill at shutemov.name
Tue Jun 30 03:57:04 PDT 2026


On Tue, Jun 30, 2026 at 03:47:11AM -0700, Usama Arif wrote:
> On Mon, 29 Jun 2026 16:07:15 +0100 Kiryl Shutsemau <kirill at shutemov.name> wrote:
> 
> > From: "Kiryl Shutsemau (Meta)" <kas at kernel.org>
> > 
> > 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) <kas at kernel.org>
> > Reviewed-by: Douglas Anderson <dianders at chromium.org>
> > ---
> 
> 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



More information about the linux-arm-kernel mailing list