linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-mmc@vger.kernel.org
Cc: linux-kernel@lists.codethink.co.uk, ulf.hansson@linaro.org,
	chris@printf.net, magnus.damm@opensource.se,
	linus-sh@vger.kernel.org, horms@verge.net.au,
	Ben Dooks <ben.dooks@codethink.co.uk>
Subject: [PATCH 4/6] mmc: sh-mmcif: use devm_ for irq management
Date: Wed,  4 Jun 2014 12:42:11 +0100	[thread overview]
Message-ID: <1401882133-11050-5-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1401882133-11050-1-git-send-email-ben.dooks@codethink.co.uk>

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>
---
 drivers/mmc/host/sh_mmcif.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index ae278a5..cc6858d 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1439,17 +1439,19 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
 
 	name = irq[1] < 0 ? dev_name(&pdev->dev) : "sh_mmc:error";
-	ret = request_threaded_irq(irq[0], sh_mmcif_intr, sh_mmcif_irqt, 0, name, host);
+	ret = devm_request_threaded_irq(&pdev->dev, irq[0], sh_mmcif_intr,
+					sh_mmcif_irqt, 0, name, host);
 	if (ret) {
 		dev_err(&pdev->dev, "request_irq error (%s)\n", name);
-		goto ereqirq0;
+		goto err_irq;
 	}
 	if (irq[1] >= 0) {
-		ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt,
-					   0, "sh_mmc:int", host);
+		ret = devm_request_threaded_irq(&pdev->dev, irq[1],
+						sh_mmcif_intr, sh_mmcif_irqt,
+						0, "sh_mmc:int", host);
 		if (ret) {
 			dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
-			goto ereqirq1;
+			goto err_irq;
 		}
 	}
 
@@ -1476,11 +1478,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 
 emmcaddh:
 erqcd:
-	if (irq[1] >= 0)
-		free_irq(irq[1], host);
-ereqirq1:
-	free_irq(irq[0], host);
-ereqirq0:
+err_irq:
 	pm_runtime_suspend(&pdev->dev);
 err_clk:
 	clk_disable_unprepare(host->hclk);
@@ -1494,7 +1492,6 @@ err_host:
 static int sh_mmcif_remove(struct platform_device *pdev)
 {
 	struct sh_mmcif_host *host = platform_get_drvdata(pdev);
-	int irq[2];
 
 	host->dying = true;
 	clk_prepare_enable(host->hclk);
@@ -1512,13 +1509,6 @@ static int sh_mmcif_remove(struct platform_device *pdev)
 	 */
 	cancel_delayed_work_sync(&host->timeout_work);
 
-	irq[0] = platform_get_irq(pdev, 0);
-	irq[1] = platform_get_irq(pdev, 1);
-
-	free_irq(irq[0], host);
-	if (irq[1] >= 0)
-		free_irq(irq[1], host);
-
 	clk_disable_unprepare(host->hclk);
 	mmc_free_host(host->mmc);
 	pm_runtime_put_sync(&pdev->dev);
-- 
2.0.0.rc2


  parent reply	other threads:[~2014-06-04 11:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 11:42 resend - sh mmcif driver cleanup patch series Ben Dooks
2014-06-04 11:42 ` [PATCH 1/6] mmc: sh-mmcif: update to print version and bus clock rate on probe Ben Dooks
2014-06-04 12:57   ` Ulf Hansson
2014-06-04 11:42 ` [PATCH 2/6] mmc: sh-mmcif: use devm_ for ioremap Ben Dooks
2014-06-04 12:58   ` Ulf Hansson
2014-06-04 11:42 ` [PATCH 3/6] mmc: sh-mmcif: use devm_ for clock management Ben Dooks
2014-06-04 12:59   ` Ulf Hansson
2014-06-04 11:42 ` Ben Dooks [this message]
2014-06-04 13:00   ` [PATCH 4/6] mmc: sh-mmcif: use devm_ for irq management Ulf Hansson
2014-06-04 11:42 ` [PATCH 5/6] mmc: sh-mmcif: no need to call pm_runtime_suspend on error Ben Dooks
2014-06-04 13:01   ` Ulf Hansson
2014-06-04 11:42 ` [PATCH 6/6] mmc: sh-mmcif: final error path cleanup Ben Dooks
2014-06-04 13:02   ` Ulf Hansson
2014-06-16  8:51 ` resend - sh mmcif driver cleanup patch series Ulf Hansson
  -- strict thread matches above, loose matches on Subject: below --
2014-04-01 10:25 cleanups for sh-mmcif driver Ben Dooks
2014-04-01 10:25 ` [PATCH 4/6] mmc: sh-mmcif: use devm_ for irq management Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401882133-11050-5-git-send-email-ben.dooks@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=chris@printf.net \
    --cc=horms@verge.net.au \
    --cc=linus-sh@vger.kernel.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=magnus.damm@opensource.se \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).