Patch "platform/x86: think-lmi: Clean up display of current_value on Thinkstation" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    platform/x86: think-lmi: Clean up display of current_value on Thinkstation

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     platform-x86-think-lmi-clean-up-display-of-current_v.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8bb9c368e96e22e3101d0356a3d4fd2fdbc8c771
Author: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
Date:   Sun Apr 2 21:31:20 2023 -0400

    platform/x86: think-lmi: Clean up display of current_value on Thinkstation
    
    [ Upstream commit 7065655216d4d034d71164641f3bec0b189ad6fa ]
    
    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: a40cd7ef22fb ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
    Reported by Mario Limoncello <Mario.Limonciello@xxxxxxx>
    Link: https://github.com/fwupd/fwupd/issues/5077#issuecomment-1488730526
    Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230403013120.2105-2-mpearson-lenovo@xxxxxxxxx
    Tested-by: Mario Limonciello <mario.limonciello@xxxxxxx>
    Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
    Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index ded3aacb26cc9..76f0d04e17f30 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -504,7 +504,7 @@ static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *at
 static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
 {
 	struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
-	char *item, *value;
+	char *item, *value, *p;
 	int ret;
 
 	ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID);
@@ -515,9 +515,12 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
 	value = strpbrk(item, ",");
 	if (!value || value == item || !strlen(value + 1))
 		ret = -EINVAL;
-	else
+	else {
+		/* On Workstations remove the Options part after the value */
+		p = strchrnul(value, ';');
+		*p = '\0';
 		ret = sysfs_emit(buf, "%s\n", value + 1);
-
+	}
 	kfree(item);
 
 	return ret;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux