mirror of
https://github.com/torvalds/linux.git
synced 2025-11-30 23:16:01 +07:00
ALSA: arm: Use guard() for spin locks
Clean up the code using guard() for spin locks. Merely code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -210,8 +210,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock(&aacirun->lock);
|
||||
|
||||
scoped_guard(spinlock, &aacirun->lock) {
|
||||
ptr = aacirun->ptr;
|
||||
do {
|
||||
unsigned int len = aacirun->fifo_bytes;
|
||||
@@ -247,8 +246,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
|
||||
} while(1);
|
||||
|
||||
aacirun->ptr = ptr;
|
||||
|
||||
spin_unlock(&aacirun->lock);
|
||||
}
|
||||
|
||||
if (period_elapsed)
|
||||
snd_pcm_period_elapsed(aacirun->substream);
|
||||
@@ -270,8 +268,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock(&aacirun->lock);
|
||||
|
||||
scoped_guard(spinlock, &aacirun->lock) {
|
||||
ptr = aacirun->ptr;
|
||||
do {
|
||||
unsigned int len = aacirun->fifo_bytes;
|
||||
@@ -307,8 +304,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
|
||||
} while (1);
|
||||
|
||||
aacirun->ptr = ptr;
|
||||
|
||||
spin_unlock(&aacirun->lock);
|
||||
}
|
||||
|
||||
if (period_elapsed)
|
||||
snd_pcm_period_elapsed(aacirun->substream);
|
||||
@@ -577,10 +573,8 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun)
|
||||
static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct aaci_runtime *aacirun = substream->runtime->private_data;
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&aacirun->lock, flags);
|
||||
guard(spinlock_irqsave)(&aacirun->lock);
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
@@ -606,12 +600,10 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&aacirun->lock, flags);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_pcm_ops aaci_playback_ops = {
|
||||
@@ -661,10 +653,8 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
|
||||
static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct aaci_runtime *aacirun = substream->runtime->private_data;
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
spin_lock_irqsave(&aacirun->lock, flags);
|
||||
guard(spinlock_irqsave)(&aacirun->lock);
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
@@ -690,12 +680,10 @@ static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&aacirun->lock, flags);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aaci_pcm_capture_prepare(struct snd_pcm_substream *substream)
|
||||
|
||||
Reference in New Issue
Block a user