diff mbox

[2/6] OMAPDSS: Convert to devm_ioremap

Message ID 1350350839-30408-3-git-send-email-ricardo.neri@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ricardo Neri Oct. 16, 2012, 1:27 a.m. UTC
Using devm_ioremap provides better memory handling and improves
readability.

Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
---
 drivers/video/omap2/dss/hdmi.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Comments

Tomi Valkeinen Oct. 22, 2012, 7:22 a.m. UTC | #1
On 2012-10-16 04:27, Ricardo Neri wrote:
> Using devm_ioremap provides better memory handling and improves
> readability.
> 
> Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
> ---
>  drivers/video/omap2/dss/hdmi.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
> index 2cba177..6773e2c 100644
> --- a/drivers/video/omap2/dss/hdmi.c
> +++ b/drivers/video/omap2/dss/hdmi.c
> @@ -1010,8 +1010,13 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> +	if (!devm_request_mem_region(&pdev->dev, res->start,
> +				     resource_size(res), "HDMI"))
> +		return -EBUSY;
> +
>  	/* Base address taken from platform */
> -	hdmi.ip_data.base_wp = ioremap(res->start, resource_size(res));
> +	hdmi.ip_data.base_wp = devm_ioremap(&pdev->dev, res->start,
> +					     resource_size(res));

I think you can use devm_request_and_ioremap() here to simplify it even
more.

 Tomi
Ricardo Neri Oct. 22, 2012, 10:59 p.m. UTC | #2
Hi Tomi,

On 10/22/2012 02:22 AM, Tomi Valkeinen wrote:
> On 2012-10-16 04:27, Ricardo Neri wrote:
>> Using devm_ioremap provides better memory handling and improves
>> readability.
>>
>> Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
>> ---
>>   drivers/video/omap2/dss/hdmi.c |   11 +++++++----
>>   1 files changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
>> index 2cba177..6773e2c 100644
>> --- a/drivers/video/omap2/dss/hdmi.c
>> +++ b/drivers/video/omap2/dss/hdmi.c
>> @@ -1010,8 +1010,13 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
>>   		return -EINVAL;
>>   	}
>>
>> +	if (!devm_request_mem_region(&pdev->dev, res->start,
>> +				     resource_size(res), "HDMI"))
>> +		return -EBUSY;
>> +
>>   	/* Base address taken from platform */
>> -	hdmi.ip_data.base_wp = ioremap(res->start, resource_size(res));
>> +	hdmi.ip_data.base_wp = devm_ioremap(&pdev->dev, res->start,
>> +					     resource_size(res));
>
> I think you can use devm_request_and_ioremap() here to simplify it even
> more.

Thanks! I'll use it.

BR,

Ricardo
>
>   Tomi
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2cba177..6773e2c 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -1010,8 +1010,13 @@  static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	if (!devm_request_mem_region(&pdev->dev, res->start,
+				     resource_size(res), "HDMI"))
+		return -EBUSY;
+
 	/* Base address taken from platform */
-	hdmi.ip_data.base_wp = ioremap(res->start, resource_size(res));
+	hdmi.ip_data.base_wp = devm_ioremap(&pdev->dev, res->start,
+					     resource_size(res));
 	if (!hdmi.ip_data.base_wp) {
 		DSSERR("can't ioremap WP\n");
 		return -ENOMEM;
@@ -1019,7 +1024,7 @@  static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 
 	r = hdmi_get_clocks(pdev);
 	if (r) {
-		iounmap(hdmi.ip_data.base_wp);
+		DSSERR("can't get clocks\n");
 		return r;
 	}
 
@@ -1064,8 +1069,6 @@  static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 
 	hdmi_put_clocks();
 
-	iounmap(hdmi.ip_data.base_wp);
-
 	return 0;
 }