summaryrefslogtreecommitdiff
path: root/drivers/thermal/rcar_thermal.c
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>2020-03-10 18:00:29 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-03-20 12:17:48 +0100
commit0fa04202078a7dae3a1199bd61951de3d915ede6 (patch)
treeaa16dcaf41e43e23b38a4be690c3e8e965a2fab4 /drivers/thermal/rcar_thermal.c
parent57ed737f1646579bf77070109c18ea78db690d18 (diff)
thermal: rcar_thermal: Remove lock in rcar_thermal_get_current_temp()
With the ctemp value returned instead of cached in the private data structure their is no need to take the lock when translating ctemp into a temperature. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200310170029.1648996-4-niklas.soderlund+renesas@ragnatech.se
Diffstat (limited to 'drivers/thermal/rcar_thermal.c')
-rw-r--r--drivers/thermal/rcar_thermal.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 4a45b314ef30..e0c1f2409035 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -254,24 +254,20 @@ err_out_unlock:
static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
int *temp)
{
- int ctemp, tmp;
+ int ctemp;
ctemp = rcar_thermal_update_temp(priv);
if (ctemp < 0)
return ctemp;
- mutex_lock(&priv->lock);
+ /* Guaranteed operating range is -45C to 125C. */
+
if (priv->chip->ctemp_bands == 1)
- tmp = MCELSIUS((ctemp * 5) - 65);
+ *temp = MCELSIUS((ctemp * 5) - 65);
else if (ctemp < 24)
- tmp = MCELSIUS(((ctemp * 55) - 720) / 10);
+ *temp = MCELSIUS(((ctemp * 55) - 720) / 10);
else
- tmp = MCELSIUS((ctemp * 5) - 60);
- mutex_unlock(&priv->lock);
-
- /* Guaranteed operating range is -45C to 125C. */
-
- *temp = tmp;
+ *temp = MCELSIUS((ctemp * 5) - 60);
return 0;
}