diff options
| author | Armin Wolf <W_Armin@gmx.de> | 2026-01-16 21:41:13 +0100 |
|---|---|---|
| committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2026-01-20 15:47:55 +0200 |
| commit | e210986f52b657301d009e23344e3effec12bbeb (patch) | |
| tree | 2ff431b04af4fa6257c495d3b2d94a6dc7c4aba6 /drivers/platform | |
| parent | 534f685d8a952371148e1374576f8ede2919ec1d (diff) | |
platform/x86/intel/wmi: thunderbolt: Use new buffer-based WMI API
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>
Link: https://patch.msgid.link/20260116204116.4030-7-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform')
| -rw-r--r-- | drivers/platform/x86/intel/wmi/thunderbolt.c | 26 |
1 files 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; } |
