All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Jiri Slaby <jirislaby@kernel.org>
Subject: [PATCH 01/13] tty: create internal tty.h file
Date: Thu,  8 Apr 2021 14:51:22 +0200	[thread overview]
Message-ID: <20210408125134.3016837-2-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20210408125134.3016837-1-gregkh@linuxfoundation.org>

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/n_tty.c       |  1 +
 drivers/tty/pty.c         |  1 +
 drivers/tty/tty.h         | 21 +++++++++++++++++++++
 drivers/tty/tty_io.c      |  1 +
 drivers/tty/tty_jobctrl.c |  1 +
 drivers/tty/tty_ldisc.c   |  1 +
 drivers/tty/tty_port.c    |  1 +
 include/linux/tty.h       | 12 ------------
 8 files changed, 27 insertions(+), 12 deletions(-)
 create mode 100644 drivers/tty/tty.h

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 87ec15dbe10d..ff1b3154ba0c 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -49,6 +49,7 @@
 #include <linux/module.h>
 #include <linux/ratelimit.h>
 #include <linux/vmalloc.h>
+#include "tty.h"
 
 /*
  * Until this number of characters is queued in the xmit buffer, select will
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 5e2374580e27..6c90d3fd2d51 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -29,6 +29,7 @@
 #include <linux/file.h>
 #include <linux/ioctl.h>
 #include <linux/compat.h>
+#include "tty.h"
 
 #undef TTY_DEBUG_HANGUP
 #ifdef TTY_DEBUG_HANGUP
diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h
new file mode 100644
index 000000000000..f4cd20261e91
--- /dev/null
+++ b/drivers/tty/tty.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * TTY core internal functions
+ */
+
+#ifndef _TTY_INTERNAL_H
+#define _TTY_INTERNAL_H
+
+#define tty_msg(fn, tty, f, ...) \
+	fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__)
+
+#define tty_debug(tty, f, ...)	tty_msg(pr_debug, tty, f, ##__VA_ARGS__)
+#define tty_info(tty, f, ...)	tty_msg(pr_info, tty, f, ##__VA_ARGS__)
+#define tty_notice(tty, f, ...)	tty_msg(pr_notice, tty, f, ##__VA_ARGS__)
+#define tty_warn(tty, f, ...)	tty_msg(pr_warn, tty, f, ##__VA_ARGS__)
+#define tty_err(tty, f, ...)	tty_msg(pr_err, tty, f, ##__VA_ARGS__)
+
+#define tty_info_ratelimited(tty, f, ...) \
+		tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
+
+#endif
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 391bada4cedb..c95f72085cdb 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -108,6 +108,7 @@
 
 #include <linux/kmod.h>
 #include <linux/nsproxy.h>
+#include "tty.h"
 
 #undef TTY_DEBUG_HANGUP
 #ifdef TTY_DEBUG_HANGUP
diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c
index 4b751b9285ad..0728730d38d1 100644
--- a/drivers/tty/tty_jobctrl.c
+++ b/drivers/tty/tty_jobctrl.c
@@ -11,6 +11,7 @@
 #include <linux/tty.h>
 #include <linux/fcntl.h>
 #include <linux/uaccess.h>
+#include "tty.h"
 
 static int is_ignored(int sig)
 {
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 1ba74d6f5e5c..2e8da820c303 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -19,6 +19,7 @@
 #include <linux/seq_file.h>
 #include <linux/uaccess.h>
 #include <linux/ratelimit.h>
+#include "tty.h"
 
 #undef LDISC_DEBUG_HANGUP
 
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 346d20f4a486..303c198fbf5c 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -18,6 +18,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/serdev.h>
+#include "tty.h"
 
 static int tty_port_default_receive_buf(struct tty_port *port,
 					const unsigned char *p,
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 95fc2f100f12..fd8308a1f37e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -772,16 +772,4 @@ static inline void proc_tty_register_driver(struct tty_driver *d) {}
 static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
 #endif
 
-#define tty_msg(fn, tty, f, ...) \
-	fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__)
-
-#define tty_debug(tty, f, ...)	tty_msg(pr_debug, tty, f, ##__VA_ARGS__)
-#define tty_info(tty, f, ...)	tty_msg(pr_info, tty, f, ##__VA_ARGS__)
-#define tty_notice(tty, f, ...)	tty_msg(pr_notice, tty, f, ##__VA_ARGS__)
-#define tty_warn(tty, f, ...)	tty_msg(pr_warn, tty, f, ##__VA_ARGS__)
-#define tty_err(tty, f, ...)	tty_msg(pr_err, tty, f, ##__VA_ARGS__)
-
-#define tty_info_ratelimited(tty, f, ...) \
-		tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
-
 #endif
-- 
2.31.1


  reply	other threads:[~2021-04-08 12:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 12:51 [PATCH 00/13] tty.h cleanups Greg Kroah-Hartman
2021-04-08 12:51 ` Greg Kroah-Hartman [this message]
2021-04-08 12:51 ` [PATCH 02/13] tty: tty.h: remove tty_info() Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 03/13] tty: remove tty_err() Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 04/13] tty: remove tty_notice() Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 05/13] tty: remove tty_warn() Greg Kroah-Hartman
2021-04-08 13:47   ` Tetsuo Handa
2021-04-08 18:03     ` Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 06/13] tty: remove tty_info_ratelimited() Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 07/13] tty: remove tty_debug() Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 08/13] tty: audit: move some local functions out of tty.h Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 09/13] tty: move some internal tty lock enums and " Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 10/13] tty: make tty_release_redirect() static Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 11/13] tty: move some tty-only functions to drivers/tty/tty.h Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 12/13] tty: remove tty_driver_name() Greg Kroah-Hartman
2021-04-08 12:51 ` [PATCH 13/13] tty: clean include/linux/tty.h up Greg Kroah-Hartman
2021-04-08 17:51   ` Greg Kroah-Hartman
2021-04-08 14:25 ` [PATCH 00/13] tty.h cleanups Johan Hovold
2021-04-08 18:01   ` Greg Kroah-Hartman
2021-04-09  7:32     ` Johan Hovold
2021-04-15  8:21       ` Greg Kroah-Hartman
2021-04-15 14:14         ` Johan Hovold
2021-04-15 14:53           ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210408125134.3016837-2-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.