From: Mario Limonciello <mario.limonciello@amd.com>
To: Mark Pearson <mpearson-lenovo@squebb.ca>
Cc: hdegoede@redhat.com, markgross@kernel.org, W_Armin@gmx.de,
mirsad.todorovac@alu.unizg.hr, linux@weissschuh.net,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] platform/x86: think-lmi: Clean up display of current_value on Thinkstation
Date: Sun, 2 Apr 2023 21:05:45 -0500 [thread overview]
Message-ID: <1a758838-0196-86ee-cd26-cc8c930f20dc@amd.com> (raw)
In-Reply-To: <20230403013120.2105-2-mpearson-lenovo@squebb.ca>
On 4/2/23 20:31, Mark Pearson wrote:
> 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@amd.com>
> Link: https://github.com/fwupd/fwupd/issues/5077#issuecomment-1488730526
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
> Changes in v2: For some reason v2 doesn't apply cleanly so rebased and
> started again. Hopefully this one works
Tested-by: Mario Limonciello <mario.limonciello@amd.com>
tested on 6.3rc5 + prerequisite Armin's patch.
>
> drivers/platform/x86/think-lmi.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 87f832142d8d..78dc82bda4dd 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -920,7 +920,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);
> @@ -931,9 +931,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;
next prev parent reply other threads:[~2023-04-03 2:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 1:31 [PATCH v2 1/2] platform/x86: think-lmi: Fix memory leaks when parsing ThinkStation WMI strings Mark Pearson
2023-04-03 1:31 ` [PATCH v2 2/2] platform/x86: think-lmi: Clean up display of current_value on Thinkstation Mark Pearson
2023-04-03 2:05 ` Mario Limonciello [this message]
2023-04-03 8:21 ` Mirsad Goran Todorovac
2023-04-03 9:43 ` [PATCH v2 1/2] platform/x86: think-lmi: Fix memory leaks when parsing ThinkStation WMI strings Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a758838-0196-86ee-cd26-cc8c930f20dc@amd.com \
--to=mario.limonciello@amd.com \
--cc=W_Armin@gmx.de \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=markgross@kernel.org \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).