diff options
author | Cezary Rojewski <cezary.rojewski@intel.com> | 2024-04-26 11:57:26 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-04-30 00:09:46 +0900 |
commit | 31a70a71b3a730aa703bbd05713d21115dd6d33a (patch) | |
tree | c8d78ffad1d5a5a54b79566be5fae3bc32514519 | |
parent | 466c8c46b4ba763435b2a787b7824d9f0fd3e76e (diff) | |
download | linux-31a70a71b3a730aa703bbd05713d21115dd6d33a.tar.gz linux-31a70a71b3a730aa703bbd05713d21115dd6d33a.tar.bz2 linux-31a70a71b3a730aa703bbd05713d21115dd6d33a.zip |
ASoC: pcm: Reverse iterate DAIs when shutting them down
During startup snd_soc_dai_startup() is launched in ascending order and
the exact same thing is done during shutdown procedure. Reverse the
order in the latter so that it is symmetric to the former.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20240426095733.3946951-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/soc.h | 4 | ||||
-rw-r--r-- | sound/soc/soc-pcm.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 2a1b6c198547..8aa6ddb7ee1e 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1235,6 +1235,10 @@ struct snd_soc_pcm_runtime { ((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \ ((dai) = (rtd)->dais[i]); \ (i)++) +#define for_each_rtd_dais_reverse(rtd, i, dai) \ + for ((i) = (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs - 1; \ + (i) >= 0 && ((dai) = (rtd)->dais[i]); \ + (i)--) #define for_each_rtd_ch_maps(rtd, i, ch_maps) for_each_link_ch_maps(rtd->dai_link, i, ch_maps) void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index b0e1bd7f588b..711b2f49ed88 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -724,7 +724,7 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd, } } - for_each_rtd_dais(rtd, i, dai) + for_each_rtd_dais_reverse(rtd, i, dai) snd_soc_dai_shutdown(dai, substream, rollback); snd_soc_link_shutdown(substream, rollback); |