From: Balaji T K <balajitk@ti.com>
To: linux-mmc@vger.kernel.org, chris@printf.net, ulf.hansson@linaro.org
Cc: linux-omap@vger.kernel.org, Balaji T K <balajitk@ti.com>
Subject: [PATCH v2 4/6] mmc: omap_hsmmc: use devm_ioremap_resource
Date: Fri, 9 May 2014 22:16:51 +0530 [thread overview]
Message-ID: <1399654013-28262-5-git-send-email-balajitk@ti.com> (raw)
In-Reply-To: <1399654013-28262-1-git-send-email-balajitk@ti.com>
With devm_ioremap_resource conversion release_mem_region, iounmap can be
removed in clean up path
Signed-off-by: Balaji T K <balajitk@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6179fe3..140425c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1851,6 +1851,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
unsigned tx_req, rx_req;
struct pinctrl *pinctrl;
const struct omap_mmc_of_data *data;
+ void __iomem *base;
match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev);
if (match) {
@@ -1881,9 +1882,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (res == NULL || irq < 0)
return -ENXIO;
- res = request_mem_region(res->start, resource_size(res), pdev->name);
- if (res == NULL)
- return -EBUSY;
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
ret = omap_hsmmc_gpio_init(pdata);
if (ret)
@@ -1904,7 +1905,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host->irq = irq;
host->slot_id = 0;
host->mapbase = res->start + pdata->reg_offset;
- host->base = ioremap(host->mapbase, SZ_4K);
+ host->base = base + pdata->reg_offset;
host->power_mode = MMC_POWER_OFF;
host->next_data.cookie = 1;
host->pbias_enabled = 0;
@@ -2104,21 +2105,16 @@ err_irq:
if (host->dbclk)
clk_disable_unprepare(host->dbclk);
err1:
- iounmap(host->base);
mmc_free_host(mmc);
err_alloc:
omap_hsmmc_gpio_free(pdata);
err:
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res)
- release_mem_region(res->start, resource_size(res));
return ret;
}
static int omap_hsmmc_remove(struct platform_device *pdev)
{
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
- struct resource *res;
pm_runtime_get_sync(host->dev);
mmc_remove_host(host->mmc);
@@ -2138,13 +2134,8 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
clk_disable_unprepare(host->dbclk);
omap_hsmmc_gpio_free(host->pdata);
- iounmap(host->base);
mmc_free_host(host->mmc);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res)
- release_mem_region(res->start, resource_size(res));
-
return 0;
}
--
1.7.5.4
next prev parent reply other threads:[~2014-05-09 16:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 16:46 [PATCH v2 0/6] mmc: omap_hsmmc: convert to use devm_* and fixes Balaji T K
2014-05-09 16:46 ` [PATCH v2 1/6] mmc: omap_hsmmc: use devm_clk_get Balaji T K
2014-05-12 8:33 ` Ulf Hansson
2014-05-12 13:33 ` Balaji T K
2014-05-12 13:50 ` Ulf Hansson
2014-05-15 13:23 ` [PATCH] mmc: omap_hsmmc: use IS_ERR macro for error checking Balaji T K
2014-05-21 10:10 ` Ulf Hansson
2014-05-15 13:25 ` [PATCH v2 1/6] mmc: omap_hsmmc: use devm_clk_get Balaji T K
2014-05-09 16:46 ` [PATCH v2 2/6] mmc: omap_hsmmc: use devm_request_irq Balaji T K
2014-05-09 16:46 ` [PATCH v2 3/6] mmc: omap_hsmmc: use devm_request_threaded_irq Balaji T K
2014-05-09 16:46 ` Balaji T K [this message]
2014-05-09 16:46 ` [PATCH v2 5/6] mmc: omap_hsmmc: fix cmd23 multiblock read/write Balaji T K
2014-05-09 16:46 ` [PATCH v2 6/6] mmc: omap_hsmmc: split omap-dma header file Balaji T K
2014-05-15 13:38 ` Balaji T K
2014-05-16 21:41 ` Tony Lindgren
2014-05-19 11:53 ` Balaji T K
2014-05-19 16:54 ` Tony Lindgren
2014-05-20 13:28 ` Balaji T K
2014-05-20 14:50 ` Tony Lindgren
2014-05-21 10:09 ` [PATCH v2 0/6] mmc: omap_hsmmc: convert to use devm_* and fixes Ulf Hansson
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=1399654013-28262-5-git-send-email-balajitk@ti.com \
--to=balajitk@ti.com \
--cc=chris@printf.net \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@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 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).