ASoC: Intel: Create a helper to search for matching machine
Create a helper function to search for a matching machine based on HID. No functional change Signed-off-by: Naveen M <naveen.m@intel.com> Signed-off-by: Harsha Priya <harshapriya.n@intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
9bf70cd4cd
commit
915ae2b9f0
|
@ -43,6 +43,9 @@ static inline bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
|
||||||
/* acpi match */
|
/* acpi match */
|
||||||
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
|
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
|
||||||
|
|
||||||
|
/* acpi check hid */
|
||||||
|
bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
|
||||||
|
|
||||||
/* Descriptor for SST ASoC machine driver */
|
/* Descriptor for SST ASoC machine driver */
|
||||||
struct sst_acpi_mach {
|
struct sst_acpi_mach {
|
||||||
/* ACPI ID for the matching machine driver. Audio codec for instance */
|
/* ACPI ID for the matching machine driver. Audio codec for instance */
|
||||||
|
|
|
@ -63,15 +63,26 @@ static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
|
||||||
|
{
|
||||||
|
acpi_status status;
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
status = acpi_get_devices(hid, sst_acpi_mach_match, &found, NULL);
|
||||||
|
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(sst_acpi_check_hid);
|
||||||
|
|
||||||
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
|
struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
|
||||||
{
|
{
|
||||||
struct sst_acpi_mach *mach;
|
struct sst_acpi_mach *mach;
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
for (mach = machines; mach->id[0]; mach++)
|
for (mach = machines; mach->id[0]; mach++)
|
||||||
if (ACPI_SUCCESS(acpi_get_devices(mach->id,
|
if (sst_acpi_check_hid(mach->id) == true)
|
||||||
sst_acpi_mach_match,
|
|
||||||
&found, NULL)) && found)
|
|
||||||
return mach;
|
return mach;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue