}
 EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq);
 
+static void snd_pcm_stream_lock_nested(struct snd_pcm_substream *substream)
+{
+       struct snd_pcm_group *group = &substream->self_group;
+
+       if (substream->pcm->nonatomic)
+               mutex_lock_nested(&group->mutex, SINGLE_DEPTH_NESTING);
+       else
+               spin_lock_nested(&group->lock, SINGLE_DEPTH_NESTING);
+}
+
 /**
  * snd_pcm_stream_unlock_irq - Unlock the PCM stream
  * @substream: PCM substream
        snd_pcm_stream_unlock_irq(substream);
 
        snd_pcm_group_lock_irq(target_group, nonatomic);
-       snd_pcm_stream_lock(substream1);
+       snd_pcm_stream_lock_nested(substream1);
        snd_pcm_group_assign(substream1, target_group);
        refcount_inc(&target_group->refs);
        snd_pcm_stream_unlock(substream1);
 
 static void relink_to_local(struct snd_pcm_substream *substream)
 {
-       snd_pcm_stream_lock(substream);
+       snd_pcm_stream_lock_nested(substream);
        snd_pcm_group_assign(substream, &substream->self_group);
        snd_pcm_stream_unlock(substream);
 }