ASoC: dapm: Fix regression introducing multiple copies of DAI widgets
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Thu, 9 Apr 2020 18:12:07 +0000 (19:12 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 14 Apr 2020 11:16:23 +0000 (12:16 +0100)
commit595571cca4dec8ac48122a6d2733f790c9a2cade
tree2b27088c0b5fdf03f0e56a2c9cd29a03a731f438
parentec21bdc6dd16d74b3674ef1fd12ae8e4e7418603
ASoC: dapm: Fix regression introducing multiple copies of DAI widgets

Refactoring was done to factor out the linking of DAI widgets into
a helper function, dapm_add_valid_dai_widget. However when this was
done, a regression was introduced for CODEC to CODEC links. It was
over looked that the playback and capture variables persisted across
all CODEC DAIs being processed, which ensured that the special DAI
widget that is added for CODEC to CODEC links was only created once.
This bug causes kernel panics during DAPM shutdown.

To stick with the spirit of the original refactoring whilst fixing the
issue, variables to hold the DAI widgets are added to snd_soc_dai_link.
Furthermore the dapm_add_valid_dai_widget function is renamed to
dapm_connect_dai_pair, the function only adds DAI widgets in the CODEC
to CODEC case and its primary job is to add routes connecting two DAI
widgets, making the original name quite misleading.

Fixes: 6c4b13b51aa3 ("ASoC: Add dapm_add_valid_dai_widget helper")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200409181209.30130-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-dapm.c