Skip to content

Commit 45e2128

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: think-lmi: use correct possible_values delimiters
firmware-attributes class requires that possible values are delimited using ';' but the Lenovo firmware uses ',' instead. Parse string and replace where appropriate. Suggested-by: Thomas Weißschuh <linux@weissschuh.net> Fixes: a40cd7e ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20230320003221.561750-2-mpearson-lenovo@squebb.ca Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 583329d commit 45e2128

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/platform/x86/think-lmi.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
954954

955955
if (setting->possible_values) {
956956
/* Figure out what setting type is as BIOS does not return this */
957-
if (strchr(setting->possible_values, ','))
957+
if (strchr(setting->possible_values, ';'))
958958
return sysfs_emit(buf, "enumeration\n");
959959
}
960960
/* Anything else is going to be a string */
@@ -1441,6 +1441,13 @@ static int tlmi_analyze(void)
14411441
pr_info("Error retrieving possible values for %d : %s\n",
14421442
i, setting->display_name);
14431443
}
1444+
/*
1445+
* firmware-attributes requires that possible_values are separated by ';' but
1446+
* Lenovo FW uses ','. Replace appropriately.
1447+
*/
1448+
if (setting->possible_values)
1449+
strreplace(setting->possible_values, ',', ';');
1450+
14441451
kobject_init(&setting->kobj, &tlmi_attr_setting_ktype);
14451452
tlmi_priv.setting[i] = setting;
14461453
kfree(item);

0 commit comments

Comments
 (0)