mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal: intel: powerclamp: Simplify duration_get()
@ 2026-09-15 22:15 Thorsten Blum
  2026-09-15 22:15 ` [PATCH 2/2] thermal: intel: powerclamp: Simplify max_idle_set() Thorsten Blum
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-09-15 22:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Thorsten Blum, Yury Norov
  Cc: Rafael J. Wysocki, linux-pm, linux-kernel

Use guard(mutex) and return the result of sysfs_emit() directly to
simplify the code. Also use %u to format the unsigned duration.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/thermal/intel/intel_powerclamp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index bd7fd98dc310..8ceb1270646c 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -103,13 +103,9 @@ static int duration_set(const char *arg, const struct kernel_param *kp)
 
 static int duration_get(char *buf, const struct kernel_param *kp)
 {
-	int ret;
+	guard(mutex)(&powerclamp_lock);
 
-	mutex_lock(&powerclamp_lock);
-	ret = sysfs_emit(buf, "%d\n", duration / 1000);
-	mutex_unlock(&powerclamp_lock);
-
-	return ret;
+	return sysfs_emit(buf, "%u\n", duration / 1000);
 }
 
 static const struct kernel_param_ops duration_ops = {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-15 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 22:15 [PATCH 1/2] thermal: intel: powerclamp: Simplify duration_get() Thorsten Blum
2026-09-15 22:15 ` [PATCH 2/2] thermal: intel: powerclamp: Simplify max_idle_set() Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®