summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorBen Dooks <ben.dooks@codethink.co.uk>2014-06-04 07:42:10 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2014-07-09 05:26:01 -0400
commit46991005e1f13e061359335b86d7847562feffde (patch)
treed353393dedca99863e5af49249a9e43388617a50 /drivers/mmc
parent18f55fcc9d0e6f40fdc7f81afcbe950da30fbcf9 (diff)
mmc: sh-mmcif: use devm_ for clock management
Use the devm_clk_get() code to get the clock and allow it to be freed automatically on release. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sh_mmcif.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index e25821fe4e9e..ec9bda30da73 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1390,7 +1390,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
1390 1390
1391 ret = mmc_of_parse(mmc); 1391 ret = mmc_of_parse(mmc);
1392 if (ret < 0) 1392 if (ret < 0)
1393 goto eofparse; 1393 goto err_host;
1394 1394
1395 host = mmc_priv(mmc); 1395 host = mmc_priv(mmc);
1396 host->mmc = mmc; 1396 host->mmc = mmc;
@@ -1420,19 +1420,19 @@ static int sh_mmcif_probe(struct platform_device *pdev)
1420 pm_runtime_enable(&pdev->dev); 1420 pm_runtime_enable(&pdev->dev);
1421 host->power = false; 1421 host->power = false;
1422 1422
1423 host->hclk = clk_get(&pdev->dev, NULL); 1423 host->hclk = devm_clk_get(&pdev->dev, NULL);
1424 if (IS_ERR(host->hclk)) { 1424 if (IS_ERR(host->hclk)) {
1425 ret = PTR_ERR(host->hclk); 1425 ret = PTR_ERR(host->hclk);
1426 dev_err(&pdev->dev, "cannot get clock: %d\n", ret); 1426 dev_err(&pdev->dev, "cannot get clock: %d\n", ret);
1427 goto eclkget; 1427 goto err_pm;
1428 } 1428 }
1429 ret = sh_mmcif_clk_update(host); 1429 ret = sh_mmcif_clk_update(host);
1430 if (ret < 0) 1430 if (ret < 0)
1431 goto eclkupdate; 1431 goto err_pm;
1432 1432
1433 ret = pm_runtime_resume(&pdev->dev); 1433 ret = pm_runtime_resume(&pdev->dev);
1434 if (ret < 0) 1434 if (ret < 0)
1435 goto eresume; 1435 goto err_clk;
1436 1436
1437 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work); 1437 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work);
1438 1438
@@ -1483,13 +1483,11 @@ ereqirq1:
1483 free_irq(irq[0], host); 1483 free_irq(irq[0], host);
1484ereqirq0: 1484ereqirq0:
1485 pm_runtime_suspend(&pdev->dev); 1485 pm_runtime_suspend(&pdev->dev);
1486eresume: 1486err_clk:
1487 clk_disable_unprepare(host->hclk); 1487 clk_disable_unprepare(host->hclk);
1488eclkupdate: 1488err_pm:
1489 clk_put(host->hclk);
1490eclkget:
1491 pm_runtime_disable(&pdev->dev); 1489 pm_runtime_disable(&pdev->dev);
1492eofparse: 1490err_host:
1493 mmc_free_host(mmc); 1491 mmc_free_host(mmc);
1494 return ret; 1492 return ret;
1495} 1493}