Commit 0a7e4531 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux

Pull thermal management fixes from Zhang Rui.

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail.
  thermal: rcar_thermal: propagate return value of thermal_zone_device_register
  Thermal: kirkwood: Convert to devm_ioremap_resource()
  Thermal: rcar: Convert to devm_ioremap_resource()
  Thermal: dove: Convert to devm_ioremap_resource()
  thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp()
parents cd823469 043e4652
...@@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev) ...@@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->sensor = devm_request_and_ioremap(&pdev->dev, res); priv->sensor = devm_ioremap_resource(&pdev->dev, res);
if (!priv->sensor) { if (IS_ERR(priv->sensor))
dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); return PTR_ERR(priv->sensor);
return -EADDRNOTAVAIL;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res) { if (!res) {
dev_err(&pdev->dev, "Failed to get platform resource\n"); dev_err(&pdev->dev, "Failed to get platform resource\n");
return -ENODEV; return -ENODEV;
} }
priv->control = devm_request_and_ioremap(&pdev->dev, res); priv->control = devm_ioremap_resource(&pdev->dev, res);
if (!priv->control) { if (IS_ERR(priv->control))
dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); return PTR_ERR(priv->control);
return -EADDRNOTAVAIL;
}
ret = dove_init_sensor(priv); ret = dove_init_sensor(priv);
if (ret) { if (ret) {
......
...@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) ...@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
if (IS_ERR(th_zone->therm_dev)) { if (IS_ERR(th_zone->therm_dev)) {
pr_err("Failed to register thermal zone device\n"); pr_err("Failed to register thermal zone device\n");
ret = -EINVAL; ret = PTR_ERR(th_zone->therm_dev);
goto err_unregister; goto err_unregister;
} }
th_zone->mode = THERMAL_DEVICE_ENABLED; th_zone->mode = THERMAL_DEVICE_ENABLED;
......
...@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) ...@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->sensor = devm_request_and_ioremap(&pdev->dev, res); priv->sensor = devm_ioremap_resource(&pdev->dev, res);
if (!priv->sensor) { if (IS_ERR(priv->sensor))
dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); return PTR_ERR(priv->sensor);
return -EADDRNOTAVAIL;
}
thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
priv, &ops, NULL, 0, 0); priv, &ops, NULL, 0, 0);
......
...@@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) ...@@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
struct device *dev = rcar_priv_to_dev(priv); struct device *dev = rcar_priv_to_dev(priv);
int i; int i;
int ctemp, old, new; int ctemp, old, new;
int ret = -EINVAL;
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
...@@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) ...@@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
if (!ctemp) { if (!ctemp) {
dev_err(dev, "thermal sensor was broken\n"); dev_err(dev, "thermal sensor was broken\n");
return -EINVAL; goto err_out_unlock;
} }
/* /*
...@@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) ...@@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp);
priv->ctemp = ctemp; priv->ctemp = ctemp;
ret = 0;
err_out_unlock:
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
return ret;
return 0;
} }
static int rcar_thermal_get_temp(struct thermal_zone_device *zone, static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
...@@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct resource *res, *irq; struct resource *res, *irq;
int mres = 0; int mres = 0;
int i; int i;
int ret = -ENODEV;
int idle = IDLE_INTERVAL; int idle = IDLE_INTERVAL;
common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
...@@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
/* /*
* rcar_has_irq_support() will be enabled * rcar_has_irq_support() will be enabled
*/ */
common->base = devm_request_and_ioremap(dev, res); common->base = devm_ioremap_resource(dev, res);
if (!common->base) { if (IS_ERR(common->base))
dev_err(dev, "Unable to ioremap thermal register\n"); return PTR_ERR(common->base);
return -ENOMEM;
}
/* enable temperature comparation */ /* enable temperature comparation */
rcar_thermal_common_write(common, ENR, 0x00030303); rcar_thermal_common_write(common, ENR, 0x00030303);
...@@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
priv->base = devm_request_and_ioremap(dev, res); priv->base = devm_ioremap_resource(dev, res);
if (!priv->base) { if (IS_ERR(priv->base))
dev_err(dev, "Unable to ioremap priv register\n"); return PTR_ERR(priv->base);
return -ENOMEM;
}
priv->common = common; priv->common = common;
priv->id = i; priv->id = i;
...@@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
idle); idle);
if (IS_ERR(priv->zone)) { if (IS_ERR(priv->zone)) {
dev_err(dev, "can't register thermal zone\n"); dev_err(dev, "can't register thermal zone\n");
ret = PTR_ERR(priv->zone);
goto error_unregister; goto error_unregister;
} }
...@@ -460,7 +459,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -460,7 +459,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
rcar_thermal_for_each_priv(priv, common) rcar_thermal_for_each_priv(priv, common)
thermal_zone_device_unregister(priv->zone); thermal_zone_device_unregister(priv->zone);
return -ENODEV; return ret;
} }
static int rcar_thermal_remove(struct platform_device *pdev) static int rcar_thermal_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment