[PATCH 5/6] ASoC: soc-pcm: cleanup soc_pcm_params_symmetry()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Fri Dec 18 07:51:09 CET 2020
Hi Mark
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
>
> soc_pcm_params_symmetry() checks rate/channel/sample_bits state.
> These are very similar but different, thus, it needs to have very
> verbose code.
> This patch use macro for it and make code more simple.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
(snip)
> +#define __soc_pcm_params_symmetry(name, sname) \
> + symmetry = rtd->dai_link->symmetric_##sname; \
> + for_each_rtd_dais(rtd, i, dai) \
> + symmetry |= dai->driver->symmetric_##sname; \
> + \
> + if (symmetry) \
> + for_each_rtd_cpu_dais(rtd, i, cpu_dai) \
> + if (cpu_dai->name && cpu_dai->name != d.name) { \
> + dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %d - %d\n", \
> + #name, cpu_dai->name, d.name); \
> + return -EINVAL; \
> }
> - }
> - }
>
(snip)
> + /* reject unmatched parameters when applying symmetry */
> + __soc_pcm_params_symmetry(rate, rates);
> + __soc_pcm_params_symmetry(channels, channels);
> + __soc_pcm_params_symmetry(sample_bits, samplebits);
Not a big deal, but I'm happy if we can use same naming rule
for same things.
rtd->dai_link->symmetric_samplebits;
^^^^^^^^^^
dai->driver->symmetric_samplebits;
^^^^^^^^^^
cpu_dai->sample_bits
^^^^^^^^^^^
__soc_pcm_params_symmetry(rate, rates);
^^^^^ ^^^^^
__soc_pcm_params_symmetry(sample_bits, samplebits);
^^^^^^^^^^^ ^^^^^^^^^^
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list