[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2c29ba3f-a180-42a1-a7fb-0b0ae7ed5774@roeck-us.net>
Date: Sat, 22 Jul 2023 11:23:30 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: James Seo <james@...iv.tech>
Cc: Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from
WMI driver core
On Sat, Jul 22, 2023 at 10:25:13AM -0700, James Seo wrote:
> 2a2b13ae50cf ("platform/x86: wmi: Allow retrieving the number of WMI
> object instances") means we no longer need to find this ourselves.
>
> Signed-off-by: James Seo <james@...iv.tech>
Applied to hwmon-next.
Thanks,
Guenter
> ---
> drivers/hwmon/hp-wmi-sensors.c | 20 +++-----------------
> 1 file changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
> index ebe2fb513480..3a99cc5f44b2 100644
> --- a/drivers/hwmon/hp-wmi-sensors.c
> +++ b/drivers/hwmon/hp-wmi-sensors.c
> @@ -435,25 +435,11 @@ static union acpi_object *hp_wmi_get_wobj(const char *guid, u8 instance)
> /* hp_wmi_wobj_instance_count - find count of WMI object instances */
> static u8 hp_wmi_wobj_instance_count(const char *guid)
> {
> - u8 hi = HP_WMI_MAX_INSTANCES;
> - union acpi_object *wobj;
> - u8 lo = 0;
> - u8 mid;
> -
> - while (lo < hi) {
> - mid = (lo + hi) / 2;
> -
> - wobj = hp_wmi_get_wobj(guid, mid);
> - if (!wobj) {
> - hi = mid;
> - continue;
> - }
> + int count;
>
> - lo = mid + 1;
> - kfree(wobj);
> - }
> + count = wmi_instance_count(guid);
>
> - return lo;
> + return clamp(count, 0, (int)HP_WMI_MAX_INSTANCES);
> }
>
> static int check_wobj(const union acpi_object *wobj,
> --
> 2.39.2
>
Powered by blists - more mailing lists