Skip to content

Commit 31a70a7

Browse files
crojewsk-intelbroonie
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 466c8c4 commit 31a70a7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/sound/soc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,10 @@ struct snd_soc_pcm_runtime {
12351235
((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \
12361236
((dai) = (rtd)->dais[i]); \
12371237
(i)++)
1238+
#define for_each_rtd_dais_reverse(rtd, i, dai) \
1239+
for ((i) = (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs - 1; \
1240+
(i) >= 0 && ((dai) = (rtd)->dais[i]); \
1241+
(i)--)
12381242
#define for_each_rtd_ch_maps(rtd, i, ch_maps) for_each_link_ch_maps(rtd->dai_link, i, ch_maps)
12391243

12401244
void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);

sound/soc/soc-pcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd,
724724
}
725725
}
726726

727-
for_each_rtd_dais(rtd, i, dai)
727+
for_each_rtd_dais_reverse(rtd, i, dai)
728728
snd_soc_dai_shutdown(dai, substream, rollback);
729729

730730
snd_soc_link_shutdown(substream, rollback);

0 commit comments

Comments
 (0)