From: Thorsten Blum <thorsten.blum@linux.dev>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RESEND] thermal: sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata
Date: Tue, 10 Mar 2026 11:25:25 +0100 [thread overview]
Message-ID: <20260310102523.201722-3-thorsten.blum@linux.dev> (raw)
Clamping 'val' to itself is unnecessary and the expression can be
simplified by using min() instead. Casting SPRD_THM_RAW_DATA_HIGH to u32
is also redundant and can be removed.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/thermal/sprd_thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
index e546067c9621..511f1e7959b6 100644
--- a/drivers/thermal/sprd_thermal.c
+++ b/drivers/thermal/sprd_thermal.c
@@ -201,7 +201,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
*/
val = (temp + sen->cal_offset) / sen->cal_slope;
- return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1));
+ return min(val, SPRD_THM_RAW_DATA_HIGH - 1);
}
static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp)
next reply other threads:[~2026-03-10 10:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 10:25 Thorsten Blum [this message]
2026-03-10 11:33 ` [PATCH RESEND] thermal: sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata Daniel Lezcano
-- strict thread matches above, loose matches on Subject: below --
2026-03-14 1:13 Thorsten Blum
2026-03-14 10:48 ` Daniel Lezcano
2026-02-24 14:51 Thorsten Blum
2026-03-06 14:15 ` Lukasz Luba
2026-01-26 7:51 Thorsten Blum
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=20260310102523.201722-3-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=baolin.wang@linux.alibaba.com \
--cc=daniel.lezcano@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=orsonzhai@gmail.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=zhang.lyra@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox