Skip to content

Commit 0fcc316

Browse files
Wer-Wolfij-intel
authored andcommitted
platform/x86: hp-bioscfg: Use wmi_instance_count()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 126a53a commit 0fcc316

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/platform/x86/hp/hp-bioscfg/bioscfg.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,13 @@ union acpi_object *hp_get_wmiobj_pointer(int instance_id, const char *guid_strin
388388
*/
389389
int hp_get_instance_count(const char *guid_string)
390390
{
391-
union acpi_object *wmi_obj = NULL;
392-
int i = 0;
391+
int ret;
393392

394-
do {
395-
kfree(wmi_obj);
396-
wmi_obj = hp_get_wmiobj_pointer(i, guid_string);
397-
i++;
398-
} while (wmi_obj);
393+
ret = wmi_instance_count(guid_string);
394+
if (ret < 0)
395+
return 0;
399396

400-
return i - 1;
397+
return ret;
401398
}
402399

403400
/**

0 commit comments

Comments
 (0)