Commit 0fa04202 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Daniel Lezcano

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: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200310170029.1648996-4-niklas.soderlund+renesas@ragnatech.se
parent 57ed737f
...@@ -254,24 +254,20 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) ...@@ -254,24 +254,20 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv, static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
int *temp) int *temp)
{ {
int ctemp, tmp; int ctemp;
ctemp = rcar_thermal_update_temp(priv); ctemp = rcar_thermal_update_temp(priv);
if (ctemp < 0) if (ctemp < 0)
return ctemp; return ctemp;
mutex_lock(&priv->lock); /* Guaranteed operating range is -45C to 125C. */
if (priv->chip->ctemp_bands == 1) if (priv->chip->ctemp_bands == 1)
tmp = MCELSIUS((ctemp * 5) - 65); *temp = MCELSIUS((ctemp * 5) - 65);
else if (ctemp < 24) else if (ctemp < 24)
tmp = MCELSIUS(((ctemp * 55) - 720) / 10); *temp = MCELSIUS(((ctemp * 55) - 720) / 10);
else else
tmp = MCELSIUS((ctemp * 5) - 60); *temp = MCELSIUS((ctemp * 5) - 60);
mutex_unlock(&priv->lock);
/* Guaranteed operating range is -45C to 125C. */
*temp = tmp;
return 0; return 0;
} }
......
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