mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: james@equiv.tech, markpearson@lenovo.com, jorge.lopez2@hp.com,
	jdelvare@suse.com, linux@roeck-us.net,
	linux-hwmon@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	platform-driver-x86@vger.kernel.org, corbet@lwn.net,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 3/7] platform/x86: think-lmi: Use WMI bus API when accessing BIOS settings
Date: Fri, 14 Feb 2025 04:07:07 +0100	[thread overview]
Message-ID: <62e5b2f6-23e8-44e2-80f8-2509dd8e5a17@gmx.de> (raw)
In-Reply-To: <0dd7bda3-bf76-228b-27f3-f057e80e3a03@linux.intel.com>

Am 13.02.25 um 14:17 schrieb Ilpo Järvinen:

> On Mon, 3 Feb 2025, Armin Wolf wrote:
>
>> Since the driver already binds to LENOVO_BIOS_SETTING_GUID, using
>> wmidev_block_query() inside tlmi_setting() allows for faster
>> access to BIOS settings.
>>
>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>> ---
>>   drivers/platform/x86/think-lmi.c | 23 +++++++++--------------
>>   drivers/platform/x86/think-lmi.h |  2 ++
>>   2 files changed, 11 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>> index 2c94a4af9a1d..0fc275e461be 100644
>> --- a/drivers/platform/x86/think-lmi.c
>> +++ b/drivers/platform/x86/think-lmi.c
>> @@ -344,20 +344,14 @@ static int tlmi_opcode_setting(char *setting, const char *value)
>>   	return ret;
>>   }
>>
>> -static int tlmi_setting(int item, char **value, const char *guid_string)
>> +static int tlmi_setting(struct wmi_device *wdev, int item, char **value)
>>   {
>> -	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))
>> -		return -EIO;
>> -
>> -	obj = output.pointer;
>> +	obj = wmidev_block_query(wdev, item);
>>   	if (!obj)
>> -		return -ENODATA;
>> +		return -EIO;
> Hi Armin,
>
> I'm trying to understand why there are these back and forth changes in the
> error code.
>
> It almost looks to me like wmidev_block_query() would want to return the
> error code itself because after you abstracted this code using
> wmidev_block_query(), you had to change the error code because you no
> longer have access to the key detail to decide which error code should be
> returned. That is, use ERR_PTR() inside wmidev_block_query() and the
> callers should just pass that error code on with IS_ERR & friends?
>
Hi,

the reason why wmidev_block_query() only returns NULL in case of an error is that
according to the WMI-ACPI specification, querying a WMI data block should return data.

So we have two error scenarios:

- ACPI error => firmware error => EIO
- no data returned => violation of firmware spec => EIO

Because of this always returning EIO is the correct approach in my opinion.

Thanks,
Armin Wolf


  reply	other threads:[~2025-02-14  3:07 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
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 [this message]
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=62e5b2f6-23e8-44e2-80f8-2509dd8e5a17@gmx.de \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®