diff options
author | Hans de Goede <hdegoede@redhat.com> | 2020-11-21 21:30:34 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2020-12-02 14:02:51 +0100 |
commit | 637b9f1a1194cc671bac0039824cc472a2960b2f (patch) | |
tree | bca03e0ce8ed9ebe297f8c237290d4af10099e81 /drivers/acpi/scan.c | |
parent | c1e9735975c05d36ca97e9d39e9b06c3e0b3b0d7 (diff) |
ACPI: scan: Add acpi_info_matches_hids() helper
acpi_device_dep_initialize() disergards _DEP "suppliers" with a _HID
of "INT3396" and checks this using an acpi_device_info struct.
Because in general there are other device IDs that need to be treated
in the same way, add acpi_info_matches_hids() which checks a list of
_HIDs for this purpose and switch acpi_device_dep_initialize() over
to using it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[ rjw: Changelog rewrite ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index bc6a79e33220..e949265d5667 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -719,6 +719,28 @@ int acpi_device_add(struct acpi_device *device, /* -------------------------------------------------------------------------- Device Enumeration -------------------------------------------------------------------------- */ +static bool acpi_info_matches_hids(struct acpi_device_info *info, + const char * const hids[]) +{ + int i; + + if (!(info->valid & ACPI_VALID_HID)) + return false; + + for (i = 0; hids[i]; i++) { + if (!strcmp(info->hardware_id.string, hids[i])) + return true; + } + + return false; +} + +/* List of HIDs for which we ignore matching ACPI devices, when checking _DEP lists. */ +static const char * const acpi_ignore_dep_hids[] = { + "INT3396", /* Windows System Power Management Controller */ + NULL +}; + static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) { struct acpi_device *device = NULL; @@ -1833,13 +1855,7 @@ static void acpi_device_dep_initialize(struct acpi_device *adev) continue; } - /* - * Skip the dependency of Windows System Power - * Management Controller - */ - skip = info->valid & ACPI_VALID_HID && - !strcmp(info->hardware_id.string, "INT3396"); - + skip = acpi_info_matches_hids(info, acpi_ignore_dep_hids); kfree(info); if (skip) |