All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Stefan Hajnoczi <stefanha@gmail.com>, Chris Rorvick <chris@rorvick.com>
Subject: [PATCH 08/16] ALSA: line6: Drop superfluous spinlock for trigger
Date: Fri, 23 Jan 2015 18:13:15 +0100	[thread overview]
Message-ID: <1422033203-23254-9-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1422033203-23254-1-git-send-email-tiwai@suse.de>

The trigger callback is already spinlocked, so we need no more lock
here (even for the linked substreams).  Let's drop it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/pcm.c | 23 ++++++-----------------
 sound/usb/line6/pcm.h |  5 -----
 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];
-- 
2.2.2

  parent reply	other threads:[~2015-01-23 17:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 17:13 [PATCH 00/16] Yet more cleanups of line6 drivers Takashi Iwai
2015-01-23 17:13 ` [PATCH 01/16] ALSA: line6: Minor refactoring Takashi Iwai
2015-01-23 17:13 ` [PATCH 02/16] ALSA: line6: Fix memory leak at probe error path Takashi Iwai
2015-01-25  8:06   ` Chris Rorvick
2015-01-26 12:47     ` Takashi Iwai
2015-01-23 17:13 ` [PATCH 03/16] ALSA: line6: Remove unused line6_nop_read() Takashi Iwai
2015-01-23 17:13 ` [PATCH 04/16] ALSA: line6: Reduce superfluous spinlock in midi.c Takashi Iwai
2015-01-23 17:13 ` [PATCH 05/16] ALSA: line6: Fix missing error handling in line6_pcm_acquire() Takashi Iwai
2015-01-23 17:13 ` [PATCH 06/16] ALSA: line6: Use logical OR Takashi Iwai
2015-01-23 17:13 ` [PATCH 07/16] ALSA: line6: Fix the error recovery in line6_pcm_acquire() Takashi Iwai
2015-01-23 17:13 ` Takashi Iwai [this message]
2015-01-27  6:22   ` [PATCH 08/16] ALSA: line6: Drop superfluous spinlock for trigger Chris Rorvick
2015-01-27 10:27     ` Takashi Iwai
2015-01-27 12:48       ` Chris Rorvick
2015-01-27 16:10         ` Takashi Iwai
2015-01-28  6:03           ` Chris Rorvick
2015-01-28  6:26             ` Takashi Iwai
2015-01-28 14:02               ` Chris Rorvick
2015-01-23 17:13 ` [PATCH 09/16] ALSA: line6: Use incremental loop Takashi Iwai
2015-01-23 17:13 ` [PATCH 10/16] ALSA: line6: Drop voodoo workarounds Takashi Iwai
2015-01-27  3:58   ` Chris Rorvick
2015-01-23 17:13 ` [PATCH 11/16] ALSA: line6: Rearrange PCM structure Takashi Iwai
2015-01-23 17:13 ` [PATCH 12/16] ALSA: line6: Consolidate URB unlink and sync helpers Takashi Iwai
2015-01-23 17:13 ` [PATCH 13/16] ALSA: line6: Use dev_err() Takashi Iwai
2015-01-23 17:13 ` [PATCH 14/16] ALSA: line6: Consolidate PCM stream buffer allocation and free Takashi Iwai
2015-01-23 17:13 ` [PATCH 15/16] ALSA: line6: Do clipping in volume / monitor manipulations Takashi Iwai
2015-01-23 17:13 ` [PATCH 16/16] ALSA: line6: Skip volume manipulation during silence copying Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422033203-23254-9-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=chris@rorvick.com \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.