struct idma_ctrl *prtd = substream->runtime->private_data;
u32 val;
- spin_lock(&prtd->lock);
- prtd->token = (void *) substream;
- spin_unlock(&prtd->lock);
+ scoped_guard(spinlock, &prtd->lock)
+ prtd->token = (void *) substream;
/* Internal DMA Level0 Interrupt Address */
val = idma.lp_tx_addr + prtd->periodsz;
{
struct idma_ctrl *prtd = substream->runtime->private_data;
- spin_lock(&prtd->lock);
+ guard(spinlock)(&prtd->lock);
prtd->cb = cb;
- spin_unlock(&prtd->lock);
}
static void idma_control(int op)
{
u32 val = readl(idma.regs + I2SAHB);
- spin_lock(&idma.lock);
+ guard(spinlock)(&idma.lock);
switch (op) {
case LPAM_DMA_START:
val &= ~(AHB_INTENLVL0 | AHB_DMAEN);
break;
default:
- spin_unlock(&idma.lock);
return;
}
writel(val, idma.regs + I2SAHB);
- spin_unlock(&idma.lock);
}
static void idma_done(void *id, int bytes_xfer)
struct idma_ctrl *prtd = substream->runtime->private_data;
int ret = 0;
- spin_lock(&prtd->lock);
+ guard(spinlock)(&prtd->lock);
switch (cmd) {
case SNDRV_PCM_TRIGGER_RESUME:
break;
}
- spin_unlock(&prtd->lock);
-
return ret;
}
dma_addr_t src;
unsigned long res;
- spin_lock(&prtd->lock);
-
- idma_getpos(&src);
- res = src - prtd->start;
-
- spin_unlock(&prtd->lock);
+ scoped_guard(spinlock, &prtd->lock) {
+ idma_getpos(&src);
+ res = src - prtd->start;
+ }
return bytes_to_frames(substream->runtime, res);
}