Re: [PATCH v11 10/10] tty: serial: Add Nuvoton ma35d1 serial driver support

From: Jiri Slaby
Date: Thu May 25 2023 - 01:49:00 EST


On 24. 05. 23, 11:00, Arnd Bergmann wrote:
On Wed, May 24, 2023, at 10:34, Jacky Huang wrote:
On 2023/5/24 下午 03:42, Jiri Slaby wrote:
On 16. 05. 23, 9:52, Jacky Huang wrote:
+static void ma35d1serial_config_port(struct uart_port *port, int flags)
+{
+    /*
+     * Driver core for serial ports forces a non-zero value for port
type.
+     * Write an arbitrary value here to accommodate the serial core
driver,
+     * as ID part of UAPI is redundant.
+     */
+    port->type = 1;

So this 1 translates to PORT_8250. Why not to use it directly? Or
something more saner like PORT_16550A?

It's not actually 8250 or 16550A.
Can we add the following definition to
'include/uapi/linux/serial_core.h' and use PORT_MA35 instead?

#define PORT_MA35    124

This was already in a previous version, until Greg commented
that it was probably not needed:

https://lore.kernel.org/lkml/20fc81c9-5517-ce1e-639a-3b425cf27759@xxxxxxxxx/

Since leaving port->type at PORT_UNKNOWN doesn't work, and almost
all other drivers have something in serial_core.h, it's probably
best to do the same here. Checking the other drivers showed that
drivers/tty/serial/lantiq.c is currently the only exception, it
defines PORT_LTQ_ASC locally, which causes a conflict with
PORT_SPRD.

Hmm.

Anyone has an idea what this is really used for in userspace? Can we replace all of them by simply some sort of "PORT_OTHER"?

For example:

xdg-open `echo -n 'https://codesearch.debian.net/search?q=\b('; sed -n 's@#define\s\(\w\+\)\s.*@\1@ p' include/uapi/linux/serial_core.h | tail -20 | sed 's@.* \(.*\)[\x09 ][\x09 ]*.*@\1@'|paste -sd'|' | tr -d '\n'; echo ')\b'`

gives _no_ clue. FTR the above translates here into:
https://codesearch.debian.net/search?q=\b(PORT_HSCIF|PORT_ASC|PORT_TILEGX|PORT_MEN_Z135|PORT_SC16IS7XX|PORT_MESON|PORT_DIGICOLOR|PORT_SPRD|PORT_CRIS|PORT_STM32|PORT_MVEBU|PORT_PIC32|PORT_MPS2UART|PORT_MTK_BTIF|PORT_RDA|PORT_MLB_USIO|PORT_SIFIVE_V0|PORT_SUNIX|PORT_LINFLEXUART|PORT_SUNPLUS)\b

thanks,
--
js
suse labs