ALSA: hda: Remove substream allocation/free ops
authorTakashi Iwai <tiwai@suse.de>
Wed, 8 Aug 2018 15:12:58 +0000 (17:12 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 28 Aug 2018 11:56:47 +0000 (13:56 +0200)
Since we dropped the memory page fiddling in the own allocators in
hda_intel.c, the substream allocation and free ops in both hda_intel.c
and hda_tegra.c became nothing but the simple calls of the standard
snd_pcm_lib helpers.  As both are identical, there is no longer need
for indirect calls via ops; it's a good opportunity for removing ops
and simplifying the codes.

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

index 8bc46676c278b015a45639290454e430514da164..53bdf76fcbba50488f02eb6d645a18e24dade93f 100644 (file)
@@ -130,8 +130,9 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
        azx_dev->core.bufsize = 0;
        azx_dev->core.period_bytes = 0;
        azx_dev->core.format_val = 0;
-       ret = chip->ops->substream_alloc_pages(chip, substream,
-                                         params_buffer_bytes(hw_params));
+       ret = snd_pcm_lib_malloc_pages(substream,
+                                      params_buffer_bytes(hw_params));
+
 unlock:
        dsp_unlock(azx_dev);
        return ret;
@@ -141,7 +142,6 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
 {
        struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
        struct azx_dev *azx_dev = get_azx_dev(substream);
-       struct azx *chip = apcm->chip;
        struct hda_pcm_stream *hinfo = to_hda_pcm_stream(substream);
        int err;
 
@@ -152,7 +152,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);
+       err = snd_pcm_lib_free_pages(substream);
        azx_stream(azx_dev)->prepared = 0;
        dsp_unlock(azx_dev);
        return err;
index c4b3de6c42b80f3e122d0120781652295ba0dce1..3c9a2f81cfbfe4ebe65c92ec8cc4be0ac5d2d252 100644 (file)
@@ -87,11 +87,6 @@ struct azx;
 struct hda_controller_ops {
        /* Disable msi if supported, PCI only */
        int (*disable_msi_reset_irq)(struct azx *);
-       int (*substream_alloc_pages)(struct azx *chip,
-                                    struct snd_pcm_substream *substream,
-                                    size_t size);
-       int (*substream_free_pages)(struct azx *chip,
-                                   struct snd_pcm_substream *substream);
        void (*pcm_mmap_prepare)(struct snd_pcm_substream *substream,
                                 struct vm_area_struct *area);
        /* Check if current position is acceptable */
index 03ddd1abb44db0f7ba02a31c26117c17cb7f76bc..0a3ce9c60f50183c59736bdf8e32a0a560716183 100644 (file)
@@ -2010,19 +2010,6 @@ static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
        snd_dma_free_pages(buf);
 }
 
-static int substream_alloc_pages(struct azx *chip,
-                                struct snd_pcm_substream *substream,
-                                size_t size)
-{
-       return snd_pcm_lib_malloc_pages(substream, size);
-}
-
-static int substream_free_pages(struct azx *chip,
-                               struct snd_pcm_substream *substream)
-{
-       return snd_pcm_lib_free_pages(substream);
-}
-
 static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
                             struct vm_area_struct *area)
 {
@@ -2047,8 +2034,6 @@ static const struct hdac_io_ops pci_hda_io_ops = {
 
 static const struct hda_controller_ops pci_hda_ops = {
        .disable_msi_reset_irq = disable_msi_reset_irq,
-       .substream_alloc_pages = substream_alloc_pages,
-       .substream_free_pages = substream_free_pages,
        .pcm_mmap_prepare = pcm_mmap_prepare,
        .position_check = azx_position_check,
        .link_power = azx_intel_link_power,
index 0621920f7617f91900591c46970f6cbd03216771..8fd20e4dca1767ff9b19f3fe99ae07b3fcf48be2 100644 (file)
@@ -99,19 +99,6 @@ static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf)
        snd_dma_free_pages(buf);
 }
 
-static int substream_alloc_pages(struct azx *chip,
-                                struct snd_pcm_substream *substream,
-                                size_t size)
-{
-       return snd_pcm_lib_malloc_pages(substream, size);
-}
-
-static int substream_free_pages(struct azx *chip,
-                               struct snd_pcm_substream *substream)
-{
-       return snd_pcm_lib_free_pages(substream);
-}
-
 /*
  * Register access ops. Tegra HDA register access is DWORD only.
  */
@@ -180,10 +167,7 @@ static const struct hdac_io_ops hda_tegra_io_ops = {
        .dma_free_pages = dma_free_pages,
 };
 
-static const struct hda_controller_ops hda_tegra_ops = {
-       .substream_alloc_pages = substream_alloc_pages,
-       .substream_free_pages = substream_free_pages,
-};
+static const struct hda_controller_ops hda_tegra_ops; /* nothing special */
 
 static void hda_tegra_init(struct hda_tegra *hda)
 {