serial: add PORT_GENERIC definition
PATCH v2 1/1 serial: add PORT_GENERIC definition
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.
---
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(+)
include/uapi/linux/serial_core.h +3 -0
@@ -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 */
Signature · 1 line
2.30.2
Quoted 11 lines · Max Filippov
Current pattern in the linux kernel is that every new serial driver adds one or more new
PORT_definitions becauseuart_ops::config_port()callback documentation prescribes settingport->typeaccording to the type of port found, or toPORT_UNKNOWNif 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_UNKNOWNfor ports which type is not important to userspace.
Oh, finally someone submitted this.
Quoted 2 lines
Suggested-by Arnd Bergmann <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>
In that case metoo [1]:
and
[1] https://lore.kernel.org/all/[email protected]/
Quoted 21 lines
Signed-off-by Max Filippov <[email protected]>---
Changesv1->v2:
- move to the end ofPORT_definition list
- rename toPORT_GENERICinclude/uapi/linux/serial_core.h | 3 +++ 1 file changed, 3 insertions(+)include/uapi/linux/serial_core.h +3
-0@@ -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 */
Signature · 2 lines
js suse labs