mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] parisc: Use max() to improve code
@ 2024-07-04  4:51 Thorsten Blum
  2024-07-04 20:39 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-07-04  4:51 UTC (permalink / raw)
  To: James.Bottomley, deller, rppt; +Cc: linux-parisc, linux-kernel, Thorsten Blum

Use max() to reduce 4 lines of code to a single line and improve its
readability.

Fixes the following Coccinelle/coccicheck warning reported by
minmax.cocci:

  WARNING opportunity for max()

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 arch/parisc/kernel/cache.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 483bfafd930c..db531e58d70e 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -611,11 +611,7 @@ void __init parisc_setup_cache_timing(void)
 		threshold/1024);
 
 set_tlb_threshold:
-	if (threshold > FLUSH_TLB_THRESHOLD)
-		parisc_tlb_flush_threshold = threshold;
-	else
-		parisc_tlb_flush_threshold = FLUSH_TLB_THRESHOLD;
-
+	parisc_tlb_flush_threshold = max(threshold, FLUSH_TLB_THRESHOLD);
 	printk(KERN_INFO "TLB flush threshold set to %lu KiB\n",
 		parisc_tlb_flush_threshold/1024);
 }
-- 
2.45.2


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

* Re: [PATCH] parisc: Use max() to improve code
  2024-07-04  4:51 [PATCH] parisc: Use max() to improve code Thorsten Blum
@ 2024-07-04 20:39 ` Helge Deller
  0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2024-07-04 20:39 UTC (permalink / raw)
  To: Thorsten Blum, James.Bottomley, rppt; +Cc: linux-parisc, linux-kernel

On 7/4/24 06:51, Thorsten Blum wrote:
> Use max() to reduce 4 lines of code to a single line and improve its
> readability.
>
> Fixes the following Coccinelle/coccicheck warning reported by
> minmax.cocci:
>
>    WARNING opportunity for max()
>
> Compile-tested only.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>

applied.

Thanks!
Helge

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

end of thread, other threads:[~2024-07-04 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-04  4:51 [PATCH] parisc: Use max() to improve code Thorsten Blum
2024-07-04 20:39 ` Helge Deller

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®