Skip to contentSkip to conversation

s390/cmm: Use max to simplify cmm_timer_fn

PATCH In review Thorsten Blum 2 participants 2 messages Dec 22, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/cmm: Use max to simplify cmm_timer_fn

Use max() to replace the open-coded version and simplify cmm_timer_fn().

---
 arch/s390/mm/cmm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/s390/mm/cmm.c +2 -4
index 06512bc178a5..fa1318d748b1 100644
@@ -10,6 +10,7 @@
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/init.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/gfp.h>
@@ -212,10 +213,7 @@ static void cmm_timer_fn(struct timer_list *unused)
 	long nr;
 
 	nr = cmm_timed_pages_target - cmm_timeout_pages;
-	if (nr < 0)
-		cmm_timed_pages_target = 0;
-	else
-		cmm_timed_pages_target = nr;
+	cmm_timed_pages_target = max(0, nr);
 	cmm_kick_thread();
 	cmm_set_timer();
 }
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
maintainer
#1 lore raw

Thorsten,

Quoted 6 lines · Thorsten Blum

Use max() to replace the open-coded version and simplify cmm_timer_fn().

---
 arch/s390/mm/cmm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

...

arch/s390/mm/cmm.c static void cmm_timer_fn(struct timer_list *unused) · line 216

Quoted 6 lines
arch/s390/mm/cmm.c +1 -4
 	nr = cmm_timed_pages_target - cmm_timeout_pages;
-	if (nr < 0)
-		cmm_timed_pages_target = 0;
-	else
-		cmm_timed_pages_target = nr;
+	cmm_timed_pages_target = max(0, nr);

Just in case it wasn't clear in the past: trivial patches like this won't be taken. You already managed to send buggy patches which look trivial, and I'm not willing to spend time to look for subtle bugs such trivial patches might introduce.

In other words: you may stop sending such patches which address s390 code.