ALSA: sgio2audio: 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>pull/476/head
parent
2d7d8e0fa5
commit
f5bf18b076
|
|
@ -103,9 +103,8 @@ static int read_ad1843_reg(void *priv, int reg)
|
|||
{
|
||||
struct snd_sgio2audio *chip = priv;
|
||||
int val;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->ad1843_lock, flags);
|
||||
guard(spinlock_irqsave)(&chip->ad1843_lock);
|
||||
|
||||
writeq((reg << CODEC_CONTROL_ADDRESS_SHIFT) |
|
||||
CODEC_CONTROL_READ, &mace->perif.audio.codec_control);
|
||||
|
|
@ -115,7 +114,6 @@ static int read_ad1843_reg(void *priv, int reg)
|
|||
|
||||
val = readq(&mace->perif.audio.codec_read);
|
||||
|
||||
spin_unlock_irqrestore(&chip->ad1843_lock, flags);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
@ -126,9 +124,8 @@ static int write_ad1843_reg(void *priv, int reg, int word)
|
|||
{
|
||||
struct snd_sgio2audio *chip = priv;
|
||||
int val;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->ad1843_lock, flags);
|
||||
guard(spinlock_irqsave)(&chip->ad1843_lock);
|
||||
|
||||
writeq((reg << CODEC_CONTROL_ADDRESS_SHIFT) |
|
||||
(word << CODEC_CONTROL_WORD_SHIFT),
|
||||
|
|
@ -137,7 +134,6 @@ static int write_ad1843_reg(void *priv, int reg, int word)
|
|||
val = readq(&mace->perif.audio.codec_control); /* flush bus */
|
||||
udelay(200);
|
||||
|
||||
spin_unlock_irqrestore(&chip->ad1843_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -351,10 +347,9 @@ static int snd_sgio2audio_dma_pull_frag(struct snd_sgio2audio *chip,
|
|||
u64 *src;
|
||||
s16 *dst;
|
||||
u64 x;
|
||||
unsigned long flags;
|
||||
struct snd_pcm_runtime *runtime = chip->channel[ch].substream->runtime;
|
||||
|
||||
spin_lock_irqsave(&chip->channel[ch].lock, flags);
|
||||
guard(spinlock_irqsave)(&chip->channel[ch].lock);
|
||||
|
||||
src_base = (unsigned long) chip->ring_base | (ch << CHANNEL_RING_SHIFT);
|
||||
src_pos = readq(&mace->perif.audio.chan[ch].read_ptr);
|
||||
|
|
@ -383,7 +378,6 @@ static int snd_sgio2audio_dma_pull_frag(struct snd_sgio2audio *chip,
|
|||
writeq(src_pos, &mace->perif.audio.chan[ch].read_ptr); /* in bytes */
|
||||
chip->channel[ch].pos = dst_pos;
|
||||
|
||||
spin_unlock_irqrestore(&chip->channel[ch].lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -399,10 +393,9 @@ static int snd_sgio2audio_dma_push_frag(struct snd_sgio2audio *chip,
|
|||
int src_pos;
|
||||
u64 *dst;
|
||||
s16 *src;
|
||||
unsigned long flags;
|
||||
struct snd_pcm_runtime *runtime = chip->channel[ch].substream->runtime;
|
||||
|
||||
spin_lock_irqsave(&chip->channel[ch].lock, flags);
|
||||
guard(spinlock_irqsave)(&chip->channel[ch].lock);
|
||||
|
||||
dst_base = (unsigned long)chip->ring_base | (ch << CHANNEL_RING_SHIFT);
|
||||
dst_pos = readq(&mace->perif.audio.chan[ch].write_ptr);
|
||||
|
|
@ -433,7 +426,6 @@ static int snd_sgio2audio_dma_push_frag(struct snd_sgio2audio *chip,
|
|||
writeq(dst_pos, &mace->perif.audio.chan[ch].write_ptr); /* in bytes */
|
||||
chip->channel[ch].pos = src_pos;
|
||||
|
||||
spin_unlock_irqrestore(&chip->channel[ch].lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +576,8 @@ static int snd_sgio2audio_pcm_prepare(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_sgio2audio_chan *chan = substream->runtime->private_data;
|
||||
int ch = chan->idx;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&chip->channel[ch].lock, flags);
|
||||
guard(spinlock_irqsave)(&chip->channel[ch].lock);
|
||||
|
||||
/* Setup the pseudo-dma transfer pointers. */
|
||||
chip->channel[ch].pos = 0;
|
||||
|
|
@ -610,7 +601,6 @@ static int snd_sgio2audio_pcm_prepare(struct snd_pcm_substream *substream)
|
|||
runtime->channels);
|
||||
break;
|
||||
}
|
||||
spin_unlock_irqrestore(&chip->channel[ch].lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue