[alsa-devel] [PATCH 7/7] ASoC: Instantiate all DAPM widgets at once

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Apr 28 22:07:37 CEST 2011

On Thu, Apr 28, 2011 at 06:46:13PM +0200, Lars-Peter Clausen wrote:
> Currently after each codec or auxdev has been probed its DAPM widgets are
> instantiated.
> Since widgets are kept in a per card list and routes can interconnect between
> widgets from different DAPM contexts on the same card it is possible that
> snd_soc_dapm_new_widgets is run on an incomplete DAPM configuration which might
> cause unnecessary register writes and/or cause audible problems.
> This patch addresses the issue by instantiating all widgets from all DAPM contexts
> after all components of the card have been initialized.

Except it doesn't because...

> +static inline int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
> +{
> +	return snd_soc_dapm_card_new_widgets(dapm->card);
> +}

...we can still instantiate widgets at any time, and lots of code will
do just that (and needs to do that because it needs the widgets to be
present in order to allow paths to be added).

There's also the fact that this mixes in the functional change to move
the instantiation of the widgets around with the argument change and a
rename, it'd be better to split the two of those out so we can clearly
see the functional change.

More information about the Alsa-devel mailing list