Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	tiwai@suse.com, perex@perex.cz,
	amadeuszx.slawinski@linux.intel.com,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 1/8] ASoC: pcm: Reverse iterate DAIs when shutting them down
Date: Fri, 26 Apr 2024 11:57:26 +0200	[thread overview]
Message-ID: <20240426095733.3946951-2-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20240426095733.3946951-1-cezary.rojewski@intel.com>

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>
---
 include/sound/soc.h | 4 ++++
 sound/soc/soc-pcm.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0376f7e4c15d..a4747c3d0856 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1225,6 +1225,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);
-- 
2.25.1


  reply	other threads:[~2024-04-26  9:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  9:57 [PATCH 0/8] ASoC: Intel: avs: PCM code cleanup Cezary Rojewski
2024-04-26  9:57 ` Cezary Rojewski [this message]
2024-04-26  9:57 ` [PATCH 2/8] ASoC: Intel: avs: Relocate HDA BE DAI specific operations Cezary Rojewski
2024-04-26  9:57 ` [PATCH 3/8] ASoC: Intel: avs: Remove redundancy around DAI shutdown Cezary Rojewski
2024-04-26  9:57 ` [PATCH 4/8] ASoC: Intel: avs: Store pointer to adev in DAI dma_data Cezary Rojewski
2024-04-26  9:57 ` [PATCH 5/8] ASoC: Intel: avs: Remove redundancy around DAI startup Cezary Rojewski
2024-04-26  9:57 ` [PATCH 6/8] ASoC: Intel: avs: Remove redundancy around DAI prepare Cezary Rojewski
2024-04-26  9:57 ` [PATCH 7/8] ASoC: Intel: avs: Store pointer to link_stream in dma_data Cezary Rojewski
2024-04-26  9:57 ` [PATCH 8/8] ASoC: Intel: avs: Clean up hw constraints initialization Cezary Rojewski
2024-05-01 13:43 ` [PATCH 0/8] ASoC: Intel: avs: PCM code cleanup Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240426095733.3946951-2-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox