Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <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>

authored by

Armin Wolf and committed by
Ilpo Järvinen
0fcc3162 126a53a9

+5 -8
+5 -8
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
··· 388 388 */ 389 389 int hp_get_instance_count(const char *guid_string) 390 390 { 391 - union acpi_object *wmi_obj = NULL; 392 - int i = 0; 391 + int ret; 393 392 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; 399 396 400 - return i - 1; 397 + return ret; 401 398 } 402 399 403 400 /**