From 28d52aa55436630327d938b165b7c37febcbd36f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:49:15 +0100 Subject: [PATCH] ALSA: intel8x0: Use managed buffer allocation Clean up the drivers with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-44-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 11 ++++------- sound/pci/intel8x0m.c | 23 ++++------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 12374ba..b171816 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -901,9 +901,6 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream, int dbl = params_rate(hw_params) > 48000; int err; - err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); - if (err < 0) - return err; if (ichdev->pcm_open_flag) { snd_ac97_pcm_close(ichdev->pcm); ichdev->pcm_open_flag = 0; @@ -929,7 +926,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream) snd_ac97_pcm_close(ichdev->pcm); ichdev->pcm_open_flag = 0; } - return snd_pcm_lib_free_pages(substream); + return 0; } static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip, @@ -1487,9 +1484,9 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device, strcpy(pcm->name, chip->card->shortname); chip->pcm[device] = pcm; - snd_pcm_lib_preallocate_pages_for_all(pcm, intel8x0_dma_type(chip), - &chip->pci->dev, - rec->prealloc_size, rec->prealloc_max_size); + snd_pcm_set_managed_buffer_all(pcm, intel8x0_dma_type(chip), + &chip->pci->dev, + rec->prealloc_size, rec->prealloc_max_size); if (rec->playback_ops && rec->playback_ops->open == snd_intel8x0_playback_open) { diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index a9add5f..897c989 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -553,17 +553,6 @@ static int snd_intel8x0m_pcm_trigger(struct snd_pcm_substream *substream, int cm return 0; } -static int snd_intel8x0m_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_intel8x0m_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static snd_pcm_uframes_t snd_intel8x0m_pcm_pointer(struct snd_pcm_substream *substream) { struct intel8x0m *chip = snd_pcm_substream_chip(substream); @@ -674,8 +663,6 @@ static const struct snd_pcm_ops snd_intel8x0m_playback_ops = { .open = snd_intel8x0m_playback_open, .close = snd_intel8x0m_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_intel8x0m_hw_params, - .hw_free = snd_intel8x0m_hw_free, .prepare = snd_intel8x0m_pcm_prepare, .trigger = snd_intel8x0m_pcm_trigger, .pointer = snd_intel8x0m_pcm_pointer, @@ -685,8 +672,6 @@ static const struct snd_pcm_ops snd_intel8x0m_capture_ops = { .open = snd_intel8x0m_capture_open, .close = snd_intel8x0m_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_intel8x0m_hw_params, - .hw_free = snd_intel8x0m_hw_free, .prepare = snd_intel8x0m_pcm_prepare, .trigger = snd_intel8x0m_pcm_trigger, .pointer = snd_intel8x0m_pcm_pointer, @@ -733,10 +718,10 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device, strcpy(pcm->name, chip->card->shortname); chip->pcm[device] = pcm; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - &chip->pci->dev, - rec->prealloc_size, - rec->prealloc_max_size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + &chip->pci->dev, + rec->prealloc_size, + rec->prealloc_max_size); return 0; } -- 2.7.4