Commit 28d52aa5 authored by Takashi Iwai's avatar Takashi Iwai

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.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 09e263cd
...@@ -901,9 +901,6 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream, ...@@ -901,9 +901,6 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream,
int dbl = params_rate(hw_params) > 48000; int dbl = params_rate(hw_params) > 48000;
int err; int err;
err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
if (err < 0)
return err;
if (ichdev->pcm_open_flag) { if (ichdev->pcm_open_flag) {
snd_ac97_pcm_close(ichdev->pcm); snd_ac97_pcm_close(ichdev->pcm);
ichdev->pcm_open_flag = 0; ichdev->pcm_open_flag = 0;
...@@ -929,7 +926,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream) ...@@ -929,7 +926,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)
snd_ac97_pcm_close(ichdev->pcm); snd_ac97_pcm_close(ichdev->pcm);
ichdev->pcm_open_flag = 0; ichdev->pcm_open_flag = 0;
} }
return snd_pcm_lib_free_pages(substream); return 0;
} }
static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip, static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip,
...@@ -1487,9 +1484,9 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device, ...@@ -1487,9 +1484,9 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
strcpy(pcm->name, chip->card->shortname); strcpy(pcm->name, chip->card->shortname);
chip->pcm[device] = pcm; chip->pcm[device] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, intel8x0_dma_type(chip), snd_pcm_set_managed_buffer_all(pcm, intel8x0_dma_type(chip),
&chip->pci->dev, &chip->pci->dev,
rec->prealloc_size, rec->prealloc_max_size); rec->prealloc_size, rec->prealloc_max_size);
if (rec->playback_ops && if (rec->playback_ops &&
rec->playback_ops->open == snd_intel8x0_playback_open) { rec->playback_ops->open == snd_intel8x0_playback_open) {
......
...@@ -553,17 +553,6 @@ static int snd_intel8x0m_pcm_trigger(struct snd_pcm_substream *substream, int cm ...@@ -553,17 +553,6 @@ static int snd_intel8x0m_pcm_trigger(struct snd_pcm_substream *substream, int cm
return 0; 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) static snd_pcm_uframes_t snd_intel8x0m_pcm_pointer(struct snd_pcm_substream *substream)
{ {
struct intel8x0m *chip = snd_pcm_substream_chip(substream); struct intel8x0m *chip = snd_pcm_substream_chip(substream);
...@@ -674,8 +663,6 @@ static const struct snd_pcm_ops snd_intel8x0m_playback_ops = { ...@@ -674,8 +663,6 @@ static const struct snd_pcm_ops snd_intel8x0m_playback_ops = {
.open = snd_intel8x0m_playback_open, .open = snd_intel8x0m_playback_open,
.close = snd_intel8x0m_playback_close, .close = snd_intel8x0m_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_intel8x0m_hw_params,
.hw_free = snd_intel8x0m_hw_free,
.prepare = snd_intel8x0m_pcm_prepare, .prepare = snd_intel8x0m_pcm_prepare,
.trigger = snd_intel8x0m_pcm_trigger, .trigger = snd_intel8x0m_pcm_trigger,
.pointer = snd_intel8x0m_pcm_pointer, .pointer = snd_intel8x0m_pcm_pointer,
...@@ -685,8 +672,6 @@ static const struct snd_pcm_ops snd_intel8x0m_capture_ops = { ...@@ -685,8 +672,6 @@ static const struct snd_pcm_ops snd_intel8x0m_capture_ops = {
.open = snd_intel8x0m_capture_open, .open = snd_intel8x0m_capture_open,
.close = snd_intel8x0m_capture_close, .close = snd_intel8x0m_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_intel8x0m_hw_params,
.hw_free = snd_intel8x0m_hw_free,
.prepare = snd_intel8x0m_pcm_prepare, .prepare = snd_intel8x0m_pcm_prepare,
.trigger = snd_intel8x0m_pcm_trigger, .trigger = snd_intel8x0m_pcm_trigger,
.pointer = snd_intel8x0m_pcm_pointer, .pointer = snd_intel8x0m_pcm_pointer,
...@@ -733,10 +718,10 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device, ...@@ -733,10 +718,10 @@ static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
strcpy(pcm->name, chip->card->shortname); strcpy(pcm->name, chip->card->shortname);
chip->pcm[device] = pcm; chip->pcm[device] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev, &chip->pci->dev,
rec->prealloc_size, rec->prealloc_size,
rec->prealloc_max_size); rec->prealloc_max_size);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment