All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pramod Gurav <pramod.gurav@smartplayin.com>
To: linux-kernel@vger.kernel.org
Cc: David Brown <davidb@codeaurora.org>,
	Daniel Walker <dwalker@fifo99.com>,
	Bryan Huntsman <bryanh@codeaurora.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH 2/5] mmc: msm_sdcc: Add support for platform_driver remove function
Date: Tue, 16 Sep 2014 16:47:45 +0530	[thread overview]
Message-ID: <1410866268-15185-3-git-send-email-pramod.gurav@smartplayin.com> (raw)
In-Reply-To: <1410866268-15185-1-git-send-email-pramod.gurav@smartplayin.com>

This change adds remove function in platform_driver to clean unloading

Cc: David Brown <davidb@codeaurora.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: linux-mmc@vger.kernel.org
CC: linux-arm-msm@vger.kernel.org
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/mmc/host/msm_sdcc.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 2b8ac9c..3e0536d 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1360,6 +1360,7 @@ msmsdcc_probe(struct platform_device *pdev)
 	if (ret)
 		goto clk_disable;
 
+	platform_set_drvdata(pdev, host);
 	mmc_set_drvdata(pdev, mmc);
 	mmc_add_host(mmc);
 
@@ -1406,6 +1407,22 @@ msmsdcc_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static int msmsdcc_remove(struct platform_device *pdev)
+{
+	struct msmsdcc_host *host = platform_get_drvdata(pdev);
+
+	msmsdcc_disable_clocks(host, 0);
+	clk_unprepare(host->clk);
+	clk_unprepare(host->pclk);
+	if (host->dmares)
+		dma_free_coherent(NULL, sizeof(struct msmsdcc_nc_dmadata),
+				  host->dma.nc, host->dma.nc_busaddr);
+	tasklet_kill(&host->dma_tlet);
+	mmc_free_host(host->mmc);
+
+	return 0;
+}
+
 #ifdef CONFIG_PM
 static int
 msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
@@ -1452,6 +1469,7 @@ msmsdcc_resume(struct platform_device *dev)
 
 static struct platform_driver msmsdcc_driver = {
 	.probe		= msmsdcc_probe,
+	.remove		= msmsdcc_remove,
 	.suspend	= msmsdcc_suspend,
 	.resume		= msmsdcc_resume,
 	.driver		= {
-- 
1.7.9.5

  parent reply	other threads:[~2014-09-16 11:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 11:17 [PATCH 0/5] mmc: msm_sdcc: Cleanups Pramod Gurav
2014-09-16 11:17 ` [PATCH 1/5] mmc: msm_sdcc: Switch to using managed resources Pramod Gurav
2014-09-16 11:17 ` Pramod Gurav [this message]
2014-09-16 11:17 ` [PATCH 3/5] mmc: msm_sdcc: Replace pr_ with dev_ Pramod Gurav
2014-09-16 11:17 ` [PATCH 4/5] mmc: msm_sdcc: Remove duplicate check around dmares Pramod Gurav
2014-09-16 11:17 ` [PATCH 5/5] mmc: msm_sdcc: Remove unwanted initializations in probe Pramod Gurav

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=1410866268-15185-3-git-send-email-pramod.gurav@smartplayin.com \
    --to=pramod.gurav@smartplayin.com \
    --cc=bryanh@codeaurora.org \
    --cc=davidb@codeaurora.org \
    --cc=dwalker@fifo99.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.