Skip to content

Commit 8a02d70

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: think-lmi: Add possible_values for ThinkStation
ThinkStation platforms don't support the API to return possible_values but instead embed it in the settings string. Try and extract this information and set the possible_values attribute appropriately. Fixes: a40cd7e ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Signed-off-by: Mark Pearson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Thomas Weißschuh <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent cf337f2 commit 8a02d70

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/platform/x86/think-lmi.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,26 @@ static int tlmi_analyze(void)
14501450
if (ret || !setting->possible_values)
14511451
pr_info("Error retrieving possible values for %d : %s\n",
14521452
i, setting->display_name);
1453+
} else {
1454+
/*
1455+
* Older Thinkstations don't support the bios_selections API.
1456+
* Instead they store this as a [Optional:Option1,Option2] section of the
1457+
* name string.
1458+
* Try and pull that out if it's available.
1459+
*/
1460+
char *item, *optstart, *optend;
1461+
1462+
if (!tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID)) {
1463+
optstart = strstr(item, "[Optional:");
1464+
if (optstart) {
1465+
optstart += strlen("[Optional:");
1466+
optend = strstr(optstart, "]");
1467+
if (optend)
1468+
setting->possible_values =
1469+
kstrndup(optstart, optend - optstart,
1470+
GFP_KERNEL);
1471+
}
1472+
}
14531473
}
14541474
/*
14551475
* firmware-attributes requires that possible_values are separated by ';' but

0 commit comments

Comments
 (0)