* [PATCH] thermal: intel: Slighly simplify duration_set()
@ 2026-09-02 17:17 Christophe JAILLET
2026-09-04 11:30 ` Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2026-09-02 17:17 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pm
there is no need to call clamp here(). The same tests have already been
performed a few lines above, and there is a "goto exit;" if outside of the
range.
While at it, also remove an un-needed initialization of 'ret'.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Based on my testing, gcc is not smart enough to get rid of the redundnat
tests by itself.
This patch is compile tested only
---
drivers/thermal/intel/intel_powerclamp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index bd7fd98dc310..ba9c4a1224ca 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -80,7 +80,7 @@ static unsigned int window_size;
static int duration_set(const char *arg, const struct kernel_param *kp)
{
- int ret = 0;
+ int ret;
unsigned long new_duration;
ret = kstrtoul(arg, 10, &new_duration);
@@ -94,7 +94,7 @@ static int duration_set(const char *arg, const struct kernel_param *kp)
}
mutex_lock(&powerclamp_lock);
- duration = clamp(new_duration, 6ul, 25ul) * 1000;
+ duration = new_duration * 1000;
mutex_unlock(&powerclamp_lock);
exit:
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] thermal: intel: Slighly simplify duration_set()
2026-09-02 17:17 [PATCH] thermal: intel: Slighly simplify duration_set() Christophe JAILLET
@ 2026-09-04 11:30 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-09-04 11:30 UTC (permalink / raw)
To: Christophe Jaillet, linux-pm, Daniel Lezcano, Lukasz Luba,
Rafael J. Wysocki, Zhang Rui
Cc: kernel-janitors, LKML
…
> While at it, also remove an un-needed initialization of 'ret'.
unneeded?
See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.3-rc1#n111
> ---
> Based on my testing, gcc is not smart enough to get rid of the redundnat
…
redundant?
How do you think about to avoid another typo in the summary phrase?
> ---
> drivers/thermal/intel/intel_powerclamp.c | 4 ++--
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-04 11:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 17:17 [PATCH] thermal: intel: Slighly simplify duration_set() Christophe JAILLET
2026-09-04 11:30 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox