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. Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx> --- drivers/platform/x86/think-lmi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 495a5e045069..52f3472fd1e0 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1432,6 +1432,29 @@ static int tlmi_analyze(void) if (ret || !setting->possible_values) pr_info("Error retrieving possible values for %d : %s\n", i, setting->display_name); + } else { + /* + * Older Thinkstations don't support the bios_selections API. + * Instead they store this as a [Optional:Option1,Option2] section of the + * name string. + * Try and pull that out if it's available. + */ + char *item, *optstart, *optend; + + if (!tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID)) { + optstart = strstr(item, "[Optional:"); + if (optstart) { + optstart += strlen("[Optional:"); + optend = strstr(optstart, "]"); + if (optend) { + setting->possible_values = + kmalloc(optend - optstart, GFP_KERNEL); + strncpy(setting->possible_values, + optstart, optend - optstart); + setting->possible_values[optend - optstart] = '\0'; + } + } + } } /* If we don't have a possible value mark as N/A */ if (!setting->possible_values) { -- 2.39.1