From: David Laight <David.Laight@ACULAB.COM>
To: 'Jinjie Ruan' <ruanjinjie@huawei.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH -next] genirq/timings: Use min_t() to simplify the code
Date: Sun, 1 Sep 2024 20:53:09 +0000 [thread overview]
Message-ID: <b7cc4af3df4c41b3975ac990532e4ba0@AcuMS.aculab.com> (raw)
In-Reply-To: <20240831093654.4139823-1-ruanjinjie@huawei.com>
From: Jinjie Ruan
> Sent: 31 August 2024 10:37
>
> 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);
Why min_t() ?
David
>
> start = irqs->count < IRQ_TIMINGS_SIZE ?
> 0 : (irqs->count & IRQ_TIMINGS_MASK);
> --
> 2.34.1
>
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2024-09-01 20:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 9:36 Jinjie Ruan
2024-09-01 20:53 ` David Laight [this message]
2024-09-02 1:58 ` Jinjie Ruan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b7cc4af3df4c41b3975ac990532e4ba0@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®