aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-08-26 12:00:59 -0400
committerChris Ball <cjb@laptop.org>2012-10-03 10:05:21 -0400
commitac940938df138acd241dc5ae9a933416da036a35 (patch)
treeb8cc3e9626ddcd2df2279cd3bf1a874dba13a42f
parentcd1b00eb24b0b204303211df7ffd1a77a1005824 (diff)
mmc: mmci: use clk_prepare_enable and clk_disable_unprepare
clk_prepare_enable and clk_disable_unprepare combine clk_prepare and clk_enable, and clk_disable and clk_unprepare. They make the code more concise, and ensure that clk_unprepare is called when clk_enable fails. A simplified version of the semantic patch that introduces calls to these functions is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression e; @@ - clk_prepare(e); - clk_enable(e); + clk_prepare_enable(e); @@ expression e; @@ - clk_disable(e); - clk_unprepare(e); + clk_disable_unprepare(e); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/mmci.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 50ff19a62368..edc3e9baf0e7 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1309,14 +1309,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
1309 goto host_free; 1309 goto host_free;
1310 } 1310 }
1311 1311
1312 ret = clk_prepare(host->clk); 1312 ret = clk_prepare_enable(host->clk);
1313 if (ret) 1313 if (ret)
1314 goto clk_free; 1314 goto clk_free;
1315 1315
1316 ret = clk_enable(host->clk);
1317 if (ret)
1318 goto clk_unprep;
1319
1320 host->plat = plat; 1316 host->plat = plat;
1321 host->variant = variant; 1317 host->variant = variant;
1322 host->mclk = clk_get_rate(host->clk); 1318 host->mclk = clk_get_rate(host->clk);
@@ -1515,9 +1511,7 @@ static int __devinit mmci_probe(struct amba_device *dev,
1515 err_gpio_cd: 1511 err_gpio_cd:
1516 iounmap(host->base); 1512 iounmap(host->base);
1517 clk_disable: 1513 clk_disable:
1518 clk_disable(host->clk); 1514 clk_disable_unprepare(host->clk);
1519 clk_unprep:
1520 clk_unprepare(host->clk);
1521 clk_free: 1515 clk_free:
1522 clk_put(host->clk); 1516 clk_put(host->clk);
1523 host_free: 1517 host_free:
@@ -1564,8 +1558,7 @@ static int __devexit mmci_remove(struct amba_device *dev)
1564 gpio_free(host->gpio_cd); 1558 gpio_free(host->gpio_cd);
1565 1559
1566 iounmap(host->base); 1560 iounmap(host->base);
1567 clk_disable(host->clk); 1561 clk_disable_unprepare(host->clk);
1568 clk_unprepare(host->clk);
1569 clk_put(host->clk); 1562 clk_put(host->clk);
1570 1563
1571 if (host->vcc) 1564 if (host->vcc)