mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] genirq/timings: Use min_t() to simplify the code
@ 2024-08-31  9:36 Jinjie Ruan
  2024-09-01 20:53 ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: Jinjie Ruan @ 2024-08-31  9:36 UTC (permalink / raw)
  To: tglx, linux-kernel; +Cc: ruanjinjie

The irq count can not exceed circular buffer IRQ_TIMINGS_SIZE, use
min_t() to simplify it.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 kernel/irq/timings.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/irq/timings.c b/kernel/irq/timings.c
index c43e2ac2f8de..69f103b4c7a6 100644
--- a/kernel/irq/timings.c
+++ b/kernel/irq/timings.c
@@ -406,8 +406,7 @@ static u64 __irq_timings_next_event(struct irqt_stat *irqs, int irq, u64 now)
 	/*
 	 * 'count' will depends if the circular buffer wrapped or not
 	 */
-	count = irqs->count < IRQ_TIMINGS_SIZE ?
-		irqs->count : IRQ_TIMINGS_SIZE;
+	count = min_t(int, irqs->count, IRQ_TIMINGS_SIZE);
 
 	start = irqs->count < IRQ_TIMINGS_SIZE ?
 		0 : (irqs->count & IRQ_TIMINGS_MASK);
-- 
2.34.1


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

end of thread, other threads:[~2024-09-02  1:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-31  9:36 [PATCH -next] genirq/timings: Use min_t() to simplify the code Jinjie Ruan
2024-09-01 20:53 ` David Laight
2024-09-02  1:58   ` Jinjie Ruan

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®