Commit 4c38f874 authored by Mark Brown's avatar Mark Brown

ASoC DPCM lockdep fixes

Merge series from Takashi Iwai <tiwai@suse.de>:

This is the revised patches for addressing ASoC lockdep warnings due
to the recent DPCM locking refactoring.
parents 4045daf0 9f620684
...@@ -614,6 +614,7 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); ...@@ -614,6 +614,7 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream);
/** /**
* snd_pcm_stream_lock_irqsave - Lock the PCM stream * snd_pcm_stream_lock_irqsave - Lock the PCM stream
...@@ -632,6 +633,20 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); ...@@ -632,6 +633,20 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
unsigned long flags); unsigned long flags);
/**
* snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking
* @substream: PCM substream
* @flags: irq flags
*
* This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with
* the single-depth lockdep subclass.
*/
#define snd_pcm_stream_lock_irqsave_nested(substream, flags) \
do { \
typecheck(unsigned long, flags); \
flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
} while (0)
/** /**
* snd_pcm_group_for_each_entry - iterate over the linked substreams * snd_pcm_group_for_each_entry - iterate over the linked substreams
* @s: the iterator * @s: the iterator
......
...@@ -172,6 +172,19 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream) ...@@ -172,6 +172,19 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream)
} }
EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave);
unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream)
{
unsigned long flags = 0;
if (substream->pcm->nonatomic)
mutex_lock_nested(&substream->self_group.mutex,
SINGLE_DEPTH_NESTING);
else
spin_lock_irqsave_nested(&substream->self_group.lock, flags,
SINGLE_DEPTH_NESTING);
return flags;
}
EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave_nested);
/** /**
* snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream * snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream
* @substream: PCM substream * @substream: PCM substream
......
...@@ -46,8 +46,8 @@ static inline void snd_soc_dpcm_stream_lock_irq(struct snd_soc_pcm_runtime *rtd, ...@@ -46,8 +46,8 @@ static inline void snd_soc_dpcm_stream_lock_irq(struct snd_soc_pcm_runtime *rtd,
snd_pcm_stream_lock_irq(snd_soc_dpcm_get_substream(rtd, stream)); snd_pcm_stream_lock_irq(snd_soc_dpcm_get_substream(rtd, stream));
} }
#define snd_soc_dpcm_stream_lock_irqsave(rtd, stream, flags) \ #define snd_soc_dpcm_stream_lock_irqsave_nested(rtd, stream, flags) \
snd_pcm_stream_lock_irqsave(snd_soc_dpcm_get_substream(rtd, stream), flags) snd_pcm_stream_lock_irqsave_nested(snd_soc_dpcm_get_substream(rtd, stream), flags)
static inline void snd_soc_dpcm_stream_unlock_irq(struct snd_soc_pcm_runtime *rtd, static inline void snd_soc_dpcm_stream_unlock_irq(struct snd_soc_pcm_runtime *rtd,
int stream) int stream)
...@@ -1268,6 +1268,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, ...@@ -1268,6 +1268,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe,
void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
{ {
struct snd_soc_dpcm *dpcm, *d; struct snd_soc_dpcm *dpcm, *d;
LIST_HEAD(deleted_dpcms);
snd_soc_dpcm_mutex_assert_held(fe); snd_soc_dpcm_mutex_assert_held(fe);
...@@ -1287,13 +1288,18 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -1287,13 +1288,18 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
/* BEs still alive need new FE */ /* BEs still alive need new FE */
dpcm_be_reparent(fe, dpcm->be, stream); dpcm_be_reparent(fe, dpcm->be, stream);
dpcm_remove_debugfs_state(dpcm);
list_del(&dpcm->list_be); list_del(&dpcm->list_be);
list_move(&dpcm->list_fe, &deleted_dpcms);
}
snd_soc_dpcm_stream_unlock_irq(fe, stream);
while (!list_empty(&deleted_dpcms)) {
dpcm = list_first_entry(&deleted_dpcms, struct snd_soc_dpcm,
list_fe);
list_del(&dpcm->list_fe); list_del(&dpcm->list_fe);
dpcm_remove_debugfs_state(dpcm);
kfree(dpcm); kfree(dpcm);
} }
snd_soc_dpcm_stream_unlock_irq(fe, stream);
} }
/* get BE for DAI widget and stream */ /* get BE for DAI widget and stream */
...@@ -2094,7 +2100,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, ...@@ -2094,7 +2100,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
be = dpcm->be; be = dpcm->be;
be_substream = snd_soc_dpcm_get_substream(be, stream); be_substream = snd_soc_dpcm_get_substream(be, stream);
snd_soc_dpcm_stream_lock_irqsave(be, stream, flags); snd_soc_dpcm_stream_lock_irqsave_nested(be, stream, flags);
/* is this op for this BE ? */ /* is this op for this BE ? */
if (!snd_soc_dpcm_be_can_update(fe, be, stream)) if (!snd_soc_dpcm_be_can_update(fe, be, stream))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment