Skip to content

Commit 109e06a

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
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) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 67acbcc commit 109e06a

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

Documentation/driver-api/tty/tty_driver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Here comes the documentation of flags accepted by tty_alloc_driver() (or
3535
__tty_alloc_driver()):
3636

3737
.. kernel-doc:: include/linux/tty_driver.h
38-
:doc: TTY Driver Flags
38+
:identifiers: tty_driver_flag
3939

4040
----
4141

include/linux/tty_driver.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ struct serial_icounter_struct;
1717
struct serial_struct;
1818

1919
/**
20-
* DOC: TTY Driver Flags
20+
* enum tty_driver_flag -- TTY Driver Flags
2121
*
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:
2329
* Requests the tty layer to reset the termios setting when the last
2430
* process has closed the device. Used for PTYs, in particular.
2531
*
26-
* TTY_DRIVER_REAL_RAW
32+
* @TTY_DRIVER_REAL_RAW:
2733
* Indicates that the driver will guarantee not to set any special
2834
* character handling flags if this is set for the tty:
2935
*
@@ -35,7 +41,7 @@ struct serial_struct;
3541
* this case if this flag is set. (Note that there is also a promise, if
3642
* the above case is true, not to signal overruns, either.)
3743
*
38-
* TTY_DRIVER_DYNAMIC_DEV
44+
* @TTY_DRIVER_DYNAMIC_DEV:
3945
* The individual tty devices need to be registered with a call to
4046
* tty_register_device() when the device is found in the system and
4147
* unregistered with a call to tty_unregister_device() so the devices will
@@ -45,33 +51,35 @@ struct serial_struct;
4551
* appear and disappear while the main tty driver is registered with the
4652
* tty core.
4753
*
48-
* TTY_DRIVER_DEVPTS_MEM
54+
* @TTY_DRIVER_DEVPTS_MEM:
4955
* Don't use the standard arrays (&tty_driver.ttys and
5056
* &tty_driver.termios), instead use dynamic memory keyed through the
5157
* devpts filesystem. This is only applicable to the PTY driver.
5258
*
53-
* TTY_DRIVER_HARDWARE_BREAK
59+
* @TTY_DRIVER_HARDWARE_BREAK:
5460
* Hardware handles break signals. Pass the requested timeout to the
5561
* &tty_operations.break_ctl instead of using a simple on/off interface.
5662
*
57-
* TTY_DRIVER_DYNAMIC_ALLOC
63+
* @TTY_DRIVER_DYNAMIC_ALLOC:
5864
* Do not allocate structures which are needed per line for this driver
5965
* (&tty_driver.ports) as it would waste memory. The driver will take
6066
* care. This is only applicable to the PTY driver.
6167
*
62-
* TTY_DRIVER_UNNUMBERED_NODE
68+
* @TTY_DRIVER_UNNUMBERED_NODE:
6369
* Do not create numbered ``/dev`` nodes. For example, create
6470
* ``/dev/ttyprintk`` and not ``/dev/ttyprintk0``. Applicable only when a
6571
* driver for a single tty device is being allocated.
6672
*/
67-
#define TTY_DRIVER_INSTALLED 0x0001
68-
#define TTY_DRIVER_RESET_TERMIOS 0x0002
69-
#define TTY_DRIVER_REAL_RAW 0x0004
70-
#define TTY_DRIVER_DYNAMIC_DEV 0x0008
71-
#define TTY_DRIVER_DEVPTS_MEM 0x0010
72-
#define TTY_DRIVER_HARDWARE_BREAK 0x0020
73-
#define TTY_DRIVER_DYNAMIC_ALLOC 0x0040
74-
#define TTY_DRIVER_UNNUMBERED_NODE 0x0080
73+
enum tty_driver_flag {
74+
TTY_DRIVER_INSTALLED = BIT(0),
75+
TTY_DRIVER_RESET_TERMIOS = BIT(1),
76+
TTY_DRIVER_REAL_RAW = BIT(2),
77+
TTY_DRIVER_DYNAMIC_DEV = BIT(3),
78+
TTY_DRIVER_DEVPTS_MEM = BIT(4),
79+
TTY_DRIVER_HARDWARE_BREAK = BIT(5),
80+
TTY_DRIVER_DYNAMIC_ALLOC = BIT(6),
81+
TTY_DRIVER_UNNUMBERED_NODE = BIT(7),
82+
};
7583

7684
/* tty driver types */
7785
#define TTY_DRIVER_TYPE_SYSTEM 0x0001

0 commit comments

Comments
 (0)