All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Ian W MORRISON <ianwmorrison@gmail.com>,
	Rakesh A Ughreja <rakesh.a.ughreja@intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Jerome Anand <jerome.anand@intel.com>
Subject: [PATCH 2/4] ALSA: x86: Drop unused stream.running field
Date: Mon, 13 Feb 2017 15:39:17 +0100	[thread overview]
Message-ID: <20170213143919.19543-3-tiwai@suse.de> (raw)
In-Reply-To: <20170213143919.19543-1-tiwai@suse.de>

The pcm_stream_info.running field is only set in the PCM trigger
callback but never referred, thus it can be safely removed.

Also, properly cover the spinlock in both the trigger START and STOP
to protect had_enable_audio() calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/x86/intel_hdmi_audio.c | 11 ++---------
 sound/x86/intel_hdmi_audio.h |  1 -
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 015d57cd9725..9889cdf3ccf4 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1168,6 +1168,7 @@ static int had_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 
 	intelhaddata = snd_pcm_substream_chip(substream);
 
+	spin_lock(&intelhaddata->had_spinlock);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -1180,8 +1181,6 @@ static int had_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 			break;
 		}
 
-		intelhaddata->stream_info.running = true;
-
 		/* Enable Audio */
 		had_ack_irqs(intelhaddata); /* FIXME: do we need this? */
 		had_enable_audio(intelhaddata, true);
@@ -1189,13 +1188,6 @@ static int had_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-	case SNDRV_PCM_TRIGGER_SUSPEND:
-		spin_lock(&intelhaddata->had_spinlock);
-
-		/* Stop reporting BUFFER_DONE/UNDERRUN to above layers */
-
-		intelhaddata->stream_info.running = false;
-		spin_unlock(&intelhaddata->had_spinlock);
 		/* Disable Audio */
 		had_enable_audio(intelhaddata, false);
 		intelhaddata->need_reset = true;
@@ -1204,6 +1196,7 @@ static int had_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 	default:
 		retval = -EINVAL;
 	}
+	spin_unlock(&intelhaddata->had_spinlock);
 	return retval;
 }
 
diff --git a/sound/x86/intel_hdmi_audio.h b/sound/x86/intel_hdmi_audio.h
index 8b9e184fef44..d6ba90fd011d 100644
--- a/sound/x86/intel_hdmi_audio.h
+++ b/sound/x86/intel_hdmi_audio.h
@@ -83,7 +83,6 @@ struct channel_map_table {
 struct pcm_stream_info {
 	struct snd_pcm_substream *substream;
 	int substream_refcount;
-	bool running;
 };
 
 /*
-- 
2.11.1

  parent reply	other threads:[~2017-02-13 14:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 14:39 [PATCH 0/4] A few more extensions to LPE audio driver Takashi Iwai
2017-02-13 14:39 ` [PATCH 1/4] ALSA: x86: Handle reset at prepare callback Takashi Iwai
2017-02-13 14:39 ` Takashi Iwai [this message]
2017-02-13 14:39 ` [PATCH 3/4] ALSA: x86: Use runtime PM autosuspend Takashi Iwai
2017-02-13 14:39 ` [PATCH 4/4] ALSA: x86: Enable keep-link feature Takashi Iwai
2017-02-13 17:05   ` Pierre-Louis Bossart
2017-02-13 20:05     ` Takashi Iwai
2017-02-13 21:26       ` Takashi Iwai
2017-02-13 22:56 ` [PATCH 0/4] A few more extensions to LPE audio driver Pierre-Louis Bossart
2017-02-14  6:33   ` Takashi Iwai
2017-02-14 15:12     ` Ian W MORRISON

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=20170213143919.19543-3-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=ianwmorrison@gmail.com \
    --cc=jerome.anand@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rakesh.a.ughreja@intel.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.