Skip to content

Commit e210986

Browse files
Wer-Wolfij-intel
authored andcommitted
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>
1 parent 534f685 commit e210986

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

drivers/platform/x86/intel/wmi/thunderbolt.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
99

10-
#include <linux/acpi.h>
1110
#include <linux/device.h>
1211
#include <linux/fs.h>
1312
#include <linux/kernel.h>
@@ -23,24 +22,21 @@ static ssize_t force_power_store(struct device *dev,
2322
struct device_attribute *attr,
2423
const char *buf, size_t count)
2524
{
26-
struct acpi_buffer input;
27-
acpi_status status;
25+
struct wmi_buffer buffer;
26+
int ret;
2827
u8 mode;
2928

30-
input.length = sizeof(u8);
31-
input.pointer = &mode;
29+
buffer.length = sizeof(mode);
30+
buffer.data = &mode;
31+
3232
mode = hex_to_bin(buf[0]);
33-
dev_dbg(dev, "force_power: storing %#x\n", mode);
34-
if (mode == 0 || mode == 1) {
35-
status = wmidev_evaluate_method(to_wmi_device(dev), 0, 1, &input, NULL);
36-
if (ACPI_FAILURE(status)) {
37-
dev_dbg(dev, "force_power: failed to evaluate ACPI method\n");
38-
return -ENODEV;
39-
}
40-
} else {
41-
dev_dbg(dev, "force_power: unsupported mode\n");
33+
if (mode > 1)
4234
return -EINVAL;
43-
}
35+
36+
ret = wmidev_invoke_method(to_wmi_device(dev), 0, 1, &buffer, NULL);
37+
if (ret < 0)
38+
return ret;
39+
4440
return count;
4541
}
4642

0 commit comments

Comments
 (0)