From: Jiri Slaby <jirislaby@kernel.org>
To: Crescent Hsieh <crescentcy.hsieh@moxa.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
FangpingFP.Cheng@moxa.com, Epson.Chiang@moxa.com
Subject: Re: [PATCH v3 06/15] serial: 8250_mxpcie: add custom handle_irq callback
Date: Thu, 9 Jul 2026 08:59:44 +0200 [thread overview]
Message-ID: <9b45a796-9b84-4977-b697-cc91c4c6adbf@kernel.org> (raw)
In-Reply-To: <20260709053314.435629-7-crescentcy.hsieh@moxa.com>
On 09. 07. 26, 7:33, Crescent Hsieh wrote:
...
> --- a/drivers/tty/serial/8250/8250_mxpcie.c
> +++ b/drivers/tty/serial/8250/8250_mxpcie.c
> @@ -266,6 +266,48 @@ static void mxpcie8250_unthrottle(struct uart_port *port)
> serial_out(up, UART_IER, up->ier);
> }
>
> +static u16 mxpcie8250_rx_chars(struct uart_8250_port *up, u16 lsr)
> +{
> + struct uart_port *port = &up->port;
> +
> + if (!(lsr & (UART_LSR_DR | UART_LSR_BI)))
> + return lsr;
> +
> + if (!(port->status & (UPSTAT_AUTOCTS | UPSTAT_AUTORTS)))
> + goto do_rx;
> + if (lsr & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS))
> + goto do_rx;
> + if (port->read_status_mask & UART_LSR_DR)
> + goto do_rx;
Perhaps extract the tests to a separate function (like bool
mxpcie8250_should_rx()) to get rid of the goto+label?
mxpcie8250_should_rx() and serial8250_rx_chars() could be called
directly in the ISR then...
> + return lsr;
> +
> +do_rx:
> + return serial8250_rx_chars(up, lsr);
> +}
> +
> +static int mxpcie8250_handle_irq(struct uart_port *port)
> +{
> + struct uart_8250_port *up = up_to_u8250p(port);
> + u16 lsr;
> + u8 iir;
> +
> + iir = serial_in(up, UART_IIR);
> + if (iir & UART_IIR_NO_INT)
> + return 0;
> +
> + guard(uart_port_lock_check_sysrq_irqsave)(port);
> +
> + lsr = mxpcie8250_rx_chars(up, serial_lsr_in(up));
> +
> + serial8250_modem_status(up);
> +
> + if ((lsr & UART_LSR_THRE) && (up->ier & UART_IER_THRI))
> + serial8250_tx_chars(up);
> +
> + return 1;
> +}
thanks,
--
js
suse labs
next prev parent reply other threads:[~2026-07-09 6:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 5:32 [PATCH v3 00/15] serial: 8250: add Moxa MUEx50 PCIe board support Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 01/15] serial: 8250: split Moxa PCIe serial board support out of 8250_pci Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 02/15] serial: 8250: add Moxa MUEx50 UART port type Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 03/15] serial: 8250_mxpcie: enable enhanced mode and program FIFO trigger levels Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 04/15] serial: 8250_mxpcie: enable automatic RTS/CTS flow control Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 05/15] serial: 8250_mxpcie: offload XON/XOFF flow control to MUEx50 hardware Crescent Hsieh
2026-07-09 6:13 ` Jiri Slaby
2026-07-09 5:33 ` [PATCH v3 06/15] serial: 8250_mxpcie: add custom handle_irq callback Crescent Hsieh
2026-07-09 6:59 ` Jiri Slaby [this message]
2026-07-09 5:33 ` [PATCH v3 07/15] serial: 8250_mxpcie: speed up RX using memory-mapped FIFO window Crescent Hsieh
2026-07-09 7:12 ` Jiri Slaby
2026-07-09 5:33 ` [PATCH v3 08/15] serial: 8250_mxpcie: speed up TX " Crescent Hsieh
2026-07-09 7:15 ` Jiri Slaby
2026-07-09 5:33 ` [PATCH v3 09/15] serial: 8250_mxpcie: introduce per-port private data structure Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 10/15] serial: 8250_mxpcie: defer uart_write_wakeup() to workqueue Crescent Hsieh
2026-07-09 8:07 ` Jiri Slaby
2026-07-09 5:33 ` [PATCH v3 11/15] serial: 8250_mxpcie: support serial interface mode switching Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 12/15] serial: 8250: allow low-level drivers to override break control Crescent Hsieh
2026-07-09 8:10 ` Jiri Slaby
2026-07-09 5:33 ` [PATCH v3 13/15] serial: 8250_mxpcie: add break support for RS485 using MUEx50 features Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 14/15] serial: 8250: allow UART drivers to override rx_trig_bytes handling Crescent Hsieh
2026-07-09 5:33 ` [PATCH v3 15/15] serial: 8250_mxpcie: implement rx_trig_bytes callbacks via MUEx50 RTL Crescent Hsieh
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=9b45a796-9b84-4977-b697-cc91c4c6adbf@kernel.org \
--to=jirislaby@kernel.org \
--cc=Epson.Chiang@moxa.com \
--cc=FangpingFP.Cheng@moxa.com \
--cc=andy.shevchenko@gmail.com \
--cc=crescentcy.hsieh@moxa.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/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