X86 platform drivers
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux@weissschuh.net,
	Dell.Client.Kernel@dell.com, corbet@lwn.net,
	linux-doc@vger.kernel.org
Subject: [PATCH v2 6/9] platform/x86/intel/wmi: thunderbolt: Use new buffer-based WMI API
Date: Sat, 20 Dec 2025 21:46:19 +0100	[thread overview]
Message-ID: <20251220204622.3541-7-W_Armin@gmx.de> (raw)
In-Reply-To: <20251220204622.3541-1-W_Armin@gmx.de>

Use the new buffer-based WMI API to avoid having to deal with ACPI
at all.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/intel/wmi/thunderbolt.c | 26 +++++++++-----------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/x86/intel/wmi/thunderbolt.c b/drivers/platform/x86/intel/wmi/thunderbolt.c
index 08df560a2c7a..f01dd096c689 100644
--- a/drivers/platform/x86/intel/wmi/thunderbolt.c
+++ b/drivers/platform/x86/intel/wmi/thunderbolt.c
@@ -7,7 +7,6 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/acpi.h>
 #include <linux/device.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
@@ -23,24 +22,21 @@ static ssize_t force_power_store(struct device *dev,
 				 struct device_attribute *attr,
 				 const char *buf, size_t count)
 {
-	struct acpi_buffer input;
-	acpi_status status;
+	struct wmi_buffer buffer;
+	int ret;
 	u8 mode;
 
-	input.length = sizeof(u8);
-	input.pointer = &mode;
+	buffer.length = sizeof(mode);
+	buffer.data = &mode;
+
 	mode = hex_to_bin(buf[0]);
-	dev_dbg(dev, "force_power: storing %#x\n", mode);
-	if (mode == 0 || mode == 1) {
-		status = wmidev_evaluate_method(to_wmi_device(dev), 0, 1, &input, NULL);
-		if (ACPI_FAILURE(status)) {
-			dev_dbg(dev, "force_power: failed to evaluate ACPI method\n");
-			return -ENODEV;
-		}
-	} else {
-		dev_dbg(dev, "force_power: unsupported mode\n");
+	if (mode > 1)
 		return -EINVAL;
-	}
+
+	ret = wmidev_invoke_method(to_wmi_device(dev), 0, 1, &buffer, NULL);
+	if (ret < 0)
+		return ret;
+
 	return count;
 }
 
-- 
2.39.5


  parent reply	other threads:[~2025-12-20 20:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-20 20:46 [PATCH v2 0/9] platform/wmi: Introduce marshalling support Armin Wolf
2025-12-20 20:46 ` [PATCH v2 1/9] " Armin Wolf
2026-01-06 15:35   ` Ilpo Järvinen
2026-01-06 15:56   ` Ilpo Järvinen
2025-12-20 20:46 ` [PATCH v2 2/9] platform/wmi: Add kunit test for the marshalling code Armin Wolf
2026-01-06 15:39   ` Ilpo Järvinen
2025-12-20 20:46 ` [PATCH v2 3/9] platform/wmi: Add helper functions for WMI string conversions Armin Wolf
2025-12-20 20:46 ` [PATCH v2 4/9] platform/wmi: Add kunit test for the string conversion code Armin Wolf
2025-12-20 20:46 ` [PATCH v2 5/9] platform/x86: intel-wmi-sbl-fw-update: Use new buffer-based WMI API Armin Wolf
2025-12-20 20:46 ` Armin Wolf [this message]
2025-12-20 20:46 ` [PATCH v2 7/9] platform/x86: xiaomi-wmi: " Armin Wolf
2025-12-20 20:46 ` [PATCH v2 8/9] platform/x86: wmi-bmof: " Armin Wolf
2025-12-20 20:46 ` [PATCH v2 9/9] platform/wmi: Update driver development guide Armin Wolf
2026-01-06 15:15 ` [PATCH v2 0/9] platform/wmi: Introduce marshalling support Armin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251220204622.3541-7-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=corbet@lwn.net \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox