mirror of https://github.com/torvalds/linux.git
ALSA: aw2: 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> Link: https://patch.msgid.link/20250829144342.4290-14-tiwai@suse.de
This commit is contained in:
parent
ca10ce1caf
commit
290adc48a2
|
|
@ -397,10 +397,10 @@ static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream)
|
|||
static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream,
|
||||
int cmd)
|
||||
{
|
||||
int status = 0;
|
||||
struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
|
||||
struct aw2 *chip = pcm_device->chip;
|
||||
spin_lock(&chip->reg_lock);
|
||||
|
||||
guard(spinlock)(&chip->reg_lock);
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
snd_aw2_saa7146_pcm_trigger_start_playback(&chip->saa7146,
|
||||
|
|
@ -413,20 +413,19 @@ static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream,
|
|||
stream_number);
|
||||
break;
|
||||
default:
|
||||
status = -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
spin_unlock(&chip->reg_lock);
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* capture trigger callback */
|
||||
static int snd_aw2_pcm_trigger_capture(struct snd_pcm_substream *substream,
|
||||
int cmd)
|
||||
{
|
||||
int status = 0;
|
||||
struct aw2_pcm_device *pcm_device = snd_pcm_substream_chip(substream);
|
||||
struct aw2 *chip = pcm_device->chip;
|
||||
spin_lock(&chip->reg_lock);
|
||||
|
||||
guard(spinlock)(&chip->reg_lock);
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
snd_aw2_saa7146_pcm_trigger_start_capture(&chip->saa7146,
|
||||
|
|
@ -439,10 +438,9 @@ static int snd_aw2_pcm_trigger_capture(struct snd_pcm_substream *substream,
|
|||
stream_number);
|
||||
break;
|
||||
default:
|
||||
status = -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
spin_unlock(&chip->reg_lock);
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* playback pointer callback */
|
||||
|
|
|
|||
Loading…
Reference in New Issue