Re: [PATCH v2 06/15] serial: 8250_mxpcie: add custom handle_irq callback

From: Andy Shevchenko

Date: Wed Jul 01 2026 - 08:54:50 EST


On Wed, Jul 01, 2026 at 11:41:19AM +0800, Crescent Hsieh wrote:
> Add a mxpcie-specific handle_irq() implementation for Moxa PCIe serial
> ports.
>
> This keeps the interrupt handling self-contained in the driver and
> provides a hook point for MUEx50-specific RX/TX paths added in subsequent
> patches. The handler processes RX, updates modem status, and handles TX
> when THRE is asserted.

...

> +static int mxpcie8250_handle_irq(struct uart_port *port)
> +{
> + struct uart_8250_port *up = up_to_u8250p(port);
> + unsigned long flags;
> + u16 lsr;
> + u8 iir;
> +
> + iir = serial_in(up, UART_IIR);
> + if (iir & UART_IIR_NO_INT)
> + return 0;
> +
> + uart_port_lock_irqsave(port, &flags);

> + lsr = serial_lsr_in(up);
> +
> + lsr = mxpcie8250_rx_chars(up, lsr);

Haven't checked each patch in the series, but can this be joined?

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);

> + uart_unlock_and_check_sysrq_irqrestore(port, flags);

So, in modern kernel we need to use guard()() instead, here it's

guard(uart_port_lock_check_sysrq_irqsave)(port);

> + return 1;
> +}

--
With Best Regards,
Andy Shevchenko