hwmon: (hp-wmi-sensors) Get WMI instance count from WMI driver core
Commit 2a2b13ae50
("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@equiv.tech>
Link: https://lore.kernel.org/r/20230722172513.9324-2-james@equiv.tech
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
4f65c15cf7
commit
10a7a334d3
|
@ -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;
|
||||
int count;
|
||||
|
||||
while (lo < hi) {
|
||||
mid = (lo + hi) / 2;
|
||||
count = wmi_instance_count(guid);
|
||||
|
||||
wobj = hp_wmi_get_wobj(guid, mid);
|
||||
if (!wobj) {
|
||||
hi = mid;
|
||||
continue;
|
||||
}
|
||||
|
||||
lo = mid + 1;
|
||||
kfree(wobj);
|
||||
}
|
||||
|
||||
return lo;
|
||||
return clamp(count, 0, (int)HP_WMI_MAX_INSTANCES);
|
||||
}
|
||||
|
||||
static int check_wobj(const union acpi_object *wobj,
|
||||
|
|
Loading…
Reference in New Issue