ASoC: dmaengine: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
Subsystems (5)
Lars-Peter Clausen
maintainerPATCH 1/7 ASoC: dmaengine: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver. Similarly there is also no need to do it on the pcm_new() error path as the PCM will be freed if a error is returned.
--- sound/soc/soc-generic-dmaengine-pcm.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
sound/soc/soc-generic-dmaengine-pcm.c +2 -13
@@ -200,11 +200,6 @@ static int dmaengine_pcm_open(struct snd_pcm_substream *substream)return snd_dmaengine_pcm_open (substream, chan); } -static void dmaengine_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static struct dma_chan *dmaengine_pcm_compat_request_channel (struct snd_soc_pcm_runtime *rtd,struct snd_pcm_substream *substream)
@@ -283,8 +278,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)if (!pcm->chan[i]) {dev_err (rtd->platform->dev,"Missing dma channel for stream: %d\n" , i); - ret = -EINVAL ; - goto err_free; +return -EINVAL ; } ret = snd_pcm_lib_preallocate_pages(substream,
@@ -293,7 +287,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) prealloc_buffer_size, max_buffer_size);if (ret) - goto err_free; +return ret;/* * This will only return false if we know for sure that at least
@@ -307,10 +301,6 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) }return 0 ; - -err_free: -dmaengine_pcm_free (rtd->pcm); -return ret; } static snd_pcm_uframes_t dmaengine_pcm_pointer(
@@ -341,7 +331,6 @@ static const struct snd_soc_platform_driver dmaengine_pcm_platform = { }, .ops = &dmaengine_pcm_ops, .pcm_new = dmaengine_pcm_new, - .pcm_free = dmaengine_pcm_free, };static const char *const dmaengine_pcm_dma_channel_names[] = {
Signature · 1 line
1.8.0
Lars-Peter Clausen
maintainerPATCH 2/7 ASoC: au1x: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
--- sound/soc/au1x/dbdma2.c | 6 ------ sound/soc/au1x/dma.c | 6 ------ 2 files changed, 12 deletions(-)
sound/soc/au1x/dbdma2.c +0 -6
@@ -315,11 +315,6 @@ static struct snd_pcm_ops au1xpsc_pcm_ops = { .pointer = au1xpsc_pcm_pointer, }; -static void au1xpsc_pcm_free_dma_buffers (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int au1xpsc_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_card *card = rtd->card->snd_card;
@@ -335,7 +330,6 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd)static struct snd_soc_platform_driver au1xpsc_soc_platform = { .ops = &au1xpsc_pcm_ops, .pcm_new = au1xpsc_pcm_new, - .pcm_free = au1xpsc_pcm_free_dma_buffers, };static int au1xpsc_pcm_drvprobe (struct platform_device *pdev)
sound/soc/au1x/dma.c +0 -6
@@ -287,11 +287,6 @@ static struct snd_pcm_ops alchemy_pcm_ops = { .pointer = alchemy_pcm_pointer, }; -static void alchemy_pcm_free_dma_buffers (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int alchemy_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_pcm *pcm = rtd->pcm;
@@ -305,7 +300,6 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd)static struct snd_soc_platform_driver alchemy_pcm_soc_platform = { .ops = &alchemy_pcm_ops, .pcm_new = alchemy_pcm_new, - .pcm_free = alchemy_pcm_free_dma_buffers, };static int alchemy_pcm_drvprobe (struct platform_device *pdev)
Signature · 1 line
1.8.0
Lars-Peter Clausen
maintainerPATCH 3/7 ASoC: intel: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
In reply to Lars-Peter ClausenThe ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
--- sound/soc/intel/sst-baytrail-pcm.c | 6 ------ sound/soc/intel/sst-haswell-pcm.c | 6 ------ sound/soc/intel/sst-mfld-platform-pcm.c | 7 ------- 3 files changed, 19 deletions(-)
sound/soc/intel/sst-baytrail-pcm.c +0 -6
@@ -320,11 +320,6 @@ static struct snd_pcm_ops sst_byt_pcm_ops = { .mmap = sst_byt_pcm_mmap, }; -static void sst_byt_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int sst_byt_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_pcm *pcm = rtd->pcm;
@@ -403,7 +398,6 @@ static struct snd_soc_platform_driver byt_soc_platform = { .remove = sst_byt_pcm_remove, .ops = &sst_byt_pcm_ops, .pcm_new = sst_byt_pcm_new, - .pcm_free = sst_byt_pcm_free, };static const struct snd_soc_component_driver byt_dai_component = {
sound/soc/intel/sst-haswell-pcm.c +0 -6
@@ -735,11 +735,6 @@ static void hsw_pcm_free_modules(struct hsw_priv_data *pdata) } } -static void hsw_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int hsw_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_pcm *pcm = rtd->pcm;
@@ -936,7 +931,6 @@ static struct snd_soc_platform_driver hsw_soc_platform = { .remove = hsw_pcm_remove, .ops = &hsw_pcm_ops, .pcm_new = hsw_pcm_new, - .pcm_free = hsw_pcm_free, };static const struct snd_soc_component_driver hsw_dai_component = {
sound/soc/intel/sst-mfld-platform-pcm.c +0 -7
@@ -643,12 +643,6 @@ static struct snd_pcm_ops sst_platform_ops = { .pointer = sst_platform_pcm_pointer, }; -static void sst_pcm_free (struct snd_pcm *pcm) -{ -dev_dbg (pcm->dev,"sst_pcm_free called\n" ); -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int sst_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_soc_dai *dai = rtd->cpu_dai;
@@ -679,7 +673,6 @@ static struct snd_soc_platform_driver sst_soc_platform_drv = { .ops = &sst_platform_ops, .compr_ops = &sst_platform_compr_ops, .pcm_new = sst_pcm_new, - .pcm_free = sst_pcm_free, };static const struct snd_soc_component_driver sst_component = {
Signature · 1 line
1.8.0
Re: [PATCH 3/7] ASoC: intel: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
Quoted 9 lines · Lars-Peter Clausen
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
Signed-off-by Lars-Peter Clausen <[email protected]>--- sound/soc/intel/sst-baytrail-pcm.c | 6 ------ sound/soc/intel/sst-haswell-pcm.c | 6 ------ sound/soc/intel/sst-mfld-platform-pcm.c | 7 ------- 3 files changed, 19 deletions(-)
Lars-Peter Clausen
maintainerPATCH 4/7 ASoC: nuc900: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
In reply to Lars-Peter ClausenThe ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
--- sound/soc/nuc900/nuc900-pcm.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/nuc900/nuc900-pcm.c +0 -6
@@ -306,11 +306,6 @@ static struct snd_pcm_ops nuc900_dma_ops = { .mmap = nuc900_dma_mmap, }; -static void nuc900_dma_free_dma_buffers (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int nuc900_dma_new (struct snd_soc_pcm_runtime *rtd) {struct snd_card *card = rtd->card->snd_card;
@@ -330,7 +325,6 @@ static int nuc900_dma_new(struct snd_soc_pcm_runtime *rtd)static struct snd_soc_platform_driver nuc900_soc_platform = { .ops = &nuc900_dma_ops, .pcm_new = nuc900_dma_new, - .pcm_free = nuc900_dma_free_dma_buffers, };static int nuc900_soc_platform_probe (struct platform_device *pdev)
Signature · 1 line
1.8.0
Lars-Peter Clausen
maintainerPATCH 5/7 ASoC: rcar: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
In reply to Lars-Peter ClausenThe ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
--- sound/soc/sh/rcar/core.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/sh/rcar/core.c +0 -6
@@ -1140,15 +1140,9 @@ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd) PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); } -static void rsnd_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static struct snd_soc_platform_driver rsnd_soc_platform = { .ops = &rsnd_pcm_ops, .pcm_new = rsnd_pcm_new, - .pcm_free = rsnd_pcm_free, };static const struct snd_soc_component_driver rsnd_soc_component = {
Signature · 1 line
1.8.0
Lars-Peter Clausen
maintainerPATCH 6/7 ASoC: sh: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
In reply to Lars-Peter ClausenThe ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
--- sound/soc/sh/dma-sh7760.c | 6 ------ sound/soc/sh/fsi.c | 6 ------ sound/soc/sh/siu_pcm.c | 1 - 3 files changed, 13 deletions(-)
sound/soc/sh/dma-sh7760.c +0 -6
@@ -305,11 +305,6 @@ static struct snd_pcm_ops camelot_pcm_ops = { .pointer = camelot_pos, }; -static void camelot_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int camelot_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_pcm *pcm = rtd->pcm;
@@ -328,7 +323,6 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd)static struct snd_soc_platform_driver sh7760_soc_platform = { .ops = &camelot_pcm_ops, .pcm_new = camelot_pcm_new, - .pcm_free = camelot_pcm_free, };static int sh7760_soc_platform_probe (struct platform_device *pdev)
sound/soc/sh/fsi.c +0 -6
@@ -1765,11 +1765,6 @@ static struct snd_pcm_ops fsi_pcm_ops = {#define PREALLOC_BUFFER (32 * 1024)#define PREALLOC_BUFFER_MAX (32 * 1024) -static void fsi_pcm_free (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int fsi_pcm_new (struct snd_soc_pcm_runtime *rtd) { return snd_pcm_lib_preallocate_pages_for_all(
@@ -1821,7 +1816,6 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = {static struct snd_soc_platform_driver fsi_soc_platform = { .ops = &fsi_pcm_ops, .pcm_new = fsi_pcm_new, - .pcm_free = fsi_pcm_free, };static const struct snd_soc_component_driver fsi_soc_component = {
sound/soc/sh/siu_pcm.c +0 -1
@@ -589,7 +589,6 @@ static void siu_pcm_free(struct snd_pcm *pcm)tasklet_kill (&port_info->playback.tasklet);siu_free_port (port_info); -snd_pcm_lib_preallocate_free_for_all (pcm);dev_dbg (pcm->card->dev,"%s\n" , __func__); }
Signature · 1 line
1.8.0
Lars-Peter Clausen
maintainerPATCH 7/7 ASoC: txx9: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()
In reply to Lars-Peter ClausenThe ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver.
--- sound/soc/txx9/txx9aclc.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/txx9/txx9aclc.c +0 -6
@@ -282,11 +282,6 @@ static struct snd_pcm_ops txx9aclc_pcm_ops = { .pointer = txx9aclc_pcm_pointer, }; -static void txx9aclc_pcm_free_dma_buffers (struct snd_pcm *pcm) -{ -snd_pcm_lib_preallocate_free_for_all (pcm); -} -static int txx9aclc_pcm_new (struct snd_soc_pcm_runtime *rtd) {struct snd_card *card = rtd->card->snd_card;
@@ -412,7 +407,6 @@ static struct snd_soc_platform_driver txx9aclc_soc_platform = { .remove = txx9aclc_pcm_remove, .ops = &txx9aclc_pcm_ops, .pcm_new = txx9aclc_pcm_new, - .pcm_free = txx9aclc_pcm_free_dma_buffers, };static int txx9aclc_soc_platform_probe (struct platform_device *pdev)
Signature · 1 line
1.8.0
Quoted 4 lines · Lars-Peter Clausen
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver. Similarly there is also no need to do it on the
pcm_new()error path as the PCM will be freed if a error is returned.
Applied all, thanks.