ALSA: x86: Drop unused stream.running field
authorTakashi Iwai <tiwai@suse.de>
Sun, 12 Feb 2017 10:35:44 +0000 (11:35 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 13 Feb 2017 13:51:13 +0000 (14:51 +0100)
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
sound/x86/intel_hdmi_audio.h

index 015d57cd9725ae4f39f4d0c1d15a4ae265b6c9e8..9889cdf3ccf4310d0773363212f3ed01224c3911 100644 (file)
@@ -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;
 }
 
index 8b9e184fef4481940eb81b14e41d7fbc99b960ef..d6ba90fd011df0617f3c939d74901760e9bb7d5e 100644 (file)
@@ -83,7 +83,6 @@ struct channel_map_table {
 struct pcm_stream_info {
        struct snd_pcm_substream *substream;
        int substream_refcount;
-       bool running;
 };
 
 /*