[alsa-devel] [PATCH] ASoC: dapm: Avoid creating kcontrol for params

anish kumar yesanishhere at gmail.com
Mon Aug 21 20:36:24 CEST 2017


>
> When num_params is defined as one in case of
> codec to codec dai link, there is no point in
> allocating memory for kcontrol.
>
> Signed-off-by: anish kumar <yesanishhere at gmail.com>
> ---
>  include/sound/soc-dapm.h |   1 -
>  sound/soc/soc-dapm.c     | 147 ++++++++++++++++++++++++-----------------------

>>This is a very big change and that commit log doesn't describe it in any
>>detail or really motivate it.  What exactly does this do and why?

Currently in codec to codec dai link if there are multiple params defined then
dapm can use created kcontrol to decide which param to apply at runtime.

However, in case there is only single param configuration then there is no
point in creating the kcontrol (this is currently happening) and also there
is no point in allocating memory for kcontrol.

In the snd_soc_dapm_new_pcm function, there is memory allocation happening
for kcontrol which is later used or not used based on num_param. It is better
to not allocate memory when there is only a single configuration. This change
is to remedy that anomaly and also it remove unnecessary checks.


More information about the Alsa-devel mailing list