aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2013-05-10 04:17:11 -0400
committerZhang Rui <rui.zhang@intel.com>2013-05-20 11:35:52 -0400
commitc28f692c6f5a836dc628fb6990fb4d3d1859f779 (patch)
tree872ff7a727796c4eed8b6b7075b0b100299a321b /drivers
parentc240a539df4e2d50f86e2f31813ff6b7334cd493 (diff)
drivers/thermal: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/thermal/dove_thermal.c11
-rw-r--r--drivers/thermal/exynos_thermal.c5
-rw-r--r--drivers/thermal/kirkwood_thermal.c7
-rw-r--r--drivers/thermal/rcar_thermal.c6
4 files changed, 3 insertions, 26 deletions
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
index 4b15a5f270dc..8bf104d8a649 100644
--- a/drivers/thermal/dove_thermal.c
+++ b/drivers/thermal/dove_thermal.c
@@ -134,25 +134,16 @@ static int dove_thermal_probe(struct platform_device *pdev)
134 struct resource *res; 134 struct resource *res;
135 int ret; 135 int ret;
136 136
137 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
138 if (!res) {
139 dev_err(&pdev->dev, "Failed to get platform resource\n");
140 return -ENODEV;
141 }
142
143 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 137 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
144 if (!priv) 138 if (!priv)
145 return -ENOMEM; 139 return -ENOMEM;
146 140
141 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
147 priv->sensor = devm_ioremap_resource(&pdev->dev, res); 142 priv->sensor = devm_ioremap_resource(&pdev->dev, res);
148 if (IS_ERR(priv->sensor)) 143 if (IS_ERR(priv->sensor))
149 return PTR_ERR(priv->sensor); 144 return PTR_ERR(priv->sensor);
150 145
151 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 146 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
152 if (!res) {
153 dev_err(&pdev->dev, "Failed to get platform resource\n");
154 return -ENODEV;
155 }
156 priv->control = devm_ioremap_resource(&pdev->dev, res); 147 priv->control = devm_ioremap_resource(&pdev->dev, res);
157 if (IS_ERR(priv->control)) 148 if (IS_ERR(priv->control))
158 return PTR_ERR(priv->control); 149 return PTR_ERR(priv->control);
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index d20ce9e61403..788b1ddcac6c 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -925,11 +925,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
925 INIT_WORK(&data->irq_work, exynos_tmu_work); 925 INIT_WORK(&data->irq_work, exynos_tmu_work);
926 926
927 data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 927 data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
928 if (!data->mem) {
929 dev_err(&pdev->dev, "Failed to get platform resource\n");
930 return -ENOENT;
931 }
932
933 data->base = devm_ioremap_resource(&pdev->dev, data->mem); 928 data->base = devm_ioremap_resource(&pdev->dev, data->mem);
934 if (IS_ERR(data->base)) 929 if (IS_ERR(data->base))
935 return PTR_ERR(data->base); 930 return PTR_ERR(data->base);
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
index dfeceaffbc03..9e4d98eef17a 100644
--- a/drivers/thermal/kirkwood_thermal.c
+++ b/drivers/thermal/kirkwood_thermal.c
@@ -75,16 +75,11 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
75 struct kirkwood_thermal_priv *priv; 75 struct kirkwood_thermal_priv *priv;
76 struct resource *res; 76 struct resource *res;
77 77
78 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
79 if (!res) {
80 dev_err(&pdev->dev, "Failed to get platform resource\n");
81 return -ENODEV;
82 }
83
84 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 78 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
85 if (!priv) 79 if (!priv)
86 return -ENOMEM; 80 return -ENOMEM;
87 81
82 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
88 priv->sensor = devm_ioremap_resource(&pdev->dev, res); 83 priv->sensor = devm_ioremap_resource(&pdev->dev, res);
89 if (IS_ERR(priv->sensor)) 84 if (IS_ERR(priv->sensor))
90 return PTR_ERR(priv->sensor); 85 return PTR_ERR(priv->sensor);
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 8d7edd4c8228..72f50bc0456c 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -389,11 +389,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
389 * platform has IRQ support. 389 * platform has IRQ support.
390 * Then, drier use common register 390 * Then, drier use common register
391 */ 391 */
392 res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
393 if (!res) {
394 dev_err(dev, "Could not get platform resource\n");
395 return -ENODEV;
396 }
397 392
398 ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, 393 ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0,
399 dev_name(dev), common); 394 dev_name(dev), common);
@@ -405,6 +400,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
405 /* 400 /*
406 * rcar_has_irq_support() will be enabled 401 * rcar_has_irq_support() will be enabled
407 */ 402 */
403 res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
408 common->base = devm_ioremap_resource(dev, res); 404 common->base = devm_ioremap_resource(dev, res);
409 if (IS_ERR(common->base)) 405 if (IS_ERR(common->base))
410 return PTR_ERR(common->base); 406 return PTR_ERR(common->base);