summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-01-23 16:49:22 +0300
committerTakashi Iwai <tiwai@suse.de>2015-01-28 09:21:00 +0300
commitf2a76225b962f00642002fb109aee2e5b0dc4259 (patch)
tree1e9da1e3e9162d8e62b5af0638e5bc13014849d8
parent5343ecf4e5c94aecdd6a859b76c125c3544865d1 (diff)
downloadlinux-f2a76225b962f00642002fb109aee2e5b0dc4259.tar.xz
ALSA: line6: Drop superfluous spinlock for trigger
The trigger callback is already spinlocked, so we need no more lock here (even for the linked substreams). Let's drop it. Tested-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/usb/line6/pcm.c23
-rw-r--r--sound/usb/line6/pcm.h5
2 files changed, 6 insertions, 22 deletions
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index 9a2a15f4c4e4..adbcac46b785 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -226,9 +226,8 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
struct snd_pcm_substream *s;
- int err;
+ int err = 0;
- spin_lock(&line6pcm->lock_trigger);
clear_bit(LINE6_INDEX_PREPARED, &line6pcm->flags);
snd_pcm_group_for_each_entry(s, substream) {
@@ -237,32 +236,23 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
switch (s->stream) {
case SNDRV_PCM_STREAM_PLAYBACK:
err = snd_line6_playback_trigger(line6pcm, cmd);
-
- if (err < 0) {
- spin_unlock(&line6pcm->lock_trigger);
- return err;
- }
-
break;
case SNDRV_PCM_STREAM_CAPTURE:
err = snd_line6_capture_trigger(line6pcm, cmd);
-
- if (err < 0) {
- spin_unlock(&line6pcm->lock_trigger);
- return err;
- }
-
break;
default:
dev_err(line6pcm->line6->ifcdev,
"Unknown stream direction %d\n", s->stream);
+ err = -EINVAL;
+ break;
}
+ if (err < 0)
+ break;
}
- spin_unlock(&line6pcm->lock_trigger);
- return 0;
+ return err;
}
/* control info callback */
@@ -427,7 +417,6 @@ int line6_init_pcm(struct usb_line6 *line6,
spin_lock_init(&line6pcm->lock_audio_out);
spin_lock_init(&line6pcm->lock_audio_in);
- spin_lock_init(&line6pcm->lock_trigger);
line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
line6->line6pcm = line6pcm;
diff --git a/sound/usb/line6/pcm.h b/sound/usb/line6/pcm.h
index c742b33666eb..a84753ee0fa2 100644
--- a/sound/usb/line6/pcm.h
+++ b/sound/usb/line6/pcm.h
@@ -308,11 +308,6 @@ struct snd_line6_pcm {
spinlock_t lock_audio_in;
/**
- Spin lock to protect trigger.
- */
- spinlock_t lock_trigger;
-
- /**
PCM playback volume (left and right).
*/
int volume_playback[2];