[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e6cf92f-b889-aed9-b13a-615d4d5f9b93@intel.com>
Date: Thu, 7 Oct 2021 19:05:39 +0200
From: Cezary Rojewski <cezary.rojewski@...el.com>
To: Brent Lu <brent.lu@...el.com>, <alsa-devel@...a-project.org>
CC: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
"Pierre-Louis Bossart" <pierre-louis.bossart@...ux.intel.com>,
Jie Yang <yang.jie@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Guennadi Liakhovetski <guennadi.liakhovetski@...ux.intel.com>,
Yong Zhi <yong.zhi@...el.com>,
Vamshi Krishna Gopal <vamshi.krishna.gopal@...el.com>,
<linux-kernel@...r.kernel.org>,
Rander Wang <rander.wang@...el.com>,
"Bard Liao" <bard.liao@...el.com>,
Malik_Hsu <malik_hsu@...tron.corp-partner.google.com>,
Libin Yang <libin.yang@...el.com>,
Hans de Goede <hdegoede@...hat.com>,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
Paul Olaru <paul.olaru@....nxp.com>,
"Curtis Malainey" <cujomalainey@...omium.org>,
Mac Chiang <mac.chiang@...el.com>,
Gongjun Song <gongjun.song@...el.com>
Subject: Re: [PATCH v2 1/3] ASoC: soc-acpi: add comp_ids field for machine
driver matching
On 2021-10-07 3:35 PM, Brent Lu wrote:
...
>
> +static bool snd_soc_acpi_id_present(struct snd_soc_acpi_mach *machine)
> +{
> + struct snd_soc_acpi_codecs *comp_ids = machine->comp_ids;
> + int i;
> +
> + if (machine->id[0]) {
> + if (acpi_dev_present(machine->id, NULL, -1))
> + return true;
> + }
> +
> + if (comp_ids) {
> + for (i = 0; i < comp_ids->num_codecs; i++) {
> + if (acpi_dev_present(comp_ids->codecs[i], NULL, -1))
> + return true;
> + }
> + }
> +
> + return false;
> +}
In cover letter you mention:
"- can use 'comp_ids' field alone to enumerate driver"
which leads me to an opinion that field 'id' should be removed,
entirely. With 'comp_ids' added, 'id' is basically rendered
optional/redundant.
> +
> struct snd_soc_acpi_mach *
> snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
> {
> struct snd_soc_acpi_mach *mach;
> struct snd_soc_acpi_mach *mach_alt;
>
> - for (mach = machines; mach->id[0]; mach++) {
> - if (acpi_dev_present(mach->id, NULL, -1)) {
> + for (mach = machines; mach->id[0] || mach->comp_ids; mach++) {
Such loops are hard to maintain i.e. 'comp_ids' acts here like a flex
array that follows 'id'. Removal of 'id' field and streamlining code to
only use 'comp_ids' should make this loop more intuitive.
> + if (snd_soc_acpi_id_present(mach)) {
> if (mach->machine_quirk) {
> mach_alt = mach->machine_quirk(mach);
> if (!mach_alt)
>
Powered by blists - more mailing lists