From: Jiri Slaby <jirislaby@kernel.org>
To: Tapio Reijonen <tapio.reijonen@vaisala.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Shiyan <shc_work@mail.ru>,
Hugo Villeneuve <hvilleneuve@dimonoff.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: max310x: improve interrupt handling
Date: Thu, 4 Sep 2025 09:53:25 +0200 [thread overview]
Message-ID: <214edb7a-2631-4f7f-9516-a38a3796cc0b@kernel.org> (raw)
In-Reply-To: <20250903-master-max310x-improve-interrupt-handling-v1-1-bfb44829e760@vaisala.com>
On 03. 09. 25, 11:23, Tapio Reijonen wrote:
> When there is a heavy load of receiving characters to all
> four UART's, the warning 'Hardware RX FIFO overrun' is
> sometimes detected.
> The current implementation always service first UART3 until
> no more interrupt and then service another UARTs.
>
> This commit improve interrupt service routine to handle all
> interrupt sources, e.g. UARTs when a global IRQ is detected.
>
> Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
> ---
> drivers/tty/serial/max310x.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
> index ce260e9949c3c268e706b2615d6fc01adc21e49b..3234ed7c688ff423d25a007ed8b938b249ae0b82 100644
> --- a/drivers/tty/serial/max310x.c
> +++ b/drivers/tty/serial/max310x.c
> @@ -824,15 +824,26 @@ static irqreturn_t max310x_ist(int irq, void *dev_id)
>
> if (s->devtype->nr > 1) {
> do {
> - unsigned int val = ~0;
> + unsigned int val;
> + unsigned int global_irq = ~0;
> + int port;
>
> WARN_ON_ONCE(regmap_read(s->regmap,
> - MAX310X_GLOBALIRQ_REG, &val));
> - val = ((1 << s->devtype->nr) - 1) & ~val;
> + MAX310X_GLOBALIRQ_REG, &global_irq));
> +
> + val = ((1 << s->devtype->nr) - 1) & ~global_irq;
This is horrid. Use GENMASK() (or BIT() below) instead. Likely, you want
a local var storing the mask (the first part before the &).
> if (!val)
> break;
> - if (max310x_port_irq(s, fls(val) - 1) == IRQ_HANDLED)
> - handled = true;
> +
> + do {
> + port = fls(val) - 1;
> + if (max310x_port_irq(s, port) == IRQ_HANDLED)
> + handled = true;
> +
> + global_irq |= 1 << port;
> + val = ((1 << s->devtype->nr) - 1) & ~global_irq;
> + } while (val);
Actually, does it have to be from the end? I am thinking of
for_each_and_bit()...
> } while (1);
> } else {
> if (max310x_port_irq(s, 0) == IRQ_HANDLED)
thanks,
--
js
suse labs
next prev parent reply other threads:[~2025-09-04 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 9:23 [PATCH] serial: max310x: improve interrupt handling Tapio Reijonen
2025-09-03 15:37 ` Hugo Villeneuve
2025-09-04 7:23 ` Tapio Reijonen
2025-09-04 7:53 ` Jiri Slaby [this message]
2025-09-04 11:50 ` Tapio Reijonen
2025-09-04 16:36 ` Hugo Villeneuve
2025-09-05 5:11 ` Tapio Reijonen
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=214edb7a-2631-4f7f-9516-a38a3796cc0b@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hvilleneuve@dimonoff.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=shc_work@mail.ru \
--cc=tapio.reijonen@vaisala.com \
/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