mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
ASoC: renesas: rsnd: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Message-ID: <87ikht1ypg.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
16d4b44cf0
commit
075a730b85
|
|
@ -696,25 +696,21 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||
struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
|
||||
struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
|
||||
int ret;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
guard(spinlock_irqsave)(&priv->lock);
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
case SNDRV_PCM_TRIGGER_RESUME:
|
||||
ret = rsnd_dai_call(init, io, priv);
|
||||
if (ret < 0)
|
||||
goto dai_trigger_end;
|
||||
break;
|
||||
|
||||
ret = rsnd_dai_call(start, io, priv);
|
||||
if (ret < 0)
|
||||
goto dai_trigger_end;
|
||||
break;
|
||||
|
||||
ret = rsnd_dai_call(irq, io, priv, 1);
|
||||
if (ret < 0)
|
||||
goto dai_trigger_end;
|
||||
|
||||
break;
|
||||
case SNDRV_PCM_TRIGGER_STOP:
|
||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
|
|
@ -729,9 +725,6 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
dai_trigger_end:
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1545,15 +1538,14 @@ static int rsnd_hw_update(struct snd_pcm_substream *substream,
|
|||
struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
|
||||
struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
|
||||
struct rsnd_priv *priv = rsnd_io_to_priv(io);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
guard(spinlock_irqsave)(&priv->lock);
|
||||
|
||||
if (hw_params)
|
||||
ret = rsnd_dai_call(hw_params, io, substream, hw_params);
|
||||
else
|
||||
ret = rsnd_dai_call(hw_free, io, substream);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -558,19 +558,16 @@ static void __rsnd_src_interrupt(struct rsnd_mod *mod,
|
|||
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||
bool stop = false;
|
||||
|
||||
spin_lock(&priv->lock);
|
||||
scoped_guard(spinlock, &priv->lock) {
|
||||
/* ignore all cases if not working */
|
||||
if (!rsnd_io_is_working(io))
|
||||
break;
|
||||
|
||||
/* ignore all cases if not working */
|
||||
if (!rsnd_io_is_working(io))
|
||||
goto rsnd_src_interrupt_out;
|
||||
if (rsnd_src_error_occurred(mod))
|
||||
stop = true;
|
||||
|
||||
if (rsnd_src_error_occurred(mod))
|
||||
stop = true;
|
||||
|
||||
rsnd_src_status_clear(mod);
|
||||
rsnd_src_interrupt_out:
|
||||
|
||||
spin_unlock(&priv->lock);
|
||||
rsnd_src_status_clear(mod);
|
||||
}
|
||||
|
||||
if (stop)
|
||||
snd_pcm_stop_xrun(io->substream);
|
||||
|
|
|
|||
|
|
@ -680,32 +680,31 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
|
|||
bool elapsed = false;
|
||||
bool stop = false;
|
||||
|
||||
spin_lock(&priv->lock);
|
||||
scoped_guard(spinlock, &priv->lock) {
|
||||
|
||||
/* ignore all cases if not working */
|
||||
if (!rsnd_io_is_working(io))
|
||||
goto rsnd_ssi_interrupt_out;
|
||||
/* ignore all cases if not working */
|
||||
if (!rsnd_io_is_working(io))
|
||||
break;
|
||||
|
||||
status = rsnd_ssi_status_get(mod);
|
||||
status = rsnd_ssi_status_get(mod);
|
||||
|
||||
/* PIO only */
|
||||
if (!is_dma && (status & DIRQ))
|
||||
elapsed = rsnd_ssi_pio_interrupt(mod, io);
|
||||
/* PIO only */
|
||||
if (!is_dma && (status & DIRQ))
|
||||
elapsed = rsnd_ssi_pio_interrupt(mod, io);
|
||||
|
||||
/* DMA only */
|
||||
if (is_dma && (status & (UIRQ | OIRQ))) {
|
||||
rsnd_print_irq_status(dev, "%s err status : 0x%08x\n",
|
||||
rsnd_mod_name(mod), status);
|
||||
/* DMA only */
|
||||
if (is_dma && (status & (UIRQ | OIRQ))) {
|
||||
rsnd_print_irq_status(dev, "%s err status : 0x%08x\n",
|
||||
rsnd_mod_name(mod), status);
|
||||
|
||||
stop = true;
|
||||
stop = true;
|
||||
}
|
||||
|
||||
stop |= rsnd_ssiu_busif_err_status_clear(mod);
|
||||
|
||||
rsnd_ssi_status_clear(mod);
|
||||
}
|
||||
|
||||
stop |= rsnd_ssiu_busif_err_status_clear(mod);
|
||||
|
||||
rsnd_ssi_status_clear(mod);
|
||||
rsnd_ssi_interrupt_out:
|
||||
spin_unlock(&priv->lock);
|
||||
|
||||
if (elapsed)
|
||||
snd_pcm_period_elapsed(io->substream);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user