ALSA: hda - Move prepared flag into struct hdac_stream
authorTakashi Iwai <tiwai@suse.de>
Fri, 17 Apr 2015 11:34:30 +0000 (13:34 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 17 Apr 2015 11:34:30 +0000 (13:34 +0200)
This flag seems used commonly, so deserves to be located there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/hdaudio.h
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_controller.h

index 15bc039de78dd68c29212a05765ce08039461123..dbeb195eb4e825096adb0338f45c461b47357702 100644 (file)
@@ -390,6 +390,7 @@ struct hdac_stream {
 
        bool opened:1;
        bool running:1;
+       bool prepared:1;
        bool no_period_wakeup:1;
        bool locked:1;
 
index 9bc8eaf0e5ac95aae6085295590b5a94a627a249..14ffb6bd986c5e87987b8758cc3ecfda395c2ab4 100644 (file)
@@ -145,7 +145,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
        snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
 
        err = chip->ops->substream_free_pages(chip, substream);
-       azx_dev->prepared = 0;
+       azx_stream(azx_dev)->prepared = 0;
        dsp_unlock(azx_dev);
        return err;
 }
@@ -214,7 +214,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
 
  unlock:
        if (!err)
-               azx_dev->prepared = 1;
+               azx_stream(azx_dev)->prepared = 1;
        dsp_unlock(azx_dev);
        return err;
 }
@@ -240,7 +240,7 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
        else
                sync_reg = AZX_REG_SSYNC;
 
-       if (dsp_is_locked(azx_dev) || !azx_dev->prepared)
+       if (dsp_is_locked(azx_dev) || !hstr->prepared)
                return -EPIPE;
 
        switch (cmd) {
@@ -843,7 +843,7 @@ int snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
                return err;
        }
 
-       azx_dev->prepared = 0;
+       hstr->prepared = 0;
        return err;
 }
 EXPORT_SYMBOL_GPL(snd_hda_codec_load_dsp_prepare);
index 407cba6577b8608a270c2d7e97a251601c551cdb..173bf7c85b6e7cc0b72233e7375d3c08d67b415a 100644 (file)
@@ -62,7 +62,6 @@ struct azx_dev {
        struct hdac_stream core;
 
        unsigned int irq_pending:1;
-       unsigned int prepared:1;
        /*
         * For VIA:
         *  A flag to ensure DMA position is 0