From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: linux-pm@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Cc: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH 3/3] thermal: rcar_thermal: Remove lock in rcar_thermal_get_current_temp()
Date: Tue, 10 Mar 2020 18:00:29 +0100 [thread overview]
Message-ID: <20200310170029.1648996-4-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20200310170029.1648996-1-niklas.soderlund+renesas@ragnatech.se>
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>
---
drivers/thermal/rcar_thermal.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 953dc28d1dd1d499..8bdcb449bd280a18 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -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,
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;
}
--
2.25.1
next prev parent reply other threads:[~2020-03-10 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 17:00 [PATCH 0/3] thermal: rcar_thermal: Update how temperature is read Niklas Söderlund
2020-03-10 17:00 ` [PATCH 1/3] thermal: rcar_thermal: Always update thermal zone on interrupt Niklas Söderlund
2020-03-11 12:38 ` Geert Uytterhoeven
2020-03-10 17:00 ` [PATCH 2/3] thermal: rcar_thermal: Do not store ctemp in rcar_thermal_priv Niklas Söderlund
2020-03-11 12:40 ` Geert Uytterhoeven
2020-03-10 17:00 ` Niklas Söderlund [this message]
2020-03-11 12:43 ` [PATCH 3/3] thermal: rcar_thermal: Remove lock in rcar_thermal_get_current_temp() Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200310170029.1648996-4-niklas.soderlund+renesas@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.