ASoC: SPEAr spdif_{in,out}: use devm for clk and a few more cleanups

Drop dev_set_drvdata as this is handled in the core and use
devm_request_and_ioremap instead of devm_ioremap to properly register the
address range used

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Uwe Kleine-König 2013-05-08 11:47:38 +02:00 committed by Mark Brown
parent 52c102e534
commit bfcc74e610
2 changed files with 3 additions and 11 deletions

View File

@ -231,7 +231,7 @@ static int spdif_in_probe(struct platform_device *pdev)
if (host->irq < 0) if (host->irq < 0)
return -EINVAL; return -EINVAL;
host->clk = clk_get(&pdev->dev, NULL); host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) if (IS_ERR(host->clk))
return PTR_ERR(host->clk); return PTR_ERR(host->clk);
@ -253,7 +253,6 @@ static int spdif_in_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, host->irq, spdif_in_irq, 0, ret = devm_request_irq(&pdev->dev, host->irq, spdif_in_irq, 0,
"spdif-in", host); "spdif-in", host);
if (ret) { if (ret) {
clk_put(host->clk);
dev_warn(&pdev->dev, "request_irq failed\n"); dev_warn(&pdev->dev, "request_irq failed\n");
return ret; return ret;
} }
@ -273,14 +272,10 @@ static int spdif_in_remove(struct platform_device *pdev)
struct spdif_in_dev *host = dev_get_drvdata(&pdev->dev); struct spdif_in_dev *host = dev_get_drvdata(&pdev->dev);
snd_soc_unregister_component(&pdev->dev); snd_soc_unregister_component(&pdev->dev);
dev_set_drvdata(&pdev->dev, NULL);
clk_put(host->clk);
return 0; return 0;
} }
static struct platform_driver spdif_in_driver = { static struct platform_driver spdif_in_driver = {
.probe = spdif_in_probe, .probe = spdif_in_probe,
.remove = spdif_in_remove, .remove = spdif_in_remove,

View File

@ -298,14 +298,14 @@ static int spdif_out_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
host->io_base = devm_ioremap(&pdev->dev, res->start, host->io_base = devm_request_and_ioremap(&pdev->dev, res->start,
resource_size(res)); resource_size(res));
if (!host->io_base) { if (!host->io_base) {
dev_warn(&pdev->dev, "ioremap failed\n"); dev_warn(&pdev->dev, "ioremap failed\n");
return -ENOMEM; return -ENOMEM;
} }
host->clk = clk_get(&pdev->dev, NULL); host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) if (IS_ERR(host->clk))
return PTR_ERR(host->clk); return PTR_ERR(host->clk);
@ -334,9 +334,6 @@ static int spdif_out_remove(struct platform_device *pdev)
struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev); struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
snd_soc_unregister_component(&pdev->dev); snd_soc_unregister_component(&pdev->dev);
dev_set_drvdata(&pdev->dev, NULL);
clk_put(host->clk);
return 0; return 0;
} }