mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/wmi: Allow consumers to load without ACPI
@ 2026-11-10 13:43 Han Gao
  2026-11-10 13:57 ` Armin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Han Gao @ 2026-11-10 13:43 UTC (permalink / raw)
  To: Armin Wolf, Ilpo Järvinen, Patrik Jakobsson
  Cc: Rafael J. Wysocki, linux-acpi, linux-riscv, Han Gao,
	platform-driver-x86, linux-kernel, Han Gao

Since commit 4ea18e604272 ("ACPI: video: Remove CONFIG_X86 handling from
nvidia_wmi_ec_supported()"), the ACPI video module uses WMI on all
architectures. When ACPI is disabled, e.g. on a devicetree boot,
acpi_wmi_init() returns -ENODEV, so the wmi module fails to load and so
do video, amdgpu and radeon, which depend on it.

Return 0 without registering the WMI bus instead. The exported helpers
then report that no WMI device exists. Skip the teardown on module exit
accordingly.

Fixes: 4ea18e604272 ("ACPI: video: Remove CONFIG_X86 handling from nvidia_wmi_ec_supported()")
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
---
Tested on a HiFive Premier P550 booted with devicetree and an RX550,
with ACPI_WMI, ACPI_VIDEO and DRM_AMDGPU built as modules. Without
this patch, wmi fails to load and so do video and amdgpu. With it,
wmi, video and amdgpu load and the RX550 is initialized.
---
 drivers/platform/wmi/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/wmi/core.c b/drivers/platform/wmi/core.c
index a99da9b7039d787ce3c1e0ece74ffbd79fafd3f7..6668789904a903c8d4e7810976f4e485d7a1b32a 100644
--- a/drivers/platform/wmi/core.c
+++ b/drivers/platform/wmi/core.c
@@ -1598,8 +1598,9 @@ static int __init acpi_wmi_init(void)
 {
 	int error;
 
+	/* ACPI video still needs the exported helpers when ACPI is disabled. */
 	if (acpi_disabled)
-		return -ENODEV;
+		return 0;
 
 	error = class_register(&wmi_bus_class);
 	if (error)
@@ -1628,6 +1629,9 @@ static int __init acpi_wmi_init(void)
 
 static void __exit acpi_wmi_exit(void)
 {
+	if (acpi_disabled)
+		return;
+
 	platform_driver_unregister(&acpi_wmi_driver);
 	bus_unregister(&wmi_bus_type);
 	class_unregister(&wmi_bus_class);

---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261110-wmi-no-acpi-159a4cf19580

Best regards,
-- 
Han Gao <gaohan@iscas.ac.cn>


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

* Re: [PATCH] platform/wmi: Allow consumers to load without ACPI
  2026-11-10 13:43 [PATCH] platform/wmi: Allow consumers to load without ACPI Han Gao
@ 2026-11-10 13:57 ` Armin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Armin Wolf @ 2026-11-10 13:57 UTC (permalink / raw)
  To: Han Gao, Ilpo Järvinen, Patrik Jakobsson
  Cc: Rafael J. Wysocki, linux-acpi, linux-riscv, Han Gao,
	platform-driver-x86, linux-kernel

Am 10.11.26 um 14:43 schrieb Han Gao:
> Since commit 4ea18e604272 ("ACPI: video: Remove CONFIG_X86 handling from
> nvidia_wmi_ec_supported()"), the ACPI video module uses WMI on all
> architectures. When ACPI is disabled, e.g. on a devicetree boot,
> acpi_wmi_init() returns -ENODEV, so the wmi module fails to load and so
> do video, amdgpu and radeon, which depend on it.
> 
> Return 0 without registering the WMI bus instead. The exported helpers
> then report that no WMI device exists. Skip the teardown on module exit
> accordingly.

AFAIK wmi_find_device_by_guid() requires that the WMI bus type is 
initialized, so we should not skip bus_register(). I wonder whether we 
really need to check acpi_disabled after all, because the platform 
driver will not bind anyway if ACPI support is disabled.

Thanks,
Armin Wolf

> Fixes: 4ea18e604272 ("ACPI: video: Remove CONFIG_X86 handling from nvidia_wmi_ec_supported()")
> Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
> ---
> Tested on a HiFive Premier P550 booted with devicetree and an RX550,
> with ACPI_WMI, ACPI_VIDEO and DRM_AMDGPU built as modules. Without
> this patch, wmi fails to load and so do video and amdgpu. With it,
> wmi, video and amdgpu load and the RX550 is initialized.
> ---
>   drivers/platform/wmi/core.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/wmi/core.c b/drivers/platform/wmi/core.c
> index a99da9b7039d787ce3c1e0ece74ffbd79fafd3f7..6668789904a903c8d4e7810976f4e485d7a1b32a 100644
> --- a/drivers/platform/wmi/core.c
> +++ b/drivers/platform/wmi/core.c
> @@ -1598,8 +1598,9 @@ static int __init acpi_wmi_init(void)
>   {
>   	int error;
>   
> +	/* ACPI video still needs the exported helpers when ACPI is disabled. */
>   	if (acpi_disabled)
> -		return -ENODEV;
> +		return 0;
>   
>   	error = class_register(&wmi_bus_class);
>   	if (error)
> @@ -1628,6 +1629,9 @@ static int __init acpi_wmi_init(void)
>   
>   static void __exit acpi_wmi_exit(void)
>   {
> +	if (acpi_disabled)
> +		return;
> +
>   	platform_driver_unregister(&acpi_wmi_driver);
>   	bus_unregister(&wmi_bus_type);
>   	class_unregister(&wmi_bus_class);
> 
> ---
> base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
> change-id: 20261110-wmi-no-acpi-159a4cf19580
> 
> Best regards,


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

end of thread, other threads:[~2026-11-10 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 13:43 [PATCH] platform/wmi: Allow consumers to load without ACPI Han Gao
2026-11-10 13:57 ` Armin Wolf

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®