Commit 77fae219 authored by Balaji T K's avatar Balaji T K Committed by Chris Ball

mmc: omap_hsmmc: use devm_ioremap_resource

With devm_ioremap_resource conversion release_mem_region, iounmap can be
removed in clean up path
Signed-off-by: default avatarBalaji T K <balajitk@ti.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent 9fa0e05e
...@@ -1851,6 +1851,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) ...@@ -1851,6 +1851,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
unsigned tx_req, rx_req; unsigned tx_req, rx_req;
struct pinctrl *pinctrl; struct pinctrl *pinctrl;
const struct omap_mmc_of_data *data; const struct omap_mmc_of_data *data;
void __iomem *base;
match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev); match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev);
if (match) { if (match) {
...@@ -1881,9 +1882,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev) ...@@ -1881,9 +1882,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (res == NULL || irq < 0) if (res == NULL || irq < 0)
return -ENXIO; return -ENXIO;
res = request_mem_region(res->start, resource_size(res), pdev->name); base = devm_ioremap_resource(&pdev->dev, res);
if (res == NULL) if (IS_ERR(base))
return -EBUSY; return PTR_ERR(base);
ret = omap_hsmmc_gpio_init(pdata); ret = omap_hsmmc_gpio_init(pdata);
if (ret) if (ret)
...@@ -1904,7 +1905,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) ...@@ -1904,7 +1905,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host->irq = irq; host->irq = irq;
host->slot_id = 0; host->slot_id = 0;
host->mapbase = res->start + pdata->reg_offset; 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->power_mode = MMC_POWER_OFF;
host->next_data.cookie = 1; host->next_data.cookie = 1;
host->pbias_enabled = 0; host->pbias_enabled = 0;
...@@ -2104,21 +2105,16 @@ static int omap_hsmmc_probe(struct platform_device *pdev) ...@@ -2104,21 +2105,16 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (host->dbclk) if (host->dbclk)
clk_disable_unprepare(host->dbclk); clk_disable_unprepare(host->dbclk);
err1: err1:
iounmap(host->base);
mmc_free_host(mmc); mmc_free_host(mmc);
err_alloc: err_alloc:
omap_hsmmc_gpio_free(pdata); omap_hsmmc_gpio_free(pdata);
err: err:
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res->start, resource_size(res));
return ret; return ret;
} }
static int omap_hsmmc_remove(struct platform_device *pdev) static int omap_hsmmc_remove(struct platform_device *pdev)
{ {
struct omap_hsmmc_host *host = platform_get_drvdata(pdev); struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
struct resource *res;
pm_runtime_get_sync(host->dev); pm_runtime_get_sync(host->dev);
mmc_remove_host(host->mmc); mmc_remove_host(host->mmc);
...@@ -2138,13 +2134,8 @@ static int omap_hsmmc_remove(struct platform_device *pdev) ...@@ -2138,13 +2134,8 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
clk_disable_unprepare(host->dbclk); clk_disable_unprepare(host->dbclk);
omap_hsmmc_gpio_free(host->pdata); omap_hsmmc_gpio_free(host->pdata);
iounmap(host->base);
mmc_free_host(host->mmc); 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment