summaryrefslogtreecommitdiff
path: root/drivers/thermal/rcar_thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/rcar_thermal.c')
-rw-r--r--drivers/thermal/rcar_thermal.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index f7a1b574a304..90db951725da 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -43,6 +43,9 @@ struct rcar_thermal_priv {
u32 comp;
};
+#define MCELSIUS(temp) ((temp) * 1000)
+#define rcar_zone_to_priv(zone) (zone->devdata)
+
/*
* basic functions
*/
@@ -96,7 +99,7 @@ static void rcar_thermal_bset(struct rcar_thermal_priv *priv, u32 reg,
static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
unsigned long *temp)
{
- struct rcar_thermal_priv *priv = zone->devdata;
+ struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
int val, min, max, tmp;
tmp = -200; /* default */
@@ -169,7 +172,7 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
}
}
- *temp = tmp;
+ *temp = MCELSIUS(tmp);
return 0;
}
@@ -185,7 +188,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct thermal_zone_device *zone;
struct rcar_thermal_priv *priv;
struct resource *res;
- int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -206,16 +208,14 @@ static int rcar_thermal_probe(struct platform_device *pdev)
res->start, resource_size(res));
if (!priv->base) {
dev_err(&pdev->dev, "Unable to ioremap thermal register\n");
- ret = -ENOMEM;
- goto error_free_priv;
+ return -ENOMEM;
}
zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv,
- &rcar_thermal_zone_ops, 0, 0);
+ &rcar_thermal_zone_ops, NULL, 0, 0);
if (IS_ERR(zone)) {
dev_err(&pdev->dev, "thermal zone device is NULL\n");
- ret = PTR_ERR(zone);
- goto error_iounmap;
+ return PTR_ERR(zone);
}
platform_set_drvdata(pdev, zone);
@@ -223,26 +223,15 @@ static int rcar_thermal_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "proved\n");
return 0;
-
-error_iounmap:
- devm_iounmap(&pdev->dev, priv->base);
-error_free_priv:
- devm_kfree(&pdev->dev, priv);
-
- return ret;
}
static int rcar_thermal_remove(struct platform_device *pdev)
{
struct thermal_zone_device *zone = platform_get_drvdata(pdev);
- struct rcar_thermal_priv *priv = zone->devdata;
thermal_zone_device_unregister(zone);
platform_set_drvdata(pdev, NULL);
- devm_iounmap(&pdev->dev, priv->base);
- devm_kfree(&pdev->dev, priv);
-
return 0;
}