Commit c04fe2ec authored by Philippe Gerum's avatar Philippe Gerum
Browse files

ASoC: dpcm: evl: switch to hard spinlock



Use locks which may be shared between the inband and out-of-band
stages. The critical sections they protect are short enough to allow
that.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 605ea295
......@@ -1004,7 +1004,7 @@ struct snd_soc_card {
struct mutex pcm_mutex;
enum snd_soc_pcm_subclass pcm_subclass;
spinlock_t dpcm_lock;
hard_spinlock_t dpcm_lock;
int (*probe)(struct snd_soc_card *card);
int (*late_probe)(struct snd_soc_card *card);
......
......@@ -2182,7 +2182,7 @@ int snd_soc_register_card(struct snd_soc_card *card)
mutex_init(&card->mutex);
mutex_init(&card->dapm_mutex);
mutex_init(&card->pcm_mutex);
spin_lock_init(&card->dpcm_lock);
raw_spin_lock_init(&card->dpcm_lock);
return snd_soc_bind_card(card);
}
......
......@@ -92,7 +92,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
goto out;
}
spin_lock_irqsave(&fe->card->dpcm_lock, flags);
raw_spin_lock_irqsave(&fe->card->dpcm_lock, flags);
for_each_dpcm_be(fe, stream, dpcm) {
struct snd_soc_pcm_runtime *be = dpcm->be;
params = &dpcm->hw_params;
......@@ -113,7 +113,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
params_channels(params),
params_rate(params));
}
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
raw_spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
out:
return offset;
}
......@@ -1231,10 +1231,10 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
dpcm->fe = fe;
be->dpcm[stream].runtime = fe->dpcm[stream].runtime;
dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW;
spin_lock_irqsave(&fe->card->dpcm_lock, flags);
raw_spin_lock_irqsave(&fe->card->dpcm_lock, flags);
list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients);
list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients);
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
raw_spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n",
stream ? "capture" : "playback", fe->dai_link->name,
......@@ -1296,10 +1296,10 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
dpcm_remove_debugfs_state(dpcm);
spin_lock_irqsave(&fe->card->dpcm_lock, flags);
raw_spin_lock_irqsave(&fe->card->dpcm_lock, flags);
list_del(&dpcm->list_be);
list_del(&dpcm->list_fe);
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
raw_spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
kfree(dpcm);
}
}
......@@ -1513,11 +1513,11 @@ void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream)
struct snd_soc_dpcm *dpcm;
unsigned long flags;
spin_lock_irqsave(&fe->card->dpcm_lock, flags);
raw_spin_lock_irqsave(&fe->card->dpcm_lock, flags);
for_each_dpcm_be(fe, stream, dpcm)
dpcm->be->dpcm[stream].runtime_update =
SND_SOC_DPCM_UPDATE_NO;
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
raw_spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
}
static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe,
......@@ -2612,13 +2612,13 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
dpcm_be_dai_shutdown(fe, stream);
disconnect:
/* disconnect any closed BEs */
spin_lock_irqsave(&fe->card->dpcm_lock, flags);
raw_spin_lock_irqsave(&fe->card->dpcm_lock, flags);
for_each_dpcm_be(fe, stream, dpcm) {
struct snd_soc_pcm_runtime *be = dpcm->be;
if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE)
dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
}
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
raw_spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
return ret;
}
......@@ -3010,7 +3010,7 @@ static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe,
unsigned long flags;
int i;
spin_lock_irqsave(&fe->card->dpcm_lock, flags);
raw_spin_lock_irqsave(&fe->card->dpcm_lock, flags);
for_each_dpcm_fe(be, stream, dpcm) {
if (dpcm->fe == fe)
......@@ -3024,7 +3024,7 @@ static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe,
}
}
}
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
raw_spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
/* it's safe to do this BE DAI */
return ret;
......
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