lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcPanVWaLi39Wf-pq8nA+xbeJUs=v1BACz-+Sns0BVyWg@mail.gmail.com>
Date: Mon, 1 Dec 2025 04:02:54 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Crescent Hsieh <crescentcy.hsieh@...a.com>
Cc: gregkh@...uxfoundation.org, jirislaby@...nel.org, 
	ilpo.jarvinen@...ux.intel.com, linux-kernel@...r.kernel.org, 
	linux-serial@...r.kernel.org
Subject: Re: [PATCH v1 21/31] serial: 8250_mxpcie: implement rx_trig_bytes
 callbacks and persist per-port level

On Sun, Nov 30, 2025 at 12:45 PM Crescent Hsieh
<crescentcy.hsieh@...a.com> wrote:
>
> This patch implements device-specific RX trigger handling for the
> rx_trig_bytes sysfs attribute by programming MOXA_PUART_RTL directly.
>
> Changes:
> - Add a per-port structure to persist both the registered line and the
>   RX trigger level, allowing the level to be restored on startup.
> - Implement uart_port callbacks:
>     - set_rxtrig(port, bytes): program MOXA_PUART_RTL and cache the value
>     - get_rxtrig(port):        read back MOXA_PUART_RTL
> - Use the cached RX trigger level during startup instead of a fixed
>   default, while keeping the initial default at 96 for backward
>   compatibility.
>
> With these callbacks in place, writes to rx_trig_bytes update the
> hardware-specific register immediately, and the selected threshold is
> preserved across open/close cycles.
>
> No functional change for other 8250 drivers.

...

>  static int mxpcie8250_startup(struct uart_port *port)
>  {
> +       struct pci_dev *pdev = to_pci_dev(port->dev);
> +       struct mxpcie8250 *priv = pci_get_drvdata(pdev);

It's a bit of a detour to simply use dev_get_drvdata() in an agnostic
way. With the above the code will need a change once the device uses
another bus.

>         struct uart_8250_port *up = up_to_u8250p(port);
>         int i, ret;

>  }

...

> +static int mxpcie8250_set_rxtrig(struct uart_port *port, unsigned char bytes)
> +{
> +       struct uart_8250_port *up = up_to_u8250p(port);

> +       struct pci_dev *pdev = to_pci_dev(port->dev);
> +       struct mxpcie8250 *priv = pci_get_drvdata(pdev);

Ditto. Aslo locate the lines consistently with the other function
(usually in reversed xmas tree order).

> +       if (bytes > 128)
> +               return -EINVAL;
> +
> +       serial_out(up, MOXA_PUART_RTL, bytes);
> +       priv->port[port->port_id].rx_trig_level = bytes;
> +
> +       return 0;
> +}

...

> +static int mxpcie8250_get_rxtrig(struct uart_port *port)
> +{
> +       struct uart_8250_port *up = up_to_u8250p(port);

> +       int rx_trig_byte;

Seems a useless variable. Is there something in the next changes that
justifies its presence?

> +       rx_trig_byte = serial_in(up, MOXA_PUART_RTL);
> +
> +       return rx_trig_byte;
> +}

...

Also it seems that this change can be split to two:
- preparatory that moves just a line member to a new data structure
- this one which adds required features

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ