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: think-lmi: Use WMI bus API when accessing BIOS settings

Since the driver already binds to LENOVO_BIOS_SETTING_GUID, using
wmidev_block_query() inside tlmi_setting() allows for faster
access to BIOS settings.

Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20250216193251.866125-4-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
126a53a9 82d3af6b

+11 -14
+9 -14
drivers/platform/x86/think-lmi.c
··· 344 344 return ret; 345 345 } 346 346 347 - static int tlmi_setting(int item, char **value, const char *guid_string) 347 + static int tlmi_setting(struct wmi_device *wdev, int item, char **value) 348 348 { 349 - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 350 349 union acpi_object *obj; 351 - acpi_status status; 352 350 int ret; 353 351 354 - status = wmi_query_block(guid_string, item, &output); 355 - if (ACPI_FAILURE(status)) 356 - return -EIO; 357 - 358 - obj = output.pointer; 352 + obj = wmidev_block_query(wdev, item); 359 353 if (!obj) 360 - return -ENODATA; 354 + return -EIO; 361 355 362 356 ret = tlmi_extract_output_string(obj, value); 363 357 kfree(obj); ··· 989 995 char *item, *value; 990 996 int ret; 991 997 992 - ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID); 998 + ret = tlmi_setting(setting->wdev, setting->index, &item); 993 999 if (ret) 994 1000 return ret; 995 1001 ··· 1582 1588 return new_pwd; 1583 1589 } 1584 1590 1585 - static int tlmi_analyze(void) 1591 + static int tlmi_analyze(struct wmi_device *wdev) 1586 1592 { 1587 1593 int i, ret; 1588 1594 ··· 1619 1625 char *item = NULL; 1620 1626 1621 1627 tlmi_priv.setting[i] = NULL; 1622 - ret = tlmi_setting(i, &item, LENOVO_BIOS_SETTING_GUID); 1628 + ret = tlmi_setting(wdev, i, &item); 1623 1629 if (ret) 1624 1630 break; 1625 1631 if (!item) ··· 1642 1648 kfree(item); 1643 1649 goto fail_clear_attr; 1644 1650 } 1651 + setting->wdev = wdev; 1645 1652 setting->index = i; 1646 1653 strscpy(setting->display_name, item); 1647 1654 /* If BIOS selections supported, load those */ ··· 1661 1666 */ 1662 1667 char *optitem, *optstart, *optend; 1663 1668 1664 - if (!tlmi_setting(setting->index, &optitem, LENOVO_BIOS_SETTING_GUID)) { 1669 + if (!tlmi_setting(setting->wdev, setting->index, &optitem)) { 1665 1670 optstart = strstr(optitem, "[Optional:"); 1666 1671 if (optstart) { 1667 1672 optstart += strlen("[Optional:"); ··· 1786 1791 { 1787 1792 int ret; 1788 1793 1789 - ret = tlmi_analyze(); 1794 + ret = tlmi_analyze(wdev); 1790 1795 if (ret) 1791 1796 return ret; 1792 1797
+2
drivers/platform/x86/think-lmi.h
··· 4 4 #define _THINK_LMI_H_ 5 5 6 6 #include <linux/types.h> 7 + #include <linux/wmi.h> 7 8 8 9 #define TLMI_SETTINGS_COUNT 256 9 10 #define TLMI_SETTINGS_MAXLEN 512 ··· 88 87 /* Attribute setting details */ 89 88 struct tlmi_attr_setting { 90 89 struct kobject kobj; 90 + struct wmi_device *wdev; 91 91 int index; 92 92 char display_name[TLMI_SETTINGS_MAXLEN]; 93 93 char *possible_values;