mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
ASoC: fsl: mpc5200_dma: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260615093824.115751-11-phucduc.bui@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
11ce4dd4e7
commit
caed9fb2e4
|
|
@ -77,18 +77,20 @@ static irqreturn_t psc_dma_bcom_irq(int irq, void *_psc_dma_stream)
|
|||
{
|
||||
struct psc_dma_stream *s = _psc_dma_stream;
|
||||
|
||||
spin_lock(&s->psc_dma->lock);
|
||||
/* For each finished period, dequeue the completed period buffer
|
||||
* and enqueue a new one in it's place. */
|
||||
while (bcom_buffer_done(s->bcom_task)) {
|
||||
bcom_retrieve_buffer(s->bcom_task, NULL, NULL);
|
||||
scoped_guard(spinlock, &s->psc_dma->lock) {
|
||||
/*
|
||||
* For each finished period, dequeue the completed period buffer
|
||||
* and enqueue a new one in its place
|
||||
*/
|
||||
while (bcom_buffer_done(s->bcom_task)) {
|
||||
bcom_retrieve_buffer(s->bcom_task, NULL, NULL);
|
||||
|
||||
s->period_current = (s->period_current+1) % s->runtime->periods;
|
||||
s->period_count++;
|
||||
s->period_current = (s->period_current+1) % s->runtime->periods;
|
||||
s->period_count++;
|
||||
|
||||
psc_dma_bcom_enqueue_next_buffer(s);
|
||||
psc_dma_bcom_enqueue_next_buffer(s);
|
||||
}
|
||||
}
|
||||
spin_unlock(&s->psc_dma->lock);
|
||||
|
||||
/* If the stream is active, then also inform the PCM middle layer
|
||||
* of the period finished event. */
|
||||
|
|
@ -116,7 +118,6 @@ static int psc_dma_trigger(struct snd_soc_component *component,
|
|||
struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma);
|
||||
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
|
||||
u16 imr;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
switch (cmd) {
|
||||
|
|
@ -135,19 +136,18 @@ static int psc_dma_trigger(struct snd_soc_component *component,
|
|||
/* Fill up the bestcomm bd queue and enable DMA.
|
||||
* This will begin filling the PSC's fifo.
|
||||
*/
|
||||
spin_lock_irqsave(&psc_dma->lock, flags);
|
||||
scoped_guard(spinlock_irqsave, &psc_dma->lock) {
|
||||
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
bcom_gen_bd_rx_reset(s->bcom_task);
|
||||
else
|
||||
bcom_gen_bd_tx_reset(s->bcom_task);
|
||||
|
||||
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
bcom_gen_bd_rx_reset(s->bcom_task);
|
||||
else
|
||||
bcom_gen_bd_tx_reset(s->bcom_task);
|
||||
for (i = 0; i < runtime->periods; i++)
|
||||
if (!bcom_queue_full(s->bcom_task))
|
||||
psc_dma_bcom_enqueue_next_buffer(s);
|
||||
|
||||
for (i = 0; i < runtime->periods; i++)
|
||||
if (!bcom_queue_full(s->bcom_task))
|
||||
psc_dma_bcom_enqueue_next_buffer(s);
|
||||
|
||||
bcom_enable(s->bcom_task);
|
||||
spin_unlock_irqrestore(&psc_dma->lock, flags);
|
||||
bcom_enable(s->bcom_task);
|
||||
}
|
||||
|
||||
out_8(®s->command, MPC52xx_PSC_RST_ERR_STAT);
|
||||
|
||||
|
|
@ -158,13 +158,13 @@ static int psc_dma_trigger(struct snd_soc_component *component,
|
|||
substream->pstr->stream, s->period_count);
|
||||
s->active = 0;
|
||||
|
||||
spin_lock_irqsave(&psc_dma->lock, flags);
|
||||
bcom_disable(s->bcom_task);
|
||||
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
bcom_gen_bd_rx_reset(s->bcom_task);
|
||||
else
|
||||
bcom_gen_bd_tx_reset(s->bcom_task);
|
||||
spin_unlock_irqrestore(&psc_dma->lock, flags);
|
||||
scoped_guard(spinlock_irqsave, &psc_dma->lock) {
|
||||
bcom_disable(s->bcom_task);
|
||||
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
|
||||
bcom_gen_bd_rx_reset(s->bcom_task);
|
||||
else
|
||||
bcom_gen_bd_tx_reset(s->bcom_task);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user