mmc: sdhci-pltfm: Use devm_ioremap_resource()
authorBeomho Seo <beomho.seo@samsung.com>
Tue, 3 Dec 2013 08:25:13 +0000 (17:25 +0900)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 15 May 2014 05:25:39 +0000 (07:25 +0200)
This patch devm_ioremap_resource for replace request region and ioremap.

Change-Id: I6b63e1db0d0c9d6d8cf89a93d57db0b253418e3a
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
drivers/mmc/host/sdhci-pltfm.c

index cd0f1f6..be90c47 100644 (file)
@@ -154,18 +154,10 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
                host->quirks = pdata->quirks;
        host->irq = platform_get_irq(pdev, 0);
 
-       if (!request_mem_region(iomem->start, resource_size(iomem),
-               mmc_hostname(host->mmc))) {
-               dev_err(&pdev->dev, "cannot request region\n");
-               ret = -EBUSY;
-               goto err_request;
-       }
-
-       host->ioaddr = ioremap(iomem->start, resource_size(iomem));
-       if (!host->ioaddr) {
-               dev_err(&pdev->dev, "failed to remap registers\n");
-               ret = -ENOMEM;
-               goto err_remap;
+       host->ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
+       if (IS_ERR(host->ioaddr)) {
+               ret = PTR_ERR(host->ioaddr);
+               goto err;
        }
 
        /*
@@ -179,10 +171,6 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 
        return host;
 
-err_remap:
-       release_mem_region(iomem->start, resource_size(iomem));
-err_request:
-       sdhci_free_host(host);
 err:
        dev_err(&pdev->dev, "%s failed %d\n", __func__, ret);
        return ERR_PTR(ret);
@@ -192,10 +180,7 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
 void sdhci_pltfm_free(struct platform_device *pdev)
 {
        struct sdhci_host *host = platform_get_drvdata(pdev);
-       struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-       iounmap(host->ioaddr);
-       release_mem_region(iomem->start, resource_size(iomem));
        sdhci_free_host(host);
        platform_set_drvdata(pdev, NULL);
 }