Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Armin Wolf and committed by
Ilpo Järvinen
e210986f 534f685d

+11 -15
+11 -15
drivers/platform/x86/intel/wmi/thunderbolt.c
··· 7 7 8 8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 9 9 10 - #include <linux/acpi.h> 11 10 #include <linux/device.h> 12 11 #include <linux/fs.h> 13 12 #include <linux/kernel.h> ··· 22 23 struct device_attribute *attr, 23 24 const char *buf, size_t count) 24 25 { 25 - struct acpi_buffer input; 26 - acpi_status status; 26 + struct wmi_buffer buffer; 27 + int ret; 27 28 u8 mode; 28 29 29 - input.length = sizeof(u8); 30 - input.pointer = &mode; 30 + buffer.length = sizeof(mode); 31 + buffer.data = &mode; 32 + 31 33 mode = hex_to_bin(buf[0]); 32 - dev_dbg(dev, "force_power: storing %#x\n", mode); 33 - if (mode == 0 || mode == 1) { 34 - status = wmidev_evaluate_method(to_wmi_device(dev), 0, 1, &input, NULL); 35 - if (ACPI_FAILURE(status)) { 36 - dev_dbg(dev, "force_power: failed to evaluate ACPI method\n"); 37 - return -ENODEV; 38 - } 39 - } else { 40 - dev_dbg(dev, "force_power: unsupported mode\n"); 34 + if (mode > 1) 41 35 return -EINVAL; 42 - } 36 + 37 + ret = wmidev_invoke_method(to_wmi_device(dev), 0, 1, &buffer, NULL); 38 + if (ret < 0) 39 + return ret; 40 + 43 41 return count; 44 42 } 45 43