diff mbox

[2/2] Thermal: don't check resource with devm_ioremap_resource

Message ID 1368670581-4846-2-git-send-email-rui.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Zhang Rui
Headers show

Commit Message

Zhang, Rui May 16, 2013, 2:16 a.m. UTC
devm_ioremap_resource does sanity checks on the given resource.
No need to duplicate this in the driver.

CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/armada_thermal.c |   10 ----------
 drivers/thermal/spear_thermal.c  |    7 +------
 2 files changed, 1 insertion(+), 16 deletions(-)

Comments

Ezequiel Garcia May 16, 2013, 8:46 a.m. UTC | #1
On Thu, May 16, 2013 at 10:16:21AM +0800, Zhang Rui wrote:
> devm_ioremap_resource does sanity checks on the given resource.
> No need to duplicate this in the driver.
> 
> CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> CC: Vincenzo Frascino <vincenzo.frascino@st.com>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>

Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Thanks,
Zhang, Rui May 20, 2013, 3:39 p.m. UTC | #2
> -----Original Message-----
> From: Zhang, Rui
> Sent: Thursday, May 16, 2013 10:16 AM
> To: linux-pm@vger.kernel.org
> Cc: eduardo.valentin@ti.com; Zhang, Rui; Ezequiel Garcia; Vincenzo
> Frascino
> Subject: [PATCH 2/2] Thermal: don't check resource with
> devm_ioremap_resource
> Importance: High
> 
> devm_ioremap_resource does sanity checks on the given resource.
> No need to duplicate this in the driver.
> 
> CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> CC: Vincenzo Frascino <vincenzo.frascino@st.com>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>

Applied to thermal -next.

Thanks,
rui
> ---
>  drivers/thermal/armada_thermal.c |   10 ----------
>  drivers/thermal/spear_thermal.c  |    7 +------
>  2 files changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/thermal/armada_thermal.c
> b/drivers/thermal/armada_thermal.c
> index 0d02d4e..0491465 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -169,21 +169,11 @@ static int armada_thermal_probe(struct
> platform_device *pdev)
>  		return -ENOMEM;
> 
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(&pdev->dev, "Failed to get platform resource\n");
> -		return -ENODEV;
> -	}
> -
>  	priv->sensor = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(priv->sensor))
>  		return PTR_ERR(priv->sensor);
> 
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (!res) {
> -		dev_err(&pdev->dev, "Failed to get platform resource\n");
> -		return -ENODEV;
> -	}
> -
>  	priv->control = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(priv->control))
>  		return PTR_ERR(priv->control);
> diff --git a/drivers/thermal/spear_thermal.c
> b/drivers/thermal/spear_thermal.c index 1b652ab..fa30918 100644
> --- a/drivers/thermal/spear_thermal.c
> +++ b/drivers/thermal/spear_thermal.c
> @@ -118,13 +118,8 @@ static int spear_thermal_probe(struct
> platform_device *pdev)
>  		return -ENOMEM;
>  	}
> 
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(&pdev->dev, "memory resource missing\n");
> -		return -ENODEV;
> -	}
> -
>  	/* Enable thermal sensor */
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	stdev->thermal_base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(stdev->thermal_base)) {
>  		dev_err(&pdev->dev, "ioremap failed\n");
> --
> 1.7.9.5

--
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/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 0d02d4e..0491465 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -169,21 +169,11 @@  static int armada_thermal_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "Failed to get platform resource\n");
-		return -ENODEV;
-	}
-
 	priv->sensor = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(priv->sensor))
 		return PTR_ERR(priv->sensor);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res) {
-		dev_err(&pdev->dev, "Failed to get platform resource\n");
-		return -ENODEV;
-	}
-
 	priv->control = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(priv->control))
 		return PTR_ERR(priv->control);
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index 1b652ab..fa30918 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -118,13 +118,8 @@  static int spear_thermal_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "memory resource missing\n");
-		return -ENODEV;
-	}
-
 	/* Enable thermal sensor */
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	stdev->thermal_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(stdev->thermal_base)) {
 		dev_err(&pdev->dev, "ioremap failed\n");