Re: [PATCH 14/15] serial: 8250: allow UART drivers to override rx_trig_bytes handling

From: Andy Shevchenko

Date: Tue May 05 2026 - 05:31:26 EST


On Mon, May 4, 2026 at 11:51 AM Crescent Hsieh
<crescentcy.hsieh@xxxxxxxx> wrote:
>
> The rx_trig_bytes sysfs attribute currently relies on 8250-internal
> helper functions and assumes a fixed mapping between trigger levels and
> FIFO behavior.
>
> Some UARTs provide hardware-specific RX trigger mechanisms that do not
> fit this model. Add optional uart_port callbacks for setting and getting
> the RX trigger level, and use them when provided, while preserving the
> existing 8250 helpers as the default fallback.

...

> struct uart_port {

> void (*pm)(struct uart_port *, unsigned int state,
> unsigned int old);
> void (*handle_break)(struct uart_port *);

> + int (*set_rxtrig)(struct uart_port *port, unsigned char bytes);
> + int (*get_rxtrig)(struct uart_port *port);

Seems to me a suboptimal location for these. Why not moving up to be
closer to other getter/setter pairs?

> int (*rs485_config)(struct uart_port *,
> struct ktermios *termios,
> struct serial_rs485 *rs485);


--
With Best Regards,
Andy Shevchenko