Re: [PATCH 1/3] ASoC: soc-acpi: add alternative id field for machine driver matching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux