diff options
author | Ben Dooks <ben.dooks@codethink.co.uk> | 2014-06-04 07:42:11 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-07-09 05:26:01 -0400 |
commit | 6f4789e6a81f4678b8ffa73a6226be0f99955190 (patch) | |
tree | 0626aec8031568496c314a207eb5c1e4b7c043d0 /drivers/mmc | |
parent | 46991005e1f13e061359335b86d7847562feffde (diff) |
mmc: sh-mmcif: use devm_ for irq management
Use devm_request_threaded_irq() for the host interrupt handlers so we
do not have to worry about freeing them on exit or error. Tidies up the
exit path code for the driver.
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.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index ec9bda30da73..a0776cec070c 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -1440,17 +1440,19 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
1440 | sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL); | 1440 | sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL); |
1441 | 1441 | ||
1442 | name = irq[1] < 0 ? dev_name(&pdev->dev) : "sh_mmc:error"; | 1442 | name = irq[1] < 0 ? dev_name(&pdev->dev) : "sh_mmc:error"; |
1443 | ret = request_threaded_irq(irq[0], sh_mmcif_intr, sh_mmcif_irqt, 0, name, host); | 1443 | ret = devm_request_threaded_irq(&pdev->dev, irq[0], sh_mmcif_intr, |
1444 | sh_mmcif_irqt, 0, name, host); | ||
1444 | if (ret) { | 1445 | if (ret) { |
1445 | dev_err(&pdev->dev, "request_irq error (%s)\n", name); | 1446 | dev_err(&pdev->dev, "request_irq error (%s)\n", name); |
1446 | goto ereqirq0; | 1447 | goto err_irq; |
1447 | } | 1448 | } |
1448 | if (irq[1] >= 0) { | 1449 | if (irq[1] >= 0) { |
1449 | ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt, | 1450 | ret = devm_request_threaded_irq(&pdev->dev, irq[1], |
1450 | 0, "sh_mmc:int", host); | 1451 | sh_mmcif_intr, sh_mmcif_irqt, |
1452 | 0, "sh_mmc:int", host); | ||
1451 | if (ret) { | 1453 | if (ret) { |
1452 | dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n"); | 1454 | dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n"); |
1453 | goto ereqirq1; | 1455 | goto err_irq; |
1454 | } | 1456 | } |
1455 | } | 1457 | } |
1456 | 1458 | ||
@@ -1477,11 +1479,7 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
1477 | 1479 | ||
1478 | emmcaddh: | 1480 | emmcaddh: |
1479 | erqcd: | 1481 | erqcd: |
1480 | if (irq[1] >= 0) | 1482 | err_irq: |
1481 | free_irq(irq[1], host); | ||
1482 | ereqirq1: | ||
1483 | free_irq(irq[0], host); | ||
1484 | ereqirq0: | ||
1485 | pm_runtime_suspend(&pdev->dev); | 1483 | pm_runtime_suspend(&pdev->dev); |
1486 | err_clk: | 1484 | err_clk: |
1487 | clk_disable_unprepare(host->hclk); | 1485 | clk_disable_unprepare(host->hclk); |
@@ -1495,7 +1493,6 @@ err_host: | |||
1495 | static int sh_mmcif_remove(struct platform_device *pdev) | 1493 | static int sh_mmcif_remove(struct platform_device *pdev) |
1496 | { | 1494 | { |
1497 | struct sh_mmcif_host *host = platform_get_drvdata(pdev); | 1495 | struct sh_mmcif_host *host = platform_get_drvdata(pdev); |
1498 | int irq[2]; | ||
1499 | 1496 | ||
1500 | host->dying = true; | 1497 | host->dying = true; |
1501 | clk_prepare_enable(host->hclk); | 1498 | clk_prepare_enable(host->hclk); |
@@ -1513,13 +1510,6 @@ static int sh_mmcif_remove(struct platform_device *pdev) | |||
1513 | */ | 1510 | */ |
1514 | cancel_delayed_work_sync(&host->timeout_work); | 1511 | cancel_delayed_work_sync(&host->timeout_work); |
1515 | 1512 | ||
1516 | irq[0] = platform_get_irq(pdev, 0); | ||
1517 | irq[1] = platform_get_irq(pdev, 1); | ||
1518 | |||
1519 | free_irq(irq[0], host); | ||
1520 | if (irq[1] >= 0) | ||
1521 | free_irq(irq[1], host); | ||
1522 | |||
1523 | clk_disable_unprepare(host->hclk); | 1513 | clk_disable_unprepare(host->hclk); |
1524 | mmc_free_host(host->mmc); | 1514 | mmc_free_host(host->mmc); |
1525 | pm_runtime_put_sync(&pdev->dev); | 1515 | pm_runtime_put_sync(&pdev->dev); |