Commit 09e263cd authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ice1724: Use managed buffer allocation

Clean up the driver with the new managed buffer allocation API.
The superfluous snd_pcm_lib_malloc_pages() and
snd_pcm_lib_free_pages() calls are dropped.

Link: https://lore.kernel.org/r/20191209094943.14984-43-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 60b8918b
...@@ -704,7 +704,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -704,7 +704,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
int i, chs, err; int i, chs;
chs = params_channels(hw_params); chs = params_channels(hw_params);
mutex_lock(&ice->open_mutex); mutex_lock(&ice->open_mutex);
...@@ -740,11 +740,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -740,11 +740,7 @@ static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
} }
mutex_unlock(&ice->open_mutex); mutex_unlock(&ice->open_mutex);
err = snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0); return snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0);
if (err < 0)
return err;
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
} }
static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream) static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
...@@ -758,7 +754,7 @@ static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -758,7 +754,7 @@ static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
if (ice->pcm_reserved[i] == substream) if (ice->pcm_reserved[i] == substream)
ice->pcm_reserved[i] = NULL; ice->pcm_reserved[i] = NULL;
mutex_unlock(&ice->open_mutex); mutex_unlock(&ice->open_mutex);
return snd_pcm_lib_free_pages(substream); return 0;
} }
static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
...@@ -1142,9 +1138,8 @@ static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) ...@@ -1142,9 +1138,8 @@ static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
pcm->info_flags = 0; pcm->info_flags = 0;
strcpy(pcm->name, "ICE1724"); strcpy(pcm->name, "ICE1724");
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, &ice->pci->dev, 256*1024, 256*1024);
256*1024, 256*1024);
ice->pcm_pro = pcm; ice->pcm_pro = pcm;
...@@ -1340,9 +1335,8 @@ static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) ...@@ -1340,9 +1335,8 @@ static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
pcm->info_flags = 0; pcm->info_flags = 0;
strcpy(pcm->name, name); strcpy(pcm->name, name);
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, &ice->pci->dev, 256*1024, 256*1024);
256*1024, 256*1024);
ice->pcm = pcm; ice->pcm = pcm;
...@@ -1454,9 +1448,8 @@ static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) ...@@ -1454,9 +1448,8 @@ static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
pcm->info_flags = 0; pcm->info_flags = 0;
strcpy(pcm->name, "ICE1724 Surround PCM"); strcpy(pcm->name, "ICE1724 Surround PCM");
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ice->pci->dev, &ice->pci->dev, 256*1024, 256*1024);
256*1024, 256*1024);
ice->pcm_ds = pcm; ice->pcm_ds = pcm;
......
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