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: wmi: Use correct type when populating ACPI objects

When evaluating a WMxx/WSxx ACPI control method, the data buffer
either needs to be passed as an ACPI buffer or as an ACPI string.
Use the correct type (buffer/string) when populating the associated
ACPI object.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://patch.msgid.link/20251111131125.3379-3-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
c209195a 25524b61

+20 -14
+20 -14
drivers/platform/x86/wmi.c
··· 142 142 buffer[4] = '\0'; 143 143 } 144 144 145 - static inline acpi_object_type get_param_acpi_type(const struct wmi_block *wblock) 146 - { 147 - if (wblock->gblock.flags & ACPI_WMI_STRING) 148 - return ACPI_TYPE_STRING; 149 - else 150 - return ACPI_TYPE_BUFFER; 151 - } 152 - 153 145 static int wmidev_match_guid(struct device *dev, const void *data) 154 146 { 155 147 struct wmi_block *wblock = dev_to_wblock(dev); ··· 343 351 params[0].integer.value = instance; 344 352 params[1].type = ACPI_TYPE_INTEGER; 345 353 params[1].integer.value = method_id; 346 - params[2].type = get_param_acpi_type(wblock); 347 - params[2].buffer.length = in->length; 348 - params[2].buffer.pointer = in->pointer; 354 + 355 + if (wblock->gblock.flags & ACPI_WMI_STRING) { 356 + params[2].type = ACPI_TYPE_STRING; 357 + params[2].string.length = in->length; 358 + params[2].string.pointer = in->pointer; 359 + } else { 360 + params[2].type = ACPI_TYPE_BUFFER; 361 + params[2].buffer.length = in->length; 362 + params[2].buffer.pointer = in->pointer; 363 + } 349 364 350 365 get_acpi_method_name(wblock, 'M', method); 351 366 ··· 518 519 input.pointer = params; 519 520 params[0].type = ACPI_TYPE_INTEGER; 520 521 params[0].integer.value = instance; 521 - params[1].type = get_param_acpi_type(wblock); 522 - params[1].buffer.length = in->length; 523 - params[1].buffer.pointer = in->pointer; 522 + 523 + if (wblock->gblock.flags & ACPI_WMI_STRING) { 524 + params[1].type = ACPI_TYPE_STRING; 525 + params[1].string.length = in->length; 526 + params[1].string.pointer = in->pointer; 527 + } else { 528 + params[1].type = ACPI_TYPE_BUFFER; 529 + params[1].buffer.length = in->length; 530 + params[1].buffer.pointer = in->pointer; 531 + } 524 532 525 533 get_acpi_method_name(wblock, 'S', method); 526 534