diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2021-04-10 17:02:53 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-04-12 19:34:12 +0200 |
commit | 020505581119d191ee8da478783e2465d7f5fa8e (patch) | |
tree | cf13c960708fd0c684900e0602a55fd7a4a1de37 /drivers/acpi | |
parent | c830dbcfccbf70be94f15dbb4781be5ffb210d98 (diff) | |
download | linux-stable-020505581119d191ee8da478783e2465d7f5fa8e.tar.gz linux-stable-020505581119d191ee8da478783e2465d7f5fa8e.tar.bz2 linux-stable-020505581119d191ee8da478783e2465d7f5fa8e.zip |
ACPI: scan: Utilize match_string() API
We have already an API to match a string in the array of strings.
Utilize it instead of open coded analogues.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/scan.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 053777845475..1dea11786ea9 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -757,27 +757,25 @@ static bool acpi_info_matches_ids(struct acpi_device_info *info, const char * const ids[]) { struct acpi_pnp_device_id_list *cid_list = NULL; - int i; + int i, index; if (!(info->valid & ACPI_VALID_HID)) return false; + index = match_string(ids, -1, info->hardware_id.string); + if (index >= 0) + return true; + if (info->valid & ACPI_VALID_CID) cid_list = &info->compatible_id_list; - for (i = 0; ids[i]; i++) { - int j; + if (!cid_list) + return false; - if (!strcmp(info->hardware_id.string, ids[i])) + for (i = 0; i < cid_list->count; i++) { + index = match_string(ids, -1, cid_list->ids[i].string); + if (index >= 0) return true; - - if (!cid_list) - continue; - - for (j = 0; j < cid_list->count; j++) { - if (!strcmp(cid_list->ids[j].string, ids[i])) - return true; - } } return false; |