linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] serial: add PORT_GENERIC definition
@ 2023-10-08  0:18 Max Filippov
  2023-10-09  6:03 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Max Filippov @ 2023-10-08  0:18 UTC (permalink / raw)
  To: linux-kernel, linux-serial
  Cc: Greg Kroah-Hartman, Jiri Slaby, Arnd Bergmann, Max Filippov

Current pattern in the linux kernel is that every new serial driver adds
one or more new PORT_ definitions because uart_ops::config_port()
callback documentation prescribes setting port->type according to the
type of port found, or to PORT_UNKNOWN if no port was detected.

When the specific type of the port is not important to the userspace
there's no need for a unique PORT_ value, but so far there's no suitable
identifier for that case.

Provide generic port type identifier other than PORT_UNKNOWN for ports
which type is not important to userspace.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1->v2:
- move to the end of PORT_ definition list
- rename to PORT_GENERIC

 include/uapi/linux/serial_core.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index add349889d0a..0a5090e08657 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -245,4 +245,7 @@
 /* Sunplus UART */
 #define PORT_SUNPLUS	123
 
+/* Generic type identifier for ports which type is not important to userspace. */
+#define PORT_GENERIC	(-1)
+
 #endif /* _UAPILINUX_SERIAL_CORE_H */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] serial: add PORT_GENERIC definition
  2023-10-08  0:18 [PATCH v2] serial: add PORT_GENERIC definition Max Filippov
@ 2023-10-09  6:03 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2023-10-09  6:03 UTC (permalink / raw)
  To: Max Filippov, linux-kernel, linux-serial
  Cc: Greg Kroah-Hartman, Arnd Bergmann

On 08. 10. 23, 2:18, Max Filippov wrote:
> Current pattern in the linux kernel is that every new serial driver adds
> one or more new PORT_ definitions because uart_ops::config_port()
> callback documentation prescribes setting port->type according to the
> type of port found, or to PORT_UNKNOWN if no port was detected.
> 
> When the specific type of the port is not important to the userspace
> there's no need for a unique PORT_ value, but so far there's no suitable
> identifier for that case.
> 
> Provide generic port type identifier other than PORT_UNKNOWN for ports
> which type is not important to userspace.

Oh, finally someone submitted this.

> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In that case metoo [1]:
Suggested-by: Jiri Slaby <jirislaby@kernel.org>
and
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

[1] 
https://lore.kernel.org/all/75375f8d-e157-a364-3da5-9c8d5b832927@kernel.org/

> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> Changes v1->v2:
> - move to the end of PORT_ definition list
> - rename to PORT_GENERIC
> 
>   include/uapi/linux/serial_core.h | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
> index add349889d0a..0a5090e08657 100644
> --- a/include/uapi/linux/serial_core.h
> +++ b/include/uapi/linux/serial_core.h
> @@ -245,4 +245,7 @@
>   /* Sunplus UART */
>   #define PORT_SUNPLUS	123
>   
> +/* Generic type identifier for ports which type is not important to userspace. */
> +#define PORT_GENERIC	(-1)
> +
>   #endif /* _UAPILINUX_SERIAL_CORE_H */

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-09  6:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-08  0:18 [PATCH v2] serial: add PORT_GENERIC definition Max Filippov
2023-10-09  6:03 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).