ASoC: mxs-saif: Use devm_clk_get()
Using devm_clk_get can make the code simpler and smaller. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
5f800080ca
commit
730963f819
1 changed files with 7 additions and 13 deletions
|
@ -704,7 +704,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saif->clk = clk_get(&pdev->dev, NULL);
|
saif->clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(saif->clk)) {
|
if (IS_ERR(saif->clk)) {
|
||||||
ret = PTR_ERR(saif->clk);
|
ret = PTR_ERR(saif->clk);
|
||||||
dev_err(&pdev->dev, "Cannot get the clock: %d\n",
|
dev_err(&pdev->dev, "Cannot get the clock: %d\n",
|
||||||
|
@ -717,8 +717,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
saif->base = devm_request_and_ioremap(&pdev->dev, iores);
|
saif->base = devm_request_and_ioremap(&pdev->dev, iores);
|
||||||
if (!saif->base) {
|
if (!saif->base) {
|
||||||
dev_err(&pdev->dev, "ioremap failed\n");
|
dev_err(&pdev->dev, "ioremap failed\n");
|
||||||
ret = -ENODEV;
|
return -ENODEV;
|
||||||
goto failed_get_resource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
|
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
|
||||||
|
@ -731,7 +730,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
&saif->dma_param.chan_num);
|
&saif->dma_param.chan_num);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to get dma channel\n");
|
dev_err(&pdev->dev, "failed to get dma channel\n");
|
||||||
goto failed_get_resource;
|
return ret;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
saif->dma_param.chan_num = dmares->start;
|
saif->dma_param.chan_num = dmares->start;
|
||||||
|
@ -742,7 +741,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
ret = saif->irq;
|
ret = saif->irq;
|
||||||
dev_err(&pdev->dev, "failed to get irq resource: %d\n",
|
dev_err(&pdev->dev, "failed to get irq resource: %d\n",
|
||||||
ret);
|
ret);
|
||||||
goto failed_get_resource;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saif->dev = &pdev->dev;
|
saif->dev = &pdev->dev;
|
||||||
|
@ -750,7 +749,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
"mxs-saif", saif);
|
"mxs-saif", saif);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to request irq\n");
|
dev_err(&pdev->dev, "failed to request irq\n");
|
||||||
goto failed_get_resource;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
|
saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
|
||||||
|
@ -758,7 +757,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
ret = saif->dma_param.chan_irq;
|
ret = saif->dma_param.chan_irq;
|
||||||
dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
|
dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
|
||||||
ret);
|
ret);
|
||||||
goto failed_get_resource;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, saif);
|
platform_set_drvdata(pdev, saif);
|
||||||
|
@ -766,7 +765,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai);
|
ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "register DAI failed\n");
|
dev_err(&pdev->dev, "register DAI failed\n");
|
||||||
goto failed_get_resource;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mxs_pcm_platform_register(&pdev->dev);
|
ret = mxs_pcm_platform_register(&pdev->dev);
|
||||||
|
@ -779,19 +778,14 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
failed_pdev_alloc:
|
failed_pdev_alloc:
|
||||||
snd_soc_unregister_dai(&pdev->dev);
|
snd_soc_unregister_dai(&pdev->dev);
|
||||||
failed_get_resource:
|
|
||||||
clk_put(saif->clk);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devexit mxs_saif_remove(struct platform_device *pdev)
|
static int __devexit mxs_saif_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct mxs_saif *saif = platform_get_drvdata(pdev);
|
|
||||||
|
|
||||||
mxs_pcm_platform_unregister(&pdev->dev);
|
mxs_pcm_platform_unregister(&pdev->dev);
|
||||||
snd_soc_unregister_dai(&pdev->dev);
|
snd_soc_unregister_dai(&pdev->dev);
|
||||||
clk_put(saif->clk);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue