Skip to content

Commit

Permalink
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…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()
  • Loading branch information
torvalds committed Mar 21, 2013
2 parents cd82346 + 043e465 commit 0a7e453
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
16 changes: 6 additions & 10 deletions drivers/thermal/dove_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
if (!priv->sensor) {
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
return -EADDRNOTAVAIL;
}
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_request_and_ioremap(&pdev->dev, res);
if (!priv->control) {
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
return -EADDRNOTAVAIL;
}
priv->control = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->control))
return PTR_ERR(priv->control);

ret = dove_init_sensor(priv);
if (ret) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/exynos_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)

if (IS_ERR(th_zone->therm_dev)) {
pr_err("Failed to register thermal zone device\n");
ret = -EINVAL;
ret = PTR_ERR(th_zone->therm_dev);
goto err_unregister;
}
th_zone->mode = THERMAL_DEVICE_ENABLED;
Expand Down
8 changes: 3 additions & 5 deletions drivers/thermal/kirkwood_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
if (!priv->sensor) {
dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
return -EADDRNOTAVAIL;
}
priv->sensor = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->sensor))
return PTR_ERR(priv->sensor);

thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0,
priv, &ops, NULL, 0, 0);
Expand Down
29 changes: 14 additions & 15 deletions drivers/thermal/rcar_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
struct device *dev = rcar_priv_to_dev(priv);
int i;
int ctemp, old, new;
int ret = -EINVAL;

mutex_lock(&priv->lock);

Expand Down Expand Up @@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)

if (!ctemp) {
dev_err(dev, "thermal sensor was broken\n");
return -EINVAL;
goto err_out_unlock;
}

/*
Expand All @@ -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);

priv->ctemp = ctemp;

ret = 0;
err_out_unlock:
mutex_unlock(&priv->lock);

return 0;
return ret;
}

static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
Expand Down Expand Up @@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct resource *res, *irq;
int mres = 0;
int i;
int ret = -ENODEV;
int idle = IDLE_INTERVAL;

common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
Expand Down Expand Up @@ -399,11 +401,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);
Expand All @@ -422,11 +422,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;
Expand All @@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
idle);
if (IS_ERR(priv->zone)) {
dev_err(dev, "can't register thermal zone\n");
ret = PTR_ERR(priv->zone);
goto error_unregister;
}

Expand All @@ -460,7 +459,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
rcar_thermal_for_each_priv(priv, common)
thermal_zone_device_unregister(priv->zone);

return -ENODEV;
return ret;
}

static int rcar_thermal_remove(struct platform_device *pdev)
Expand Down

0 comments on commit 0a7e453

Please sign in to comment.