Skip to content

Commit

Permalink
platform/x86: hp-bioscfg: Use wmi_instance_count()
Browse files Browse the repository at this point in the history
The WMI core already knows the instance count of a WMI guid.
Use this information instead of querying all possible instances
which is slow and might be unreliable.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20250216193251.866125-5-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
  • Loading branch information
Armin Wolf authored and Ilpo Järvinen committed Feb 24, 2025
1 parent 126a53a commit 0fcc316
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,13 @@ union acpi_object *hp_get_wmiobj_pointer(int instance_id, const char *guid_strin
*/
int hp_get_instance_count(const char *guid_string)
{
union acpi_object *wmi_obj = NULL;
int i = 0;
int ret;

do {
kfree(wmi_obj);
wmi_obj = hp_get_wmiobj_pointer(i, guid_string);
i++;
} while (wmi_obj);
ret = wmi_instance_count(guid_string);
if (ret < 0)
return 0;

return i - 1;
return ret;
}

/**
Expand Down

0 comments on commit 0fcc316

Please sign in to comment.