ASoC: wm_adsp: free memory when unloaded or closed
Subsystems (5)
PATCH 1/3 ASoC: wm_adsp: free memory when unloaded or closed
The patch adds a wm_adsp2_remove() function to ensure that memory is freed when the driver is unloaded or shut down.
--- sound/soc/codecs/wm_adsp.c | 20 ++++++++++++++++++++ sound/soc/codecs/wm_adsp.h | 1 + 2 files changed, 21 insertions(+)
sound/soc/codecs/wm_adsp.c +20 -0
@@ -1039,6 +1039,13 @@ static void wm_adsp_ctl_work(struct work_struct *work)kfree (ctl_work); } +static void wm_adsp_free_ctl_blk (struct wm_coeff_ctl *ctl) +{ +kfree (ctl->cache); +kfree (ctl->name); +kfree (ctl); +} + static int wm_adsp_create_control(struct wm_adsp *dsp, const struct wm_adsp_alg_region *alg_region, unsigned int offset, unsigned int len,
@@ -2434,6 +2441,19 @@ int wm_adsp2_init(struct wm_adsp *dsp) }EXPORT_SYMBOL_GPL (wm_adsp2_init); +void wm_adsp2_remove (struct wm_adsp *dsp) +{ +struct wm_coeff_ctl *ctl; + +while (!list_empty (&dsp->ctl_list)) { + ctl = list_first_entry(&dsp->ctl_list, struct wm_coeff_ctl, + list); +list_del (&ctl->list); +wm_adsp_free_ctl_blk (ctl); + } +} +EXPORT_SYMBOL_GPL (wm_adsp2_remove); +int wm_adsp_compr_open (struct wm_adsp *dsp,struct snd_compr_stream *stream) {struct wm_adsp_compr *compr;
sound/soc/codecs/wm_adsp.h +1 -0
@@ -92,6 +92,7 @@ extern const struct snd_kcontrol_new wm_adsp_fw_controls[];int wm_adsp1_init (struct wm_adsp *dsp);int wm_adsp2_init (struct wm_adsp *dsp); +void wm_adsp2_remove (struct wm_adsp *dsp);int wm_adsp2_codec_probe (struct wm_adsp *dsp,struct snd_soc_codec *codec);int wm_adsp2_codec_remove (struct wm_adsp *dsp,struct snd_soc_codec *codec); int wm_adsp1_event(struct snd_soc_dapm_widget *w,
Signature · 1 line
1.9.1
PATCH 2/3 ASoC: arizona: call wm_adsp2_remove when codec driver is removed
Ensure that the wm_adsp driver cleans up when the codec driver is removed.
--- sound/soc/codecs/cs47l24.c | 5 +++++ sound/soc/codecs/wm5102.c | 4 ++++ sound/soc/codecs/wm5110.c | 6 ++++++ 3 files changed, 15 insertions(+)
sound/soc/codecs/cs47l24.c +5 -0
@@ -1274,10 +1274,15 @@ static int cs47l24_probe(struct platform_device *pdev)static int cs47l24_remove (struct platform_device *pdev) { +struct cs47l24_priv *cs47l24 =platform_get_drvdata (pdev); +snd_soc_unregister_platform (&pdev->dev);snd_soc_unregister_codec (&pdev->dev);pm_runtime_disable (&pdev->dev); +wm_adsp2_remove (&cs47l24->core.adsp[1 ]); +wm_adsp2_remove (&cs47l24->core.adsp[2 ]); +return 0 ; }
sound/soc/codecs/wm5102.c +4 -0
@@ -2098,10 +2098,14 @@ static int wm5102_probe(struct platform_device *pdev)static int wm5102_remove (struct platform_device *pdev) { +struct wm5102_priv *wm5102 =platform_get_drvdata (pdev); +snd_soc_unregister_platform (&pdev->dev);snd_soc_unregister_codec (&pdev->dev);pm_runtime_disable (&pdev->dev); +wm_adsp2_remove (&wm5102->core.adsp[0 ]); +return 0 ; }
sound/soc/codecs/wm5110.c +6 -0
@@ -2437,10 +2437,16 @@ static int wm5110_probe(struct platform_device *pdev)static int wm5110_remove (struct platform_device *pdev) { +struct wm5110_priv *wm5110 =platform_get_drvdata (pdev); +int i; +snd_soc_unregister_platform (&pdev->dev);snd_soc_unregister_codec (&pdev->dev);pm_runtime_disable (&pdev->dev); +for (i =0 ; i <WM5110_NUM_ADSP ; i++) +wm_adsp2_remove (&wm5110->core.adsp[i]); +return 0 ; }
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: arizona: call wm_adsp2_remove when codec driver is removed" to the asoc tree
The patch
ASoC: arizona: call wm_adsp2_remove when codec driver is removed
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
401cf1466a59139ec1805e2171d43a32be92f89cMon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Wed, 27 Apr 2016 14:58:28 +0100
Subject: [PATCH] ASoC: arizona: call wm_adsp2_remove when codec driver is
removed
Ensure that the wm_adsp driver cleans up when the codec driver is removed.
--- sound/soc/codecs/cs47l24.c | 5 +++++ sound/soc/codecs/wm5102.c | 4 ++++ sound/soc/codecs/wm5110.c | 6 ++++++ 3 files changed, 15 insertions(+)
sound/soc/codecs/cs47l24.c +5 -0
@@ -1238,10 +1238,15 @@ static int cs47l24_probe(struct platform_device *pdev)static int cs47l24_remove (struct platform_device *pdev) { +struct cs47l24_priv *cs47l24 =platform_get_drvdata (pdev); +snd_soc_unregister_platform (&pdev->dev);snd_soc_unregister_codec (&pdev->dev);pm_runtime_disable (&pdev->dev); +wm_adsp2_remove (&cs47l24->core.adsp[1 ]); +wm_adsp2_remove (&cs47l24->core.adsp[2 ]); +return 0 ; }
sound/soc/codecs/wm5102.c +4 -0
@@ -2093,10 +2093,14 @@ static int wm5102_probe(struct platform_device *pdev)static int wm5102_remove (struct platform_device *pdev) { +struct wm5102_priv *wm5102 =platform_get_drvdata (pdev); +snd_soc_unregister_platform (&pdev->dev);snd_soc_unregister_codec (&pdev->dev);pm_runtime_disable (&pdev->dev); +wm_adsp2_remove (&wm5102->core.adsp[0 ]); +return 0 ; }
sound/soc/codecs/wm5110.c +6 -0
@@ -2435,10 +2435,16 @@ static int wm5110_probe(struct platform_device *pdev)static int wm5110_remove (struct platform_device *pdev) { +struct wm5110_priv *wm5110 =platform_get_drvdata (pdev); +int i; +snd_soc_unregister_platform (&pdev->dev);snd_soc_unregister_codec (&pdev->dev);pm_runtime_disable (&pdev->dev); +for (i =0 ; i <WM5110_NUM_ADSP ; i++) +wm_adsp2_remove (&wm5110->core.adsp[i]); +return 0 ; }
Signature · 1 line
2.8.0.rc3
PATCH 3/3 ASoC: wm_adsp: factor out freeing of alg regions
In reply to Richard FitzgeraldAdd a function to delete and free the contents of the alg_regions list.
--- sound/soc/codecs/wm_adsp.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
sound/soc/codecs/wm_adsp.c +16 -16
@@ -1661,6 +1661,19 @@ static struct wm_adsp_alg_region *wm_adsp_create_region(struct wm_adsp *dsp,return alg_region; } +static void wm_adsp_free_alg_regions (struct wm_adsp *dsp) +{ +struct wm_adsp_alg_region *alg_region; + +while (!list_empty (&dsp->alg_regions)) { + alg_region =list_first_entry (&dsp->alg_regions, + struct wm_adsp_alg_region, + list); +list_del (&alg_region->list); +kfree (alg_region); + } +} +static int wm_adsp1_setup_algs (struct wm_adsp *dsp) {struct wmfw_adsp1_id_hdr adsp1_id;
@@ -2091,7 +2104,6 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,struct snd_soc_codec *codec =snd_soc_dapm_to_codec (w->dapm);struct wm_adsp *dsps =snd_soc_codec_get_drvdata (codec);struct wm_adsp *dsp = &dsps[w->shift]; -struct wm_adsp_alg_region *alg_region;struct wm_coeff_ctl *ctl;int ret;unsigned int val;
@@ -2171,13 +2183,8 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,list_for_each_entry (ctl, &dsp->ctl_list, list) ctl->enabled =0 ; -while (!list_empty (&dsp->alg_regions)) { - alg_region =list_first_entry (&dsp->alg_regions, - struct wm_adsp_alg_region, - list); -list_del (&alg_region->list); -kfree (alg_region); - } + +wm_adsp_free_alg_regions (dsp);break ;default :
@@ -2319,7 +2326,6 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,struct snd_soc_codec *codec =snd_soc_dapm_to_codec (w->dapm);struct wm_adsp *dsps =snd_soc_codec_get_drvdata (codec);struct wm_adsp *dsp = &dsps[w->shift]; -struct wm_adsp_alg_region *alg_region;struct wm_coeff_ctl *ctl;int ret;
@@ -2370,13 +2376,7 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,list_for_each_entry (ctl, &dsp->ctl_list, list) ctl->enabled =0 ; -while (!list_empty (&dsp->alg_regions)) { - alg_region =list_first_entry (&dsp->alg_regions, - struct wm_adsp_alg_region, - list); -list_del (&alg_region->list); -kfree (alg_region); - } +wm_adsp_free_alg_regions (dsp);if (wm_adsp_fw[dsp->fw].num_caps !=0 )wm_adsp_buffer_free (dsp);
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: wm_adsp: factor out freeing of alg regions" to the asoc tree
The patch
ASoC: wm_adsp: factor out freeing of alg regions
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
56574d541f93cf8c9449f9ecadc83d97323cfcecMon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Wed, 27 Apr 2016 14:58:29 +0100
Subject: [PATCH] ASoC: wm_adsp: factor out freeing of alg regions
Add a function to delete and free the contents of the alg_regions list.
--- sound/soc/codecs/wm_adsp.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
sound/soc/codecs/wm_adsp.c +16 -16
@@ -1571,6 +1571,19 @@ static struct wm_adsp_alg_region *wm_adsp_create_region(struct wm_adsp *dsp,return alg_region; } +static void wm_adsp_free_alg_regions (struct wm_adsp *dsp) +{ +struct wm_adsp_alg_region *alg_region; + +while (!list_empty (&dsp->alg_regions)) { + alg_region =list_first_entry (&dsp->alg_regions, + struct wm_adsp_alg_region, + list); +list_del (&alg_region->list); +kfree (alg_region); + } +} +static int wm_adsp1_setup_algs (struct wm_adsp *dsp) {struct wmfw_adsp1_id_hdr adsp1_id;
@@ -2001,7 +2014,6 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,struct snd_soc_codec *codec =snd_soc_dapm_to_codec (w->dapm);struct wm_adsp *dsps =snd_soc_codec_get_drvdata (codec);struct wm_adsp *dsp = &dsps[w->shift]; -struct wm_adsp_alg_region *alg_region;struct wm_coeff_ctl *ctl;int ret;unsigned int val;
@@ -2081,13 +2093,8 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,list_for_each_entry (ctl, &dsp->ctl_list, list) ctl->enabled =0 ; -while (!list_empty (&dsp->alg_regions)) { - alg_region =list_first_entry (&dsp->alg_regions, - struct wm_adsp_alg_region, - list); -list_del (&alg_region->list); -kfree (alg_region); - } + +wm_adsp_free_alg_regions (dsp);break ;default :
@@ -2229,7 +2236,6 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,struct snd_soc_codec *codec =snd_soc_dapm_to_codec (w->dapm);struct wm_adsp *dsps =snd_soc_codec_get_drvdata (codec);struct wm_adsp *dsp = &dsps[w->shift]; -struct wm_adsp_alg_region *alg_region;struct wm_coeff_ctl *ctl;int ret;
@@ -2276,13 +2282,7 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,list_for_each_entry (ctl, &dsp->ctl_list, list) ctl->enabled =0 ; -while (!list_empty (&dsp->alg_regions)) { - alg_region =list_first_entry (&dsp->alg_regions, - struct wm_adsp_alg_region, - list); -list_del (&alg_region->list); -kfree (alg_region); - } +wm_adsp_free_alg_regions (dsp);if (wm_adsp_fw[dsp->fw].num_caps !=0 )wm_adsp_buffer_free (dsp);
Signature · 1 line
2.8.0.rc3
Mark Brown
maintainerApplied "ASoC: wm_adsp: free memory when unloaded or closed" to the asoc tree
In reply to Richard FitzgeraldThe patch
ASoC: wm_adsp: free memory when unloaded or closed
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
66225e98b985047ef214632413cc404a6341c960Mon Sep 17 00:00:00 2001
From: Richard Fitzgerald <[email protected]>
Date: Wed, 27 Apr 2016 14:58:27 +0100
Subject: [PATCH] ASoC: wm_adsp: free memory when unloaded or closed
The patch adds a wm_adsp2_remove() function to ensure that memory is freed when the driver is unloaded or shut down.
--- sound/soc/codecs/wm_adsp.c | 20 ++++++++++++++++++++ sound/soc/codecs/wm_adsp.h | 1 + 2 files changed, 21 insertions(+)
sound/soc/codecs/wm_adsp.c +20 -0
@@ -944,6 +944,13 @@ static void wm_adsp_ctl_work(struct work_struct *work)kfree (ctl_work); } +static void wm_adsp_free_ctl_blk (struct wm_coeff_ctl *ctl) +{ +kfree (ctl->cache); +kfree (ctl->name); +kfree (ctl); +} + static int wm_adsp_create_control(struct wm_adsp *dsp, const struct wm_adsp_alg_region *alg_region, unsigned int offset, unsigned int len,
@@ -2340,6 +2347,19 @@ int wm_adsp2_init(struct wm_adsp *dsp) }EXPORT_SYMBOL_GPL (wm_adsp2_init); +void wm_adsp2_remove (struct wm_adsp *dsp) +{ +struct wm_coeff_ctl *ctl; + +while (!list_empty (&dsp->ctl_list)) { + ctl = list_first_entry(&dsp->ctl_list, struct wm_coeff_ctl, + list); +list_del (&ctl->list); +wm_adsp_free_ctl_blk (ctl); + } +} +EXPORT_SYMBOL_GPL (wm_adsp2_remove); +int wm_adsp_compr_open (struct wm_adsp *dsp,struct snd_compr_stream *stream) {struct wm_adsp_compr *compr;
sound/soc/codecs/wm_adsp.h +1 -0
@@ -92,6 +92,7 @@ extern const struct snd_kcontrol_new wm_adsp_fw_controls[];int wm_adsp1_init (struct wm_adsp *dsp);int wm_adsp2_init (struct wm_adsp *dsp); +void wm_adsp2_remove (struct wm_adsp *dsp);int wm_adsp2_codec_probe (struct wm_adsp *dsp,struct snd_soc_codec *codec);int wm_adsp2_codec_remove (struct wm_adsp *dsp,struct snd_soc_codec *codec); int wm_adsp1_event(struct snd_soc_dapm_widget *w,
Signature · 1 line
2.8.0.rc3