[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211013143050.244444-9-pierre-louis.bossart@linux.intel.com>
Date: Wed, 13 Oct 2021 09:30:45 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: alsa-devel@...a-project.org
Cc: tiwai@...e.de, broonie@...nel.org, vkoul@...nel.org,
Sameer Pujar <spujar@...dia.com>,
Gyeongtaek Lee <gt82.lee@...sung.com>,
Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [RFC PATCH v3 08/13] ASoC: soc-compress: protect for_each_dpcm_be() loops
Follow the locking model used within soc-pcm.c
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
---
sound/soc/soc-compress.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 8e2494a9f3a7..a1fc4083c88a 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -158,8 +158,10 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
ret = dpcm_be_dai_startup(fe, stream);
if (ret < 0) {
/* clean up all links */
+ snd_soc_dpcm_fe_lock_irq(fe, stream);
for_each_dpcm_be(fe, stream, dpcm)
dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
+ snd_soc_dpcm_fe_unlock_irq(fe, stream);
dpcm_be_disconnect(fe, stream);
fe->dpcm[stream].runtime = NULL;
@@ -224,8 +226,10 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
dpcm_be_dai_shutdown(fe, stream);
/* mark FE's links ready to prune */
+ snd_soc_dpcm_fe_lock_irq(fe, stream);
for_each_dpcm_be(fe, stream, dpcm)
dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
+ snd_soc_dpcm_fe_unlock_irq(fe, stream);
dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
--
2.25.1
Powered by blists - more mailing lists