All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Armin Wolf" <W_Armin@gmx.de>,
	james@equiv.tech, "Mark Pearson" <markpearson@lenovo.com>,
	"Jorge Lopez" <jorge.lopez2@hp.com>
Cc: jdelvare@suse.com, "Guenter Roeck" <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 2/7] platform/x86: think-lmi: Use ACPI object when extracting strings
Date: Tue, 11 Feb 2025 11:46:38 -0500	[thread overview]
Message-ID: <10f2da65-0873-4512-b0c3-b91ab149a199@app.fastmail.com> (raw)
In-Reply-To: <33eac2f8-b295-4716-a5f8-9f0bf7f6d349@gmx.de>

Hi Armin

On Sun, Feb 9, 2025, at 7:31 PM, Armin Wolf wrote:
> Am 03.02.25 um 19:23 schrieb Armin Wolf:
>
>> Move the ACPI buffer handling out of tlmi_extract_output_string()
>> and instead pass the unpacked ACPI object to prepare for future
>> changes.
>
> Hi,
>
> i was hoping that maybe the driver maintainer could take a look at this patch
> and give some feedback.
>
My apologies - because of this patch (and a couple of others) I've just realised I never updated the MAINTAINERS file.
I have been mothballing the markpearson@lenovo.com address as it's a nightmare to use and switched to using my personal email domain instead. It seems my email filters aren't flagging these messages the way they are supposed to be - I have to figure that out :(

> Thanks,
> Armin Wolf
>
>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>> ---
>>   drivers/platform/x86/think-lmi.c | 38 +++++++++++++++++---------------
>>   1 file changed, 20 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>> index 323316ac6783..2c94a4af9a1d 100644
>> --- a/drivers/platform/x86/think-lmi.c
>> +++ b/drivers/platform/x86/think-lmi.c
>> @@ -262,16 +262,11 @@ static int tlmi_simple_call(const char *guid, const char *arg)
>>   	return 0;
>>   }
>>
>> -/* Extract output string from WMI return buffer */
>> -static int tlmi_extract_output_string(const struct acpi_buffer *output,
>> -				      char **string)
>> +/* Extract output string from WMI return value */
>> +static int tlmi_extract_output_string(union acpi_object *obj, char **string)
>>   {
>> -	const union acpi_object *obj;
>>   	char *s;
>>
>> -	obj = output->pointer;
>> -	if (!obj)
>> -		return -ENOMEM;
>>   	if (obj->type != ACPI_TYPE_STRING || !obj->string.pointer)
>>   		return -EIO;
>>
>> @@ -352,17 +347,21 @@ static int tlmi_opcode_setting(char *setting, const char *value)
>>   static int tlmi_setting(int item, char **value, const char *guid_string)
>>   {
>>   	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
>> +	union acpi_object *obj;
>>   	acpi_status status;
>>   	int ret;
>>
>>   	status = wmi_query_block(guid_string, item, &output);
>> -	if (ACPI_FAILURE(status)) {
>> -		kfree(output.pointer);
>> +	if (ACPI_FAILURE(status))
>>   		return -EIO;
>> -	}
>>
>> -	ret = tlmi_extract_output_string(&output, value);
>> -	kfree(output.pointer);
>> +	obj = output.pointer;
>> +	if (!obj)
>> +		return -ENODATA;
>> +
>> +	ret = tlmi_extract_output_string(obj, value);
>> +	kfree(obj);
>> +
>>   	return ret;
>>   }
>>
>> @@ -370,19 +369,22 @@ static int tlmi_get_bios_selections(const char *item, char **value)
>>   {
>>   	const struct acpi_buffer input = { strlen(item), (char *)item };
>>   	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
>> +	union acpi_object *obj;
>>   	acpi_status status;
>>   	int ret;
>>
>>   	status = wmi_evaluate_method(LENOVO_GET_BIOS_SELECTIONS_GUID,
>>   				     0, 0, &input, &output);
>> -
>> -	if (ACPI_FAILURE(status)) {
>> -		kfree(output.pointer);
>> +	if (ACPI_FAILURE(status))
>>   		return -EIO;
>> -	}
>>
>> -	ret = tlmi_extract_output_string(&output, value);
>> -	kfree(output.pointer);
>> +	obj = output.pointer;
>> +	if (!obj)
>> +		return -ENODATA;
>> +
>> +	ret = tlmi_extract_output_string(obj, value);
>> +	kfree(obj);
>> +
>>   	return ret;
>>   }
>>
>> --
>> 2.39.5
>>
>>
Changes look good to me. If you can hold on a bit I'll see if I can test them on a few platforms to make sure no surprises.

Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>

Mark

  reply	other threads:[~2025-02-11 16:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 18:23 [PATCH 0/7] platform/x86: wmi: Rework WMI device enabling Armin Wolf
2025-02-03 18:23 ` [PATCH 1/7] hwmon: (hp-wmi-sensors) Use the WMI bus API when accessing sensors Armin Wolf
2025-02-04  0:41   ` James Seo
2025-02-04  1:18   ` Guenter Roeck
2025-02-04  9:41     ` Armin Wolf
2025-02-03 18:23 ` [PATCH 2/7] platform/x86: think-lmi: Use ACPI object when extracting strings Armin Wolf
2025-02-10  0:31   ` Armin Wolf
2025-02-11 16:46     ` Mark Pearson [this message]
2025-02-03 18:23 ` [PATCH 3/7] platform/x86: think-lmi: Use WMI bus API when accessing BIOS settings Armin Wolf
2025-02-13 13:17   ` Ilpo Järvinen
2025-02-14  3:07     ` Armin Wolf
2025-02-03 18:23 ` [PATCH 4/7] platform/x86: hp-bioscfg: Use wmi_instance_count() Armin Wolf
2025-02-04 10:37   ` Ilpo Järvinen
2025-02-04 13:06     ` Armin Wolf
2025-02-04 14:27       ` Ilpo Järvinen
2025-02-03 18:23 ` [PATCH 5/7] platform/x86: wmi: Rework WCxx/WExx ACPI method handling Armin Wolf
2025-02-03 18:23 ` [PATCH 6/7] platform/x86: wmi: Call WCxx methods when setting data blocks Armin Wolf
2025-02-03 18:23 ` [PATCH 7/7] platform/x86: wmi: Update documentation regarding the GUID-based API Armin Wolf

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=10f2da65-0873-4512-b0c3-b91ab149a199@app.fastmail.com \
    --to=mpearson-lenovo@squebb.ca \
    --cc=W_Armin@gmx.de \
    --cc=corbet@lwn.net \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=james@equiv.tech \
    --cc=jdelvare@suse.com \
    --cc=jorge.lopez2@hp.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=markpearson@lenovo.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.