Skip to content

Commit 7065655

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: think-lmi: Clean up display of current_value on Thinkstation
On ThinkStations on retrieving the attribute value the BIOS appends the possible values to the string. Clean up the display in the current_value_show function so the options part is not displayed. Fixes: a40cd7e ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms") Reported by Mario Limoncello <Mario.Limonciello@amd.com> Link: fwupd/fwupd#5077 (comment) Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20230403013120.2105-2-mpearson-lenovo@squebb.ca Tested-by: Mario Limonciello <mario.limonciello@amd.com> Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent e7d796f commit 7065655

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/platform/x86/think-lmi.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *at
920920
static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
921921
{
922922
struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
923-
char *item, *value;
923+
char *item, *value, *p;
924924
int ret;
925925

926926
ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID);
@@ -931,9 +931,12 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
931931
value = strpbrk(item, ",");
932932
if (!value || value == item || !strlen(value + 1))
933933
ret = -EINVAL;
934-
else
934+
else {
935+
/* On Workstations remove the Options part after the value */
936+
p = strchrnul(value, ';');
937+
*p = '\0';
935938
ret = sysfs_emit(buf, "%s\n", value + 1);
936-
939+
}
937940
kfree(item);
938941

939942
return ret;

0 commit comments

Comments
 (0)