mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5] platform/x86: alienware-wmi-base: Transition to new WMI API
@ 2026-04-29 13:27 Kurt Borja
  2026-04-29 21:18 ` Armin Wolf
  2026-05-19 12:24 ` Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Kurt Borja @ 2026-04-29 13:27 UTC (permalink / raw)
  To: Ilpo Järvinen, Armin Wolf, Hans de Goede
  Cc: platform-driver-x86, Dell.Client.Kernel, linux-kernel, Kurt Borja

Transition to the new wmi_buffer based WMI API.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
v5:
  - Use wmidev_invoke_procedure in the !out_data case

v4: https://patch.msgid.link/20260428-aw-new-api-v4-1-d2c06241d7ad@gmail.com
  - Rebase to use the new wmidev_invoke_method() with size check

v3: https://patch.msgid.link/20260331-aw-new-api-v3-1-ef03b94529d8@gmail.com
  - Use __free() instead of manual cleanup.
  - Include <linux/types.h>

v2: https://patch.msgid.link/20260331-aw-new-api-v2-1-3b0d33bf8d22@gmail.com
  - Cast wmi_buffer data to __le32 and then use le32_to_cpu() before
    returning

v1: https://patch.msgid.link/20260330-aw-new-api-v1-1-95910bfa1b38@gmail.com
---
 drivers/platform/x86/dell/alienware-wmi-base.c | 31 +++++++++++++++-----------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c
index 64562b92314f..19cadf21203a 100644
--- a/drivers/platform/x86/dell/alienware-wmi-base.c
+++ b/drivers/platform/x86/dell/alienware-wmi-base.c
@@ -12,8 +12,13 @@
 #include <linux/cleanup.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/types.h>
 #include <linux/dmi.h>
 #include <linux/leds.h>
+
+#include <asm/byteorder.h>
+
 #include "alienware-wmi.h"
 
 MODULE_AUTHOR("Mario Limonciello <mario.limonciello@outlook.com>");
@@ -150,22 +155,22 @@ u8 alienware_interface;
 int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
 			  void *in_args, size_t in_size, u32 *out_data)
 {
-	struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
-	struct acpi_buffer in = {in_size, in_args};
-	acpi_status ret;
+	struct wmi_buffer out, in = {
+		.data = in_args,
+		.length = in_size,
+	};
+	int ret;
 
-	ret = wmidev_evaluate_method(wdev, 0, method_id, &in, out_data ? &out : NULL);
-	if (ACPI_FAILURE(ret))
-		return -EIO;
+	if (!out_data)
+		return wmidev_invoke_procedure(wdev, 0, method_id, &in);
 
-	union acpi_object *obj __free(kfree) = out.pointer;
+	ret = wmidev_invoke_method(wdev, 0, method_id, &in, &out,
+				   sizeof(*out_data));
+	if (ret)
+		return ret;
 
-	if (out_data) {
-		if (obj && obj->type == ACPI_TYPE_INTEGER)
-			*out_data = (u32)obj->integer.value;
-		else
-			return -ENOMSG;
-	}
+	__le32 *data __free(kfree) = out.data;
+	*out_data = le32_to_cpu(*data);
 
 	return 0;
 }

---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260123-aw-new-api-1c18f1011f35

-- 
Thanks, 
 ~ Kurt


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

* Re: [PATCH v5] platform/x86: alienware-wmi-base: Transition to new WMI API
  2026-04-29 13:27 [PATCH v5] platform/x86: alienware-wmi-base: Transition to new WMI API Kurt Borja
@ 2026-04-29 21:18 ` Armin Wolf
  2026-05-19 12:24 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Armin Wolf @ 2026-04-29 21:18 UTC (permalink / raw)
  To: Kurt Borja, Ilpo Järvinen, Hans de Goede
  Cc: platform-driver-x86, Dell.Client.Kernel, linux-kernel

Am 29.04.26 um 15:27 schrieb Kurt Borja:

> Transition to the new wmi_buffer based WMI API.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
> v5:
>    - Use wmidev_invoke_procedure in the !out_data case
>
> v4: https://patch.msgid.link/20260428-aw-new-api-v4-1-d2c06241d7ad@gmail.com
>    - Rebase to use the new wmidev_invoke_method() with size check
>
> v3: https://patch.msgid.link/20260331-aw-new-api-v3-1-ef03b94529d8@gmail.com
>    - Use __free() instead of manual cleanup.
>    - Include <linux/types.h>
>
> v2: https://patch.msgid.link/20260331-aw-new-api-v2-1-3b0d33bf8d22@gmail.com
>    - Cast wmi_buffer data to __le32 and then use le32_to_cpu() before
>      returning
>
> v1: https://patch.msgid.link/20260330-aw-new-api-v1-1-95910bfa1b38@gmail.com
> ---
>   drivers/platform/x86/dell/alienware-wmi-base.c | 31 +++++++++++++++-----------
>   1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c
> index 64562b92314f..19cadf21203a 100644
> --- a/drivers/platform/x86/dell/alienware-wmi-base.c
> +++ b/drivers/platform/x86/dell/alienware-wmi-base.c
> @@ -12,8 +12,13 @@
>   #include <linux/cleanup.h>
>   #include <linux/module.h>
>   #include <linux/platform_device.h>
> +#include <linux/slab.h>
> +#include <linux/types.h>
>   #include <linux/dmi.h>
>   #include <linux/leds.h>
> +
> +#include <asm/byteorder.h>
> +
>   #include "alienware-wmi.h"
>   
>   MODULE_AUTHOR("Mario Limonciello <mario.limonciello@outlook.com>");
> @@ -150,22 +155,22 @@ u8 alienware_interface;
>   int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
>   			  void *in_args, size_t in_size, u32 *out_data)
>   {
> -	struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
> -	struct acpi_buffer in = {in_size, in_args};
> -	acpi_status ret;
> +	struct wmi_buffer out, in = {
> +		.data = in_args,
> +		.length = in_size,
> +	};
> +	int ret;
>   
> -	ret = wmidev_evaluate_method(wdev, 0, method_id, &in, out_data ? &out : NULL);
> -	if (ACPI_FAILURE(ret))
> -		return -EIO;
> +	if (!out_data)
> +		return wmidev_invoke_procedure(wdev, 0, method_id, &in);
>   
> -	union acpi_object *obj __free(kfree) = out.pointer;
> +	ret = wmidev_invoke_method(wdev, 0, method_id, &in, &out,
> +				   sizeof(*out_data));
> +	if (ret)
> +		return ret;
>   
> -	if (out_data) {
> -		if (obj && obj->type == ACPI_TYPE_INTEGER)
> -			*out_data = (u32)obj->integer.value;
> -		else
> -			return -ENOMSG;
> -	}
> +	__le32 *data __free(kfree) = out.data;
> +	*out_data = le32_to_cpu(*data);
>   
>   	return 0;
>   }
>
> ---
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> change-id: 20260123-aw-new-api-1c18f1011f35
>

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

* Re: [PATCH v5] platform/x86: alienware-wmi-base: Transition to new WMI API
  2026-04-29 13:27 [PATCH v5] platform/x86: alienware-wmi-base: Transition to new WMI API Kurt Borja
  2026-04-29 21:18 ` Armin Wolf
@ 2026-05-19 12:24 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2026-05-19 12:24 UTC (permalink / raw)
  To: Armin Wolf, Hans de Goede, Kurt Borja
  Cc: platform-driver-x86, Dell.Client.Kernel, linux-kernel

On Wed, 29 Apr 2026 08:27:02 -0500, Kurt Borja wrote:

> Transition to the new wmi_buffer based WMI API.
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: alienware-wmi-base: Transition to new WMI API
      commit: 5809de26ccab13c18d591e923acbab5edebbf283

--
 i.


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

end of thread, other threads:[~2026-05-19 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-29 13:27 [PATCH v5] platform/x86: alienware-wmi-base: Transition to new WMI API Kurt Borja
2026-04-29 21:18 ` Armin Wolf
2026-05-19 12:24 ` 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®