2014-07-09 21:21:23

by Himangi Saraogi

[permalink] [raw]
Subject: [PATCH] ASoC: omap-dmic: use managed interfaces

This patch moves data allocated using clk_put and
snd_soc_register_component to the corresponding managed interfaces and
does away with the functions to free memory in the probe and remove
functions. The probe function is no longer required and is completely
removed.

Signed-off-by: Himangi Saraogi <[email protected]>
Acked-by: Julia Lawall <[email protected]>
---
sound/soc/omap/omap-dmic.c | 35 ++++++++---------------------------
1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 6925d71..b315b27 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -466,7 +466,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)

mutex_init(&dmic->mutex);

- dmic->fclk = clk_get(dmic->dev, "fck");
+ dmic->fclk = devm_clk_get(dmic->dev, "fck");
if (IS_ERR(dmic->fclk)) {
dev_err(dmic->dev, "cant get fck\n");
return -ENODEV;
@@ -475,8 +475,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
if (!res) {
dev_err(dmic->dev, "invalid dma memory resource\n");
- ret = -ENODEV;
- goto err_put_clk;
+ return -ENODEV;
}
dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;

@@ -484,34 +483,17 @@ static int asoc_dmic_probe(struct platform_device *pdev)

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(dmic->io_base)) {
- ret = PTR_ERR(dmic->io_base);
- goto err_put_clk;
- }
-
+ if (IS_ERR(dmic->io_base))
+ return PTR_ERR(dmic->io_base);

- ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component,
- &omap_dmic_dai, 1);
+ ret = devm_snd_soc_register_component(&pdev->dev, &omap_dmic_component,
+ &omap_dmic_dai, 1);
if (ret)
- goto err_put_clk;
+ return ret;

ret = omap_pcm_platform_register(&pdev->dev);
if (ret)
- goto err_put_clk;
-
- return 0;
-
-err_put_clk:
- clk_put(dmic->fclk);
- return ret;
-}
-
-static int asoc_dmic_remove(struct platform_device *pdev)
-{
- struct omap_dmic *dmic = platform_get_drvdata(pdev);
-
- snd_soc_unregister_component(&pdev->dev);
- clk_put(dmic->fclk);
+ return ret;

return 0;
}
@@ -529,7 +511,6 @@ static struct platform_driver asoc_dmic_driver = {
.of_match_table = omap_dmic_of_match,
},
.probe = asoc_dmic_probe,
- .remove = asoc_dmic_remove,
};

module_platform_driver(asoc_dmic_driver);
--
1.9.1


2014-07-10 06:30:54

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH] ASoC: omap-dmic: use managed interfaces

On 07/10/2014 12:21 AM, Himangi Saraogi wrote:
> This patch moves data allocated using clk_put and
> snd_soc_register_component to the corresponding managed interfaces and
> does away with the functions to free memory in the probe and remove
> functions. The probe function is no longer required and is completely
> removed.

Acked-by: Peter Ujfalusi <[email protected]>

>
> Signed-off-by: Himangi Saraogi <[email protected]>
> Acked-by: Julia Lawall <[email protected]>
> ---
> sound/soc/omap/omap-dmic.c | 35 ++++++++---------------------------
> 1 file changed, 8 insertions(+), 27 deletions(-)
>
> diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
> index 6925d71..b315b27 100644
> --- a/sound/soc/omap/omap-dmic.c
> +++ b/sound/soc/omap/omap-dmic.c
> @@ -466,7 +466,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
>
> mutex_init(&dmic->mutex);
>
> - dmic->fclk = clk_get(dmic->dev, "fck");
> + dmic->fclk = devm_clk_get(dmic->dev, "fck");
> if (IS_ERR(dmic->fclk)) {
> dev_err(dmic->dev, "cant get fck\n");
> return -ENODEV;
> @@ -475,8 +475,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
> if (!res) {
> dev_err(dmic->dev, "invalid dma memory resource\n");
> - ret = -ENODEV;
> - goto err_put_clk;
> + return -ENODEV;
> }
> dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
>
> @@ -484,34 +483,17 @@ static int asoc_dmic_probe(struct platform_device *pdev)
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
> dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
> - if (IS_ERR(dmic->io_base)) {
> - ret = PTR_ERR(dmic->io_base);
> - goto err_put_clk;
> - }
> -
> + if (IS_ERR(dmic->io_base))
> + return PTR_ERR(dmic->io_base);
>
> - ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component,
> - &omap_dmic_dai, 1);
> + ret = devm_snd_soc_register_component(&pdev->dev, &omap_dmic_component,
> + &omap_dmic_dai, 1);
> if (ret)
> - goto err_put_clk;
> + return ret;
>
> ret = omap_pcm_platform_register(&pdev->dev);
> if (ret)
> - goto err_put_clk;
> -
> - return 0;
> -
> -err_put_clk:
> - clk_put(dmic->fclk);
> - return ret;
> -}
> -
> -static int asoc_dmic_remove(struct platform_device *pdev)
> -{
> - struct omap_dmic *dmic = platform_get_drvdata(pdev);
> -
> - snd_soc_unregister_component(&pdev->dev);
> - clk_put(dmic->fclk);
> + return ret;
>
> return 0;
> }
> @@ -529,7 +511,6 @@ static struct platform_driver asoc_dmic_driver = {
> .of_match_table = omap_dmic_of_match,
> },
> .probe = asoc_dmic_probe,
> - .remove = asoc_dmic_remove,
> };
>
> module_platform_driver(asoc_dmic_driver);
>


--
P?ter

2014-07-10 10:44:53

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: omap-dmic: use managed interfaces

On Thu, Jul 10, 2014 at 02:51:12AM +0530, Himangi Saraogi wrote:
> This patch moves data allocated using clk_put and
> snd_soc_register_component to the corresponding managed interfaces and
> does away with the functions to free memory in the probe and remove
> functions. The probe function is no longer required and is completely
> removed.

This doesn't apply against current code, please check and resend.


Attachments:
(No filename) (410.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments