diff mbox

[4/9] mmc: omap_hsmmc: use devm_request_mem_region

Message ID 1395418658-2375-5-git-send-email-balajitk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Balaji T K March 21, 2014, 4:17 p.m. UTC
With devm_request_mem_region conversion release_mem_region can be
removed in clean up path

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

Comments

Felipe Balbi March 21, 2014, 4:18 p.m. UTC | #1
On Fri, Mar 21, 2014 at 09:47:33PM +0530, Balaji T K wrote:
> With devm_request_mem_region conversion release_mem_region can be
> removed in clean up path
> 
> Signed-off-by: Balaji T K <balajitk@ti.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c |   11 ++---------
>  1 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 8e35a6e..9952673 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1881,7 +1881,8 @@ 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);
> +	res = devm_request_mem_region(&pdev->dev, res->start,
> +					resource_size(res), pdev->name);

while at that, why don't you switch over to devm_ioremap_resource()
already ?
Balaji T K March 21, 2014, 4:27 p.m. UTC | #2
On Friday 21 March 2014 09:48 PM, Felipe Balbi wrote:
> On Fri, Mar 21, 2014 at 09:47:33PM +0530, Balaji T K wrote:
>> With devm_request_mem_region conversion release_mem_region can be
>> removed in clean up path
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>>   drivers/mmc/host/omap_hsmmc.c |   11 ++---------
>>   1 files changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 8e35a6e..9952673 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1881,7 +1881,8 @@ 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);
>> +	res = devm_request_mem_region(&pdev->dev, res->start,
>> +					resource_size(res), pdev->name);
>
> while at that, why don't you switch over to devm_ioremap_resource()
> already ?

I can't do that because of 0x100 reg_offset on OMAP4+ and am335x+

Thanks and Regards,
Balaji T K
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi March 21, 2014, 4:30 p.m. UTC | #3
On Fri, Mar 21, 2014 at 09:57:52PM +0530, Balaji T K wrote:
> On Friday 21 March 2014 09:48 PM, Felipe Balbi wrote:
> >On Fri, Mar 21, 2014 at 09:47:33PM +0530, Balaji T K wrote:
> >>With devm_request_mem_region conversion release_mem_region can be
> >>removed in clean up path
> >>
> >>Signed-off-by: Balaji T K <balajitk@ti.com>
> >>---
> >>  drivers/mmc/host/omap_hsmmc.c |   11 ++---------
> >>  1 files changed, 2 insertions(+), 9 deletions(-)
> >>
> >>diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> >>index 8e35a6e..9952673 100644
> >>--- a/drivers/mmc/host/omap_hsmmc.c
> >>+++ b/drivers/mmc/host/omap_hsmmc.c
> >>@@ -1881,7 +1881,8 @@ 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);
> >>+	res = devm_request_mem_region(&pdev->dev, res->start,
> >>+					resource_size(res), pdev->name);
> >
> >while at that, why don't you switch over to devm_ioremap_resource()
> >already ?
> 
> I can't do that because of 0x100 reg_offset on OMAP4+ and am335x+

split the resource into two parts, one is OMAP-specific and the other is
the generic SDHCI start.
diff mbox

Patch

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8e35a6e..9952673 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1881,7 +1881,8 @@  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);
+	res = devm_request_mem_region(&pdev->dev, res->start,
+					resource_size(res), pdev->name);
 	if (res == NULL)
 		return -EBUSY;
 
@@ -2109,16 +2110,12 @@  err1:
 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);
@@ -2141,10 +2138,6 @@  static int omap_hsmmc_remove(struct platform_device *pdev)
 	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;
 }