[PATCH 1/3] ACPI: PRM: Add acpi_prm_handler_available()

Yazen Ghannam posted 3 patches 2 months ago
There is a newer version of this series
[PATCH 1/3] ACPI: PRM: Add acpi_prm_handler_available()
Posted by Yazen Ghannam 2 months ago
Add a helper function to check if a PRM handler/module is present.

This can be used during init time by code that depends on a particular
handler. If the handler is not present, then the code does not need to
be loaded.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
 drivers/acpi/prmt.c  | 6 ++++++
 include/linux/prmt.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index 6792d4385eee..7b8b5d2015ec 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -244,6 +244,12 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
 	return (struct prm_handler_info *) find_guid_info(guid, GET_HANDLER);
 }
 
+bool acpi_prm_handler_available(const guid_t *guid)
+{
+	return find_prm_handler(guid) && find_prm_module(guid);
+}
+EXPORT_SYMBOL_GPL(acpi_prm_handler_available);
+
 /* In-coming PRM commands */
 
 #define PRM_CMD_RUN_SERVICE		0
diff --git a/include/linux/prmt.h b/include/linux/prmt.h
index c53ab287e932..8cdc987de963 100644
--- a/include/linux/prmt.h
+++ b/include/linux/prmt.h
@@ -4,9 +4,11 @@
 
 #ifdef CONFIG_ACPI_PRMT
 void init_prmt(void);
+bool acpi_prm_handler_available(const guid_t *handler_guid);
 int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);
 #else
 static inline void init_prmt(void) { }
+static inline bool acpi_prm_handler_available(const guid_t *handler_guid) { return false; }
 static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
 {
 	return -EOPNOTSUPP;

-- 
2.51.0
Re: [PATCH 1/3] ACPI: PRM: Add acpi_prm_handler_available()
Posted by Borislav Petkov 1 month, 3 weeks ago
On Mon, Oct 06, 2025 at 03:10:25PM +0000, Yazen Ghannam wrote:
> Add a helper function to check if a PRM handler/module is present.
> 
> This can be used during init time by code that depends on a particular
> handler. If the handler is not present, then the code does not need to
> be loaded.
> 
> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> ---
>  drivers/acpi/prmt.c  | 6 ++++++
>  include/linux/prmt.h | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
> index 6792d4385eee..7b8b5d2015ec 100644
> --- a/drivers/acpi/prmt.c
> +++ b/drivers/acpi/prmt.c
> @@ -244,6 +244,12 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
>  	return (struct prm_handler_info *) find_guid_info(guid, GET_HANDLER);
>  }
>  
> +bool acpi_prm_handler_available(const guid_t *guid)
> +{
> +	return find_prm_handler(guid) && find_prm_module(guid);
> +}
> +EXPORT_SYMBOL_GPL(acpi_prm_handler_available);
> +
>  /* In-coming PRM commands */
>  
>  #define PRM_CMD_RUN_SERVICE		0
> diff --git a/include/linux/prmt.h b/include/linux/prmt.h
> index c53ab287e932..8cdc987de963 100644
> --- a/include/linux/prmt.h
> +++ b/include/linux/prmt.h
> @@ -4,9 +4,11 @@
>  
>  #ifdef CONFIG_ACPI_PRMT
>  void init_prmt(void);
> +bool acpi_prm_handler_available(const guid_t *handler_guid);
>  int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);
>  #else
>  static inline void init_prmt(void) { }
> +static inline bool acpi_prm_handler_available(const guid_t *handler_guid) { return false; }
>  static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
>  {
>  	return -EOPNOTSUPP;
> 
> -- 

Rafael?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH 1/3] ACPI: PRM: Add acpi_prm_handler_available()
Posted by Rafael J. Wysocki 1 month, 3 weeks ago
On Thu, Oct 16, 2025 at 6:02 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Mon, Oct 06, 2025 at 03:10:25PM +0000, Yazen Ghannam wrote:
> > Add a helper function to check if a PRM handler/module is present.
> >
> > This can be used during init time by code that depends on a particular
> > handler. If the handler is not present, then the code does not need to
> > be loaded.
> >
> > Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
> > ---
> >  drivers/acpi/prmt.c  | 6 ++++++
> >  include/linux/prmt.h | 2 ++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
> > index 6792d4385eee..7b8b5d2015ec 100644
> > --- a/drivers/acpi/prmt.c
> > +++ b/drivers/acpi/prmt.c
> > @@ -244,6 +244,12 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
> >       return (struct prm_handler_info *) find_guid_info(guid, GET_HANDLER);
> >  }
> >
> > +bool acpi_prm_handler_available(const guid_t *guid)
> > +{
> > +     return find_prm_handler(guid) && find_prm_module(guid);
> > +}
> > +EXPORT_SYMBOL_GPL(acpi_prm_handler_available);
> > +
> >  /* In-coming PRM commands */
> >
> >  #define PRM_CMD_RUN_SERVICE          0
> > diff --git a/include/linux/prmt.h b/include/linux/prmt.h
> > index c53ab287e932..8cdc987de963 100644
> > --- a/include/linux/prmt.h
> > +++ b/include/linux/prmt.h
> > @@ -4,9 +4,11 @@
> >
> >  #ifdef CONFIG_ACPI_PRMT
> >  void init_prmt(void);
> > +bool acpi_prm_handler_available(const guid_t *handler_guid);
> >  int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);
> >  #else
> >  static inline void init_prmt(void) { }
> > +static inline bool acpi_prm_handler_available(const guid_t *handler_guid) { return false; }
> >  static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
> >  {
> >       return -EOPNOTSUPP;
> >
> > --
>
> Rafael?

I've seen it.  Are you asking for anything in particular?
Re: [PATCH 1/3] ACPI: PRM: Add acpi_prm_handler_available()
Posted by Borislav Petkov 1 month, 3 weeks ago
On Thu, Oct 16, 2025 at 06:09:12PM +0200, Rafael J. Wysocki wrote:
> > Rafael?
> 
> I've seen it.  Are you asking for anything in particular?

LOL.

ACK/NAK?

If former, should I carry it through tip?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH 1/3] ACPI: PRM: Add acpi_prm_handler_available()
Posted by Rafael J. Wysocki 1 month, 3 weeks ago
On Thu, Oct 16, 2025 at 6:17 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Thu, Oct 16, 2025 at 06:09:12PM +0200, Rafael J. Wysocki wrote:
> > > Rafael?
> >
> > I've seen it.  Are you asking for anything in particular?
>
> LOL.
>
> ACK/NAK?
>
> If former, should I carry it through tip?

Please feel free to take it with

Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>