[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZEomR842t6QrahyO@equiv.tech>
Date: Thu, 27 Apr 2023 07:37:44 +0000 (UTC)
From: James Seo <james@...iv.tech>
To: Armin Wolf <W_Armin@....de>
Cc: James Seo <james@...iv.tech>, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
linux-hwmon@...r.kernel.org, platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] hwmon: add HP WMI Sensors driver
On Wed, Apr 26, 2023 at 09:35:33PM +0200, Armin Wolf wrote:
> Am 26.04.23 um 15:16 schrieb James Seo:
>
>> On Mon, Apr 24, 2023 at 11:13:36PM +0200, Armin Wolf wrote:
>>> Am 24.04.23 um 12:05 schrieb James Seo:
>>>
>>>> + for (i = 0; i < HP_WMI_MAX_INSTANCES; i++, pevents++) {
>>> Hi,
>>>
>>> the WMI driver core already knows how many instances of a given WMI object are available.
>>> Unfortunately, this information is currently unavailable to drivers. Would it be convenient
>>> for you to access this information? I could try to implement such a function if needed.
>>>
>>>> + for (i = 0; i < HP_WMI_MAX_INSTANCES; i++, info++) {
>>> Same as above.
>>>
>> Hello,
>>
>> Having the WMI object instance count wouldn't make much difference to
>> me for now. The driver has to iterate through all instances during
>> init anyway. If I were forced to accommodate 50+ sensors, I'd rewrite
>> some things and I think I'd want such a function then, but I picked
>> the current arbitrary limit of 32 because even that seems unlikely.
>>
>> So, maybe don't worry about it unless you want to. Or am I missing
>> something?
>>
> Hi,
>
> i already have a experimental patch available which adds such a function.
> If you could test this patch to see if it works, then i could submit it upstream
> where other drivers could profit from being able to know the number of
> WMI object instances.
>
Both your proposed functions worked as expected.
> Your driver could also profit from such a function, as it could optimize the amount
> of memory allocated to store WMI object data.
I suppose I might as well. I assume I'm supposed to wait until your
new functions are merged before making changes that rely on them?
> The current instance discovery algorithm
> (using a for-loop and break on error) also has a potential issue: when a single WMI call
> fails for some reason (ACPI error, ...), all following WMI instances are being ignored.
>
This is the intended behavior for now, on the assumption that a real
ACPI failure probably indicates that the system has bigger problems.
I do have vague plans to make the driver more tolerant of failure to
retrieve or validate instances, but haven't decided anything yet.
Regards,
James
Powered by blists - more mailing lists