Re: [PATCH v2 2/2] platform/x86: think-lmi: Split current_value to reflect only the value

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

 



Hi,

On 6/22/21 10:07 PM, Mario Limonciello wrote:
> Currently attributes will show things like:
> `BootOrderLock,Disable`
> rather than just
> `Disable`.
> 
> Of course this works, but the attribute is intended to be read by
> userspace tools and not require further processing.  That is a userspace
> tool can display a drop down of `possible_values` and `current_value` is
> one of them from the list.
> 
> This also aligns `think-lmi` with how `dell-wmi-sysman` works.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/think-lmi.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> Changes from v1->v2:
>  * Move into the series
>  * Correct a char->char*
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 4d8b5c185f8e..e71b631e6984 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -492,14 +492,19 @@ 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;
> +	char *item, *value;
>  	int ret;
>  
>  	ret = tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID);
>  	if (ret)
>  		return ret;
>  
> -	ret = sysfs_emit(buf, "%s\n", item);
> +	/* validate and split from `item,value` -> `value` */
> +	value = strpbrk(item, ",");
> +	if (!value || value == item || !strlen(value + 1))
> +		return -EINVAL;
> +
> +	ret = sysfs_emit(buf, "%s\n", value + 1);
>  	kfree(item);
>  	return ret;
>  }
> 




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux