diff options
-rw-r--r-- | sound/soc/intel/common/sst-match-acpi.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c index c429e2226d40..cf2c27cd8651 100644 --- a/sound/soc/intel/common/sst-match-acpi.c +++ b/sound/soc/intel/common/sst-match-acpi.c @@ -16,14 +16,30 @@ #include "sst-acpi.h" +static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level, + void *context, void **ret) +{ + unsigned long long sta; + acpi_status status; + + *(bool *)context = true; + status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); + if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) + *(bool *)context = false; + + return AE_OK; +} + struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines) { struct sst_acpi_mach *mach; + bool found = false; for (mach = machines; mach->id[0]; mach++) - if (acpi_dev_present(mach->id)) + if (ACPI_SUCCESS(acpi_get_devices(mach->id, + sst_acpi_mach_match, + &found, NULL)) && found) return mach; - return NULL; } EXPORT_SYMBOL_GPL(sst_acpi_find_machine); |