From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Cezary Rojewski <cezary.rojewski@intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Nathan Chancellor <nathan@kernel.org>, Tom Rix <trix@redhat.com>,
patches@lists.linux.dev, alsa-devel@alsa-project.org,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: Intel: avs: Mark avs_path_module_type_create() as noinline
Date: Thu, 21 Jul 2022 17:28:09 +0200 [thread overview]
Message-ID: <d8e8e5e5-001d-5f22-b22c-aaea16ed8719@linux.intel.com> (raw)
In-Reply-To: <YtllwRY6F93uYRxz@sirena.org.uk>
On 7/21/2022 4:42 PM, Mark Brown wrote:
> On Thu, Jul 21, 2022 at 02:25:20PM +0200, Amadeusz Sławiński wrote:
>> On 7/20/2022 8:52 PM, Nathan Chancellor wrote:
>
>>> This warning is also visible with allmodconfig on other architectures.
>
>> My first question would be what clang does differently in this configuration
>> (ARM) than in all other configurations (x86, etc.) and gcc.
>
> See above from Nathan's commit message...
Ah, missed that. Anyway, what about if we replace multiple calls to
guid_equal with lookup table and one call in loop?
Do let me know if something like the following works and I will send it
as a proper patch:
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 3d46dd5e5bc4..ce157a8d6552 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -449,35 +449,39 @@ static int avs_modext_create(struct avs_dev *adev,
struct avs_path_module *mod)
return ret;
}
+static int avs_probe_create(struct avs_dev *adev, struct
avs_path_module *mod)
+{
+ dev_err(adev->dev, "Probe module can't be instantiated by
topology");
+ return -EINVAL;
+}
+
+struct avs_module_create {
+ guid_t *guid;
+ int (*create)(struct avs_dev *adev, struct avs_path_module *mod);
+};
+
+static struct avs_module_create avs_module_create[] = {
+ { &AVS_MIXIN_MOD_UUID, avs_modbase_create },
+ { &AVS_MIXOUT_MOD_UUID, avs_modbase_create },
+ { &AVS_KPBUFF_MOD_UUID, avs_modbase_create },
+ { &AVS_COPIER_MOD_UUID, avs_copier_create },
+ { &AVS_MICSEL_MOD_UUID, avs_micsel_create },
+ { &AVS_MUX_MOD_UUID, avs_mux_create },
+ { &AVS_UPDWMIX_MOD_UUID, avs_updown_mix_create },
+ { &AVS_SRCINTC_MOD_UUID, avs_src_create },
+ { &AVS_AEC_MOD_UUID, avs_aec_create },
+ { &AVS_ASRC_MOD_UUID, avs_asrc_create },
+ { &AVS_INTELWOV_MOD_UUID, avs_wov_create },
+ { &AVS_PROBE_MOD_UUID, avs_probe_create },
+};
+
static int avs_path_module_type_create(struct avs_dev *adev, struct
avs_path_module *mod)
{
const guid_t *type = &mod->template->cfg_ext->type;
- if (guid_equal(type, &AVS_MIXIN_MOD_UUID) ||
- guid_equal(type, &AVS_MIXOUT_MOD_UUID) ||
- guid_equal(type, &AVS_KPBUFF_MOD_UUID))
- return avs_modbase_create(adev, mod);
- if (guid_equal(type, &AVS_COPIER_MOD_UUID))
- return avs_copier_create(adev, mod);
- if (guid_equal(type, &AVS_MICSEL_MOD_UUID))
- return avs_micsel_create(adev, mod);
- if (guid_equal(type, &AVS_MUX_MOD_UUID))
- return avs_mux_create(adev, mod);
- if (guid_equal(type, &AVS_UPDWMIX_MOD_UUID))
- return avs_updown_mix_create(adev, mod);
- if (guid_equal(type, &AVS_SRCINTC_MOD_UUID))
- return avs_src_create(adev, mod);
- if (guid_equal(type, &AVS_AEC_MOD_UUID))
- return avs_aec_create(adev, mod);
- if (guid_equal(type, &AVS_ASRC_MOD_UUID))
- return avs_asrc_create(adev, mod);
- if (guid_equal(type, &AVS_INTELWOV_MOD_UUID))
- return avs_wov_create(adev, mod);
-
- if (guid_equal(type, &AVS_PROBE_MOD_UUID)) {
- dev_err(adev->dev, "Probe module can't be instantiated
by topology");
- return -EINVAL;
- }
+ for (int i = 0; i < ARRAY_SIZE(avs_module_create); i++)
+ if (guid_equal(type, avs_module_create[i].guid))
+ return avs_module_create[i].create(adev, mod);
return avs_modext_create(adev, mod);
}
next prev parent reply other threads:[~2022-07-21 15:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 18:52 [PATCH] ASoC: Intel: avs: Mark avs_path_module_type_create() as noinline Nathan Chancellor
2022-07-21 12:25 ` Amadeusz Sławiński
2022-07-21 14:42 ` Mark Brown
2022-07-21 15:28 ` Amadeusz Sławiński [this message]
2022-07-21 15:40 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d8e8e5e5-001d-5f22-b22c-aaea16ed8719@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=patches@lists.linux.dev \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=trix@redhat.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox