mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 21:24:00 +08:00
ASoC: omap-dmic: Use devm_clk_get
This patch introduces the use of managed interfaces like devm_clk_get and does away with the clk_puts in the probe and remove functions. A label is also done away with. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
159baadf59
commit
9cb0fe9b0e
@ -466,7 +466,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
mutex_init(&dmic->mutex);
|
mutex_init(&dmic->mutex);
|
||||||
|
|
||||||
dmic->fclk = clk_get(dmic->dev, "fck");
|
dmic->fclk = devm_clk_get(dmic->dev, "fck");
|
||||||
if (IS_ERR(dmic->fclk)) {
|
if (IS_ERR(dmic->fclk)) {
|
||||||
dev_err(dmic->dev, "cant get fck\n");
|
dev_err(dmic->dev, "cant get fck\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -475,8 +475,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
|
|||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(dmic->dev, "invalid dma memory resource\n");
|
dev_err(dmic->dev, "invalid dma memory resource\n");
|
||||||
ret = -ENODEV;
|
return -ENODEV;
|
||||||
goto err_put_clk;
|
|
||||||
}
|
}
|
||||||
dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
|
dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
|
||||||
|
|
||||||
@ -484,34 +483,19 @@ static int asoc_dmic_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
|
||||||
dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
|
dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (IS_ERR(dmic->io_base)) {
|
if (IS_ERR(dmic->io_base))
|
||||||
ret = PTR_ERR(dmic->io_base);
|
return PTR_ERR(dmic->io_base);
|
||||||
goto err_put_clk;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||||
&omap_dmic_component,
|
&omap_dmic_component,
|
||||||
&omap_dmic_dai, 1);
|
&omap_dmic_dai, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_put_clk;
|
return ret;
|
||||||
|
|
||||||
ret = omap_pcm_platform_register(&pdev->dev);
|
ret = omap_pcm_platform_register(&pdev->dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_put_clk;
|
return ret;
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
clk_put(dmic->fclk);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -529,7 +513,6 @@ static struct platform_driver asoc_dmic_driver = {
|
|||||||
.of_match_table = omap_dmic_of_match,
|
.of_match_table = omap_dmic_of_match,
|
||||||
},
|
},
|
||||||
.probe = asoc_dmic_probe,
|
.probe = asoc_dmic_probe,
|
||||||
.remove = asoc_dmic_remove,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(asoc_dmic_driver);
|
module_platform_driver(asoc_dmic_driver);
|
||||||
|
Loading…
Reference in New Issue
Block a user