Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: tty_driver: convert "TTY Driver Flags" to an enum

Convert TTY_DRIVER_* macros (flags) to an enum. This allows for easier
kernel-doc (the comment needed fine tuning), grouping of these nicely,
and proper checking.

Given these are flags, define them using modern BIT() instead of hex
constants.

It turns out (thanks, kernel-doc checker) that internal
TTY_DRIVER_INSTALLED was undocumented. Fix that too.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250317070046.24386-14-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
109e06ae 67acbcc3

+25 -17
+1 -1
Documentation/driver-api/tty/tty_driver.rst
··· 35 35 __tty_alloc_driver()): 36 36 37 37 .. kernel-doc:: include/linux/tty_driver.h 38 - :doc: TTY Driver Flags 38 + :identifiers: tty_driver_flag 39 39 40 40 ---- 41 41
+24 -16
include/linux/tty_driver.h
··· 17 17 struct serial_struct; 18 18 19 19 /** 20 - * DOC: TTY Driver Flags 20 + * enum tty_driver_flag -- TTY Driver Flags 21 21 * 22 - * TTY_DRIVER_RESET_TERMIOS 22 + * These are flags passed to tty_alloc_driver(). 23 + * 24 + * @TTY_DRIVER_INSTALLED: 25 + * Whether this driver was succesfully installed. This is a tty internal 26 + * flag. Do not touch. 27 + * 28 + * @TTY_DRIVER_RESET_TERMIOS: 23 29 * Requests the tty layer to reset the termios setting when the last 24 30 * process has closed the device. Used for PTYs, in particular. 25 31 * 26 - * TTY_DRIVER_REAL_RAW 32 + * @TTY_DRIVER_REAL_RAW: 27 33 * Indicates that the driver will guarantee not to set any special 28 34 * character handling flags if this is set for the tty: 29 35 * ··· 41 35 * this case if this flag is set. (Note that there is also a promise, if 42 36 * the above case is true, not to signal overruns, either.) 43 37 * 44 - * TTY_DRIVER_DYNAMIC_DEV 38 + * @TTY_DRIVER_DYNAMIC_DEV: 45 39 * The individual tty devices need to be registered with a call to 46 40 * tty_register_device() when the device is found in the system and 47 41 * unregistered with a call to tty_unregister_device() so the devices will ··· 51 45 * appear and disappear while the main tty driver is registered with the 52 46 * tty core. 53 47 * 54 - * TTY_DRIVER_DEVPTS_MEM 48 + * @TTY_DRIVER_DEVPTS_MEM: 55 49 * Don't use the standard arrays (&tty_driver.ttys and 56 50 * &tty_driver.termios), instead use dynamic memory keyed through the 57 51 * devpts filesystem. This is only applicable to the PTY driver. 58 52 * 59 - * TTY_DRIVER_HARDWARE_BREAK 53 + * @TTY_DRIVER_HARDWARE_BREAK: 60 54 * Hardware handles break signals. Pass the requested timeout to the 61 55 * &tty_operations.break_ctl instead of using a simple on/off interface. 62 56 * 63 - * TTY_DRIVER_DYNAMIC_ALLOC 57 + * @TTY_DRIVER_DYNAMIC_ALLOC: 64 58 * Do not allocate structures which are needed per line for this driver 65 59 * (&tty_driver.ports) as it would waste memory. The driver will take 66 60 * care. This is only applicable to the PTY driver. 67 61 * 68 - * TTY_DRIVER_UNNUMBERED_NODE 62 + * @TTY_DRIVER_UNNUMBERED_NODE: 69 63 * Do not create numbered ``/dev`` nodes. For example, create 70 64 * ``/dev/ttyprintk`` and not ``/dev/ttyprintk0``. Applicable only when a 71 65 * driver for a single tty device is being allocated. 72 66 */ 73 - #define TTY_DRIVER_INSTALLED 0x0001 74 - #define TTY_DRIVER_RESET_TERMIOS 0x0002 75 - #define TTY_DRIVER_REAL_RAW 0x0004 76 - #define TTY_DRIVER_DYNAMIC_DEV 0x0008 77 - #define TTY_DRIVER_DEVPTS_MEM 0x0010 78 - #define TTY_DRIVER_HARDWARE_BREAK 0x0020 79 - #define TTY_DRIVER_DYNAMIC_ALLOC 0x0040 80 - #define TTY_DRIVER_UNNUMBERED_NODE 0x0080 67 + enum tty_driver_flag { 68 + TTY_DRIVER_INSTALLED = BIT(0), 69 + TTY_DRIVER_RESET_TERMIOS = BIT(1), 70 + TTY_DRIVER_REAL_RAW = BIT(2), 71 + TTY_DRIVER_DYNAMIC_DEV = BIT(3), 72 + TTY_DRIVER_DEVPTS_MEM = BIT(4), 73 + TTY_DRIVER_HARDWARE_BREAK = BIT(5), 74 + TTY_DRIVER_DYNAMIC_ALLOC = BIT(6), 75 + TTY_DRIVER_UNNUMBERED_NODE = BIT(7), 76 + }; 81 77 82 78 /* tty driver types */ 83 79 #define TTY_DRIVER_TYPE_SYSTEM 0x0001