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

tty: create internal tty.h file

There are a number of functions and #defines in include/linux/tty.h that
do not belong there as they are private to the tty core code.

Create an initial drivers/tty/tty.h file and copy the odd "tty logging"
macros into it to seed the file with some initial things that we know
nothing outside of the tty core should be calling.

Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20210408125134.3016837-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+27 -12
+1
drivers/tty/n_tty.c
··· 49 49 #include <linux/module.h> 50 50 #include <linux/ratelimit.h> 51 51 #include <linux/vmalloc.h> 52 + #include "tty.h" 52 53 53 54 /* 54 55 * Until this number of characters is queued in the xmit buffer, select will
+1
drivers/tty/pty.c
··· 29 29 #include <linux/file.h> 30 30 #include <linux/ioctl.h> 31 31 #include <linux/compat.h> 32 + #include "tty.h" 32 33 33 34 #undef TTY_DEBUG_HANGUP 34 35 #ifdef TTY_DEBUG_HANGUP
+21
drivers/tty/tty.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * TTY core internal functions 4 + */ 5 + 6 + #ifndef _TTY_INTERNAL_H 7 + #define _TTY_INTERNAL_H 8 + 9 + #define tty_msg(fn, tty, f, ...) \ 10 + fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__) 11 + 12 + #define tty_debug(tty, f, ...) tty_msg(pr_debug, tty, f, ##__VA_ARGS__) 13 + #define tty_info(tty, f, ...) tty_msg(pr_info, tty, f, ##__VA_ARGS__) 14 + #define tty_notice(tty, f, ...) tty_msg(pr_notice, tty, f, ##__VA_ARGS__) 15 + #define tty_warn(tty, f, ...) tty_msg(pr_warn, tty, f, ##__VA_ARGS__) 16 + #define tty_err(tty, f, ...) tty_msg(pr_err, tty, f, ##__VA_ARGS__) 17 + 18 + #define tty_info_ratelimited(tty, f, ...) \ 19 + tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__) 20 + 21 + #endif
+1
drivers/tty/tty_io.c
··· 108 108 109 109 #include <linux/kmod.h> 110 110 #include <linux/nsproxy.h> 111 + #include "tty.h" 111 112 112 113 #undef TTY_DEBUG_HANGUP 113 114 #ifdef TTY_DEBUG_HANGUP
+1
drivers/tty/tty_jobctrl.c
··· 11 11 #include <linux/tty.h> 12 12 #include <linux/fcntl.h> 13 13 #include <linux/uaccess.h> 14 + #include "tty.h" 14 15 15 16 static int is_ignored(int sig) 16 17 {
+1
drivers/tty/tty_ldisc.c
··· 19 19 #include <linux/seq_file.h> 20 20 #include <linux/uaccess.h> 21 21 #include <linux/ratelimit.h> 22 + #include "tty.h" 22 23 23 24 #undef LDISC_DEBUG_HANGUP 24 25
+1
drivers/tty/tty_port.c
··· 18 18 #include <linux/delay.h> 19 19 #include <linux/module.h> 20 20 #include <linux/serdev.h> 21 + #include "tty.h" 21 22 22 23 static int tty_port_default_receive_buf(struct tty_port *port, 23 24 const unsigned char *p,
-12
include/linux/tty.h
··· 772 772 static inline void proc_tty_unregister_driver(struct tty_driver *d) {} 773 773 #endif 774 774 775 - #define tty_msg(fn, tty, f, ...) \ 776 - fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__) 777 - 778 - #define tty_debug(tty, f, ...) tty_msg(pr_debug, tty, f, ##__VA_ARGS__) 779 - #define tty_info(tty, f, ...) tty_msg(pr_info, tty, f, ##__VA_ARGS__) 780 - #define tty_notice(tty, f, ...) tty_msg(pr_notice, tty, f, ##__VA_ARGS__) 781 - #define tty_warn(tty, f, ...) tty_msg(pr_warn, tty, f, ##__VA_ARGS__) 782 - #define tty_err(tty, f, ...) tty_msg(pr_err, tty, f, ##__VA_ARGS__) 783 - 784 - #define tty_info_ratelimited(tty, f, ...) \ 785 - tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__) 786 - 787 775 #endif