@@ -46,8 +46,8 @@ static inline void snd_soc_dpcm_stream_lock_irq(struct snd_soc_pcm_runtime *rtd,
4646 snd_pcm_stream_lock_irq (snd_soc_dpcm_get_substream (rtd , stream ));
4747}
4848
49- #define snd_soc_dpcm_stream_lock_irqsave (rtd , stream , flags ) \
50- snd_pcm_stream_lock_irqsave (snd_soc_dpcm_get_substream(rtd, stream), flags)
49+ #define snd_soc_dpcm_stream_lock_irqsave_nested (rtd , stream , flags ) \
50+ snd_pcm_stream_lock_irqsave_nested (snd_soc_dpcm_get_substream(rtd, stream), flags)
5151
5252static inline void snd_soc_dpcm_stream_unlock_irq (struct snd_soc_pcm_runtime * rtd ,
5353 int stream )
@@ -1268,6 +1268,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe,
12681268void dpcm_be_disconnect (struct snd_soc_pcm_runtime * fe , int stream )
12691269{
12701270 struct snd_soc_dpcm * dpcm , * d ;
1271+ LIST_HEAD (deleted_dpcms );
12711272
12721273 snd_soc_dpcm_mutex_assert_held (fe );
12731274
@@ -1287,13 +1288,18 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
12871288 /* BEs still alive need new FE */
12881289 dpcm_be_reparent (fe , dpcm -> be , stream );
12891290
1290- dpcm_remove_debugfs_state (dpcm );
1291-
12921291 list_del (& dpcm -> list_be );
1292+ list_move (& dpcm -> list_fe , & deleted_dpcms );
1293+ }
1294+ snd_soc_dpcm_stream_unlock_irq (fe , stream );
1295+
1296+ while (!list_empty (& deleted_dpcms )) {
1297+ dpcm = list_first_entry (& deleted_dpcms , struct snd_soc_dpcm ,
1298+ list_fe );
12931299 list_del (& dpcm -> list_fe );
1300+ dpcm_remove_debugfs_state (dpcm );
12941301 kfree (dpcm );
12951302 }
1296- snd_soc_dpcm_stream_unlock_irq (fe , stream );
12971303}
12981304
12991305/* get BE for DAI widget and stream */
@@ -2094,7 +2100,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
20942100 be = dpcm -> be ;
20952101 be_substream = snd_soc_dpcm_get_substream (be , stream );
20962102
2097- snd_soc_dpcm_stream_lock_irqsave (be , stream , flags );
2103+ snd_soc_dpcm_stream_lock_irqsave_nested (be , stream , flags );
20982104
20992105 /* is this op for this BE ? */
21002106 if (!snd_soc_dpcm_be_can_update (fe , be , stream ))
0 commit comments