mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m
@ 2025-05-22 14:38 Arnd Bergmann
  2025-05-23  4:12 ` Suma Hegde
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2025-05-22 14:38 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi, Hans de Goede, Ilpo Järvinen, Suma Hegde
  Cc: Arnd Bergmann, Carlos Bilbao, Yazen Ghannam,
	Borislav Petkov (AMD),
	platform-driver-x86, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When CONFIG_HWMON is built as a loadable module, the HSMP drivers
cannot be built-in:

ERROR: modpost: "hsmp_create_sensor" [drivers/platform/x86/amd/hsmp/amd_hsmp.ko] undefined!
ERROR: modpost: "hsmp_create_sensor" [drivers/platform/x86/amd/hsmp/hsmp_acpi.ko] undefined!

Enforce that through the usual Kconfig dependnecy trick.

Fixes: 92c025db52bb ("platform/x86/amd/hsmp: Report power via hwmon sensors")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/platform/x86/amd/hsmp/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/x86/amd/hsmp/Kconfig b/drivers/platform/x86/amd/hsmp/Kconfig
index d6f7a62d55b5..2911120792e8 100644
--- a/drivers/platform/x86/amd/hsmp/Kconfig
+++ b/drivers/platform/x86/amd/hsmp/Kconfig
@@ -12,6 +12,7 @@ menu "AMD HSMP Driver"
 config AMD_HSMP_ACPI
 	tristate "AMD HSMP ACPI device driver"
 	depends on ACPI
+	depends on HWMON || !HWMON
 	select AMD_HSMP
 	help
 	  Host System Management Port (HSMP) interface is a mailbox interface
@@ -29,6 +30,7 @@ config AMD_HSMP_ACPI
 
 config AMD_HSMP_PLAT
 	tristate "AMD HSMP platform device driver"
+	depends on HWMON || !HWMON
 	select AMD_HSMP
 	help
 	  Host System Management Port (HSMP) interface is a mailbox interface
-- 
2.39.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m
  2025-05-22 14:38 [PATCH] platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m Arnd Bergmann
@ 2025-05-23  4:12 ` Suma Hegde
  2025-05-25 20:59   ` Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: Suma Hegde @ 2025-05-23  4:12 UTC (permalink / raw)
  To: Arnd Bergmann, Naveen Krishna Chatradhi, Hans de Goede,
	Ilpo Järvinen
  Cc: Arnd Bergmann, Carlos Bilbao, Yazen Ghannam,
	Borislav Petkov (AMD),
	platform-driver-x86, linux-kernel

Hi Arnd,


On 5/22/2025 8:08 PM, Arnd Bergmann wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> When CONFIG_HWMON is built as a loadable module, the HSMP drivers
> cannot be built-in:
>
> ERROR: modpost: "hsmp_create_sensor" [drivers/platform/x86/amd/hsmp/amd_hsmp.ko] undefined!
> ERROR: modpost: "hsmp_create_sensor" [drivers/platform/x86/amd/hsmp/hsmp_acpi.ko] undefined!
>
> Enforce that through the usual Kconfig dependnecy trick.
>
> Fixes: 92c025db52bb ("platform/x86/amd/hsmp: Report power via hwmon sensors")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/platform/x86/amd/hsmp/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/platform/x86/amd/hsmp/Kconfig b/drivers/platform/x86/amd/hsmp/Kconfig
> index d6f7a62d55b5..2911120792e8 100644
> --- a/drivers/platform/x86/amd/hsmp/Kconfig
> +++ b/drivers/platform/x86/amd/hsmp/Kconfig
> @@ -12,6 +12,7 @@ menu "AMD HSMP Driver"
>   config AMD_HSMP_ACPI
>          tristate "AMD HSMP ACPI device driver"
>          depends on ACPI
> +       depends on HWMON || !HWMON


Thanks for sending this fix.  I verified it.

Along with this  fix, I will change IS_REACHABLE() to IS_ENABLED() in 
hsmp.h as its not necessary and send v2 of this patch.

-#if IS_REACHABLE(CONFIG_HWMON)
+#if IS_ENABLED(CONFIG_HWMON)
  int hsmp_create_sensor(struct device *dev, u16 sock_ind);
  #else
static inline int hsmp_create_sensor(struct device *dev, u16 sock_ind) { 
return 0; }
#endif

>          select AMD_HSMP
>          help
>            Host System Management Port (HSMP) interface is a mailbox interface
> @@ -29,6 +30,7 @@ config AMD_HSMP_ACPI
>
>   config AMD_HSMP_PLAT
>          tristate "AMD HSMP platform device driver"
> +       depends on HWMON || !HWMON
>          select AMD_HSMP
>          help
>            Host System Management Port (HSMP) interface is a mailbox interface
> --
> 2.39.5


Thanks and Regards,

Suma


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m
  2025-05-23  4:12 ` Suma Hegde
@ 2025-05-25 20:59   ` Ilpo Järvinen
  0 siblings, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2025-05-25 20:59 UTC (permalink / raw)
  To: Suma Hegde, Arnd Bergmann
  Cc: Naveen Krishna Chatradhi, Hans de Goede, Arnd Bergmann,
	Carlos Bilbao, Yazen Ghannam, Borislav Petkov (AMD),
	platform-driver-x86, LKML

[-- Attachment #1: Type: text/plain, Size: 2403 bytes --]

On Fri, 23 May 2025, Suma Hegde wrote:

> Hi Arnd,
> 
> 
> On 5/22/2025 8:08 PM, Arnd Bergmann wrote:
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> > 
> > 
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > When CONFIG_HWMON is built as a loadable module, the HSMP drivers
> > cannot be built-in:
> > 
> > ERROR: modpost: "hsmp_create_sensor"
> > [drivers/platform/x86/amd/hsmp/amd_hsmp.ko] undefined!
> > ERROR: modpost: "hsmp_create_sensor"
> > [drivers/platform/x86/amd/hsmp/hsmp_acpi.ko] undefined!
> > 
> > Enforce that through the usual Kconfig dependnecy trick.
> > 
> > Fixes: 92c025db52bb ("platform/x86/amd/hsmp: Report power via hwmon
> > sensors")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >   drivers/platform/x86/amd/hsmp/Kconfig | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/platform/x86/amd/hsmp/Kconfig
> > b/drivers/platform/x86/amd/hsmp/Kconfig
> > index d6f7a62d55b5..2911120792e8 100644
> > --- a/drivers/platform/x86/amd/hsmp/Kconfig
> > +++ b/drivers/platform/x86/amd/hsmp/Kconfig
> > @@ -12,6 +12,7 @@ menu "AMD HSMP Driver"
> >   config AMD_HSMP_ACPI
> >          tristate "AMD HSMP ACPI device driver"
> >          depends on ACPI
> > +       depends on HWMON || !HWMON
> 
> 
> Thanks for sending this fix.  I verified it.
> 
> Along with this  fix, I will change IS_REACHABLE() to IS_ENABLED() in hsmp.h
> as its not necessary and send v2 of this patch.
> 
> -#if IS_REACHABLE(CONFIG_HWMON)
> +#if IS_ENABLED(CONFIG_HWMON)
>  int hsmp_create_sensor(struct device *dev, u16 sock_ind);
>  #else
> static inline int hsmp_create_sensor(struct device *dev, u16 sock_ind) {
> return 0; }
> #endif
> 
> >          select AMD_HSMP
> >          help
> >            Host System Management Port (HSMP) interface is a mailbox
> > interface
> > @@ -29,6 +30,7 @@ config AMD_HSMP_ACPI
> > 
> >   config AMD_HSMP_PLAT
> >          tristate "AMD HSMP platform device driver"
> > +       depends on HWMON || !HWMON
> >          select AMD_HSMP
> >          help
> >            Host System Management Port (HSMP) interface is a mailbox
> > interface

Hi,

I've taken Arnd's patch now as the merge window is pressing in and this 
issue is disturbing build testing.

-- 
 i.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-25 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-22 14:38 [PATCH] platform/x86/amd/hsmp: fix building with CONFIG_HWMON=m Arnd Bergmann
2025-05-23  4:12 ` Suma Hegde
2025-05-25 20:59   ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®