Skip to content

Commit 5244355

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
tty: tty_driver: introduce TTY driver sub/types enums
Convert TTY_DRIVER_TYPE_*, and subtype macros to two enums: tty_driver_type and tty_driver_subtype. This allows for easier kernel-doc (later), grouping of these nicely, and proper checking. The tty_driver's ::type and ::subtype now use these enums instead of bare "short". 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 63f3cd5 commit 5244355

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

include/linux/tty_driver.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,26 @@ enum tty_driver_flag {
8181
TTY_DRIVER_UNNUMBERED_NODE = BIT(7),
8282
};
8383

84-
/* tty driver types */
85-
#define TTY_DRIVER_TYPE_SYSTEM 0x0001
86-
#define TTY_DRIVER_TYPE_CONSOLE 0x0002
87-
#define TTY_DRIVER_TYPE_SERIAL 0x0003
88-
#define TTY_DRIVER_TYPE_PTY 0x0004
89-
#define TTY_DRIVER_TYPE_SCC 0x0005 /* scc driver */
90-
#define TTY_DRIVER_TYPE_SYSCONS 0x0006
84+
enum tty_driver_type {
85+
TTY_DRIVER_TYPE_SYSTEM,
86+
TTY_DRIVER_TYPE_CONSOLE,
87+
TTY_DRIVER_TYPE_SERIAL,
88+
TTY_DRIVER_TYPE_PTY,
89+
TTY_DRIVER_TYPE_SCC,
90+
TTY_DRIVER_TYPE_SYSCONS,
91+
};
9192

92-
/* system subtypes (magic, used by tty_io.c) */
93-
#define SYSTEM_TYPE_TTY 0x0001
94-
#define SYSTEM_TYPE_CONSOLE 0x0002
95-
#define SYSTEM_TYPE_SYSCONS 0x0003
96-
#define SYSTEM_TYPE_SYSPTMX 0x0004
93+
enum tty_driver_subtype {
94+
SYSTEM_TYPE_TTY = 1,
95+
SYSTEM_TYPE_CONSOLE,
96+
SYSTEM_TYPE_SYSCONS,
97+
SYSTEM_TYPE_SYSPTMX,
9798

98-
/* pty subtypes (magic, used by tty_io.c) */
99-
#define PTY_TYPE_MASTER 0x0001
100-
#define PTY_TYPE_SLAVE 0x0002
99+
PTY_TYPE_MASTER = 1,
100+
PTY_TYPE_SLAVE,
101101

102-
/* serial subtype definitions */
103-
#define SERIAL_TYPE_NORMAL 1
102+
SERIAL_TYPE_NORMAL = 1,
103+
};
104104

105105
/**
106106
* struct tty_operations -- interface between driver and tty
@@ -500,8 +500,8 @@ struct tty_operations {
500500
* @major: major /dev device number (zero for autoassignment)
501501
* @minor_start: the first minor /dev device number
502502
* @num: number of devices allocated
503-
* @type: type of tty driver (%TTY_DRIVER_TYPE_)
504-
* @subtype: subtype of tty driver (%SYSTEM_TYPE_, %PTY_TYPE_, %SERIAL_TYPE_)
503+
* @type: type of tty driver (enum tty_driver_type)
504+
* @subtype: subtype of tty driver (enum tty_driver_subtype)
505505
* @init_termios: termios to set to each tty initially (e.g. %tty_std_termios)
506506
* @flags: tty driver flags (%TTY_DRIVER_)
507507
* @proc_entry: proc fs entry, used internally
@@ -533,8 +533,8 @@ struct tty_driver {
533533
int major;
534534
int minor_start;
535535
unsigned int num;
536-
short type;
537-
short subtype;
536+
enum tty_driver_type type;
537+
enum tty_driver_subtype subtype;
538538
struct ktermios init_termios;
539539
unsigned long flags;
540540
struct proc_dir_entry *proc_entry;

0 commit comments

Comments
 (0)