Re: [PATCH v3 3/3] platform/x86: think-lmi: use correct possible_values delimters

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

 



On Fri, Mar 17, 2023 at 11:46:35AM -0400, Mark Pearson wrote:
> firmware-attributes class requires that possible values are delimited
> using ';' but the Lenovo firmware uses ',' instead.
> Parse string and replace where appropriate
> 
> Thanks to Thomas W for pointing this out.
> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
> ---
>  Changes in V3: New patch added to the series. No V1 & V2.
> 
>  drivers/platform/x86/think-lmi.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index d89a1c9bdbf1..204f1060a533 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -1040,7 +1040,7 @@ static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
>  
>  	if (setting->possible_values) {
>  		/* Figure out what setting type is as BIOS does not return this */
> -		if (strchr(setting->possible_values, ','))
> +		if (strchr(setting->possible_values, ';'))
>  			return sysfs_emit(buf, "enumeration\n");

I think this patch should be earlier in the series.
So the other patches can work directly from the beginning.

Also maybe this needs a Fixes: tag and a Cc: stable@ so it gets
backported.

>  	}
>  	/* Anything else is going to be a string */
> @@ -1471,6 +1471,17 @@ static int tlmi_analyze(void)
>  				}
>  			}
>  		}
> +		/*
> +		 * firmware-attributes requires that possible_values are separated by ';' but
> +		 * Lenovo FW uses ','. Replace appropriately.
> +		 */
> +		if (setting->possible_values) {
> +			char *tmp = setting->possible_values;
> +
> +			while ((tmp = strchr(tmp, ',')) != NULL)
> +				*tmp++ = ';';
> +		}
> +
>  		kobject_init(&setting->kobj, &tlmi_attr_setting_ktype);
>  		tlmi_priv.setting[i] = setting;
>  		kfree(item);
> -- 
> 2.39.2
> 



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

  Powered by Linux