On Wed, Oct 6, 2021 at 7:21 PM Brent Lu <brent.lu@xxxxxxxxx> wrote: > > Current design to support second headphone driver in the same machine > driver is to duplicate the entries in snd_soc_acpi_mach array and > board configs in machine driver. We can avoid this by adding an id_alt > field in snd_soc_acpi_mach structure to specify alternative ACPI HIDs > for machine driver enumeration and leave the codec type detection to > machine driver if necessary. ... > +static bool snd_soc_acpi_id_present(struct snd_soc_acpi_mach *machine) > +{ > + struct snd_soc_acpi_codecs *id_alt = machine->id_alt; > + int i; > + > + if (acpi_dev_present(machine->id, NULL, -1)) > + return true; > + > + if (id_alt == NULL) > + return false; > + > + for (i = 0; i < id_alt->num_codecs; i++) { > + if (acpi_dev_present(id_alt->codecs[i], NULL, -1)) > + return true; > + } > + > + return false; > +} Wondering if you may modify data structure in a way that makes it possible to use for_each_acpi_dev_match(). ... > + if (snd_soc_acpi_id_present(mach) != false) { ' != fase' is redundant. -- With Best Regards, Andy Shevchenko