diff mbox

[2/3] Thermal: rcar: Convert to devm_ioremap_resource()

Message ID 1362379534-30662-2-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State Accepted, archived
Delegated to: Zhang Rui
Headers show

Commit Message

Sachin Kamat March 4, 2013, 6:45 a.m. UTC
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/rcar_thermal.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

Comments

Thierry Reding March 4, 2013, 7:06 a.m. UTC | #1
On Mon, Mar 04, 2013 at 12:15:33PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages; so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/thermal/rcar_thermal.c |   16 ++++++----------
>  1 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 28f0919..b28990a 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -399,11 +399,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  		/*
>  		 * rcar_has_irq_support() will be enabled
>  		 */
> -		common->base = devm_request_and_ioremap(dev, res);
> -		if (!common->base) {
> -			dev_err(dev, "Unable to ioremap thermal register\n");
> -			return -ENOMEM;
> -		}
> +		common->base = devm_ioremap_resource(dev, res);
> +		if (IS_ERR(common->base))
> +			return PTR_ERR(common->base);
>  
>  		/* enable temperature comparation */
>  		rcar_thermal_common_write(common, ENR, 0x00030303);
> @@ -422,11 +420,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  			return -ENOMEM;
>  		}
>  
> -		priv->base = devm_request_and_ioremap(dev, res);
> -		if (!priv->base) {
> -			dev_err(dev, "Unable to ioremap priv register\n");
> -			return -ENOMEM;
> -		}
> +		priv->base = devm_ioremap_resource(dev, res);
> +		if (IS_ERR(priv->base))
> +			return PTR_ERR(priv->base);
>  
>  		priv->common = common;
>  		priv->id = i;

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Zhang, Rui March 11, 2013, 2:35 p.m. UTC | #2
On Mon, 2013-03-04 at 12:15 +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages; so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

applied to thermal -next tree.

thanks,
rui
> ---
>  drivers/thermal/rcar_thermal.c |   16 ++++++----------
>  1 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 28f0919..b28990a 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -399,11 +399,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  		/*
>  		 * rcar_has_irq_support() will be enabled
>  		 */
> -		common->base = devm_request_and_ioremap(dev, res);
> -		if (!common->base) {
> -			dev_err(dev, "Unable to ioremap thermal register\n");
> -			return -ENOMEM;
> -		}
> +		common->base = devm_ioremap_resource(dev, res);
> +		if (IS_ERR(common->base))
> +			return PTR_ERR(common->base);
>  
>  		/* enable temperature comparation */
>  		rcar_thermal_common_write(common, ENR, 0x00030303);
> @@ -422,11 +420,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  			return -ENOMEM;
>  		}
>  
> -		priv->base = devm_request_and_ioremap(dev, res);
> -		if (!priv->base) {
> -			dev_err(dev, "Unable to ioremap priv register\n");
> -			return -ENOMEM;
> -		}
> +		priv->base = devm_ioremap_resource(dev, res);
> +		if (IS_ERR(priv->base))
> +			return PTR_ERR(priv->base);
>  
>  		priv->common = common;
>  		priv->id = i;


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" 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/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 28f0919..b28990a 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -399,11 +399,9 @@  static int rcar_thermal_probe(struct platform_device *pdev)
 		/*
 		 * rcar_has_irq_support() will be enabled
 		 */
-		common->base = devm_request_and_ioremap(dev, res);
-		if (!common->base) {
-			dev_err(dev, "Unable to ioremap thermal register\n");
-			return -ENOMEM;
-		}
+		common->base = devm_ioremap_resource(dev, res);
+		if (IS_ERR(common->base))
+			return PTR_ERR(common->base);
 
 		/* enable temperature comparation */
 		rcar_thermal_common_write(common, ENR, 0x00030303);
@@ -422,11 +420,9 @@  static int rcar_thermal_probe(struct platform_device *pdev)
 			return -ENOMEM;
 		}
 
-		priv->base = devm_request_and_ioremap(dev, res);
-		if (!priv->base) {
-			dev_err(dev, "Unable to ioremap priv register\n");
-			return -ENOMEM;
-		}
+		priv->base = devm_ioremap_resource(dev, res);
+		if (IS_ERR(priv->base))
+			return PTR_ERR(priv->base);
 
 		priv->common = common;
 		priv->id = i;