public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org,
	Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 2/6] tty: Eliminate global symbol tty_ldisc_N_TTY
Date: Fri, 27 Nov 2015 21:38:33 -0500	[thread overview]
Message-ID: <1448678317-9093-3-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1448678317-9093-1-git-send-email-peter@hurleysoftware.com>

Reduce global tty symbols; move and rename tty_ldisc_begin() as
n_tty_init() and redefine the N_TTY ldisc ops as file scope.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/n_tty.c     | 12 ++++++++----
 drivers/tty/tty_io.c    |  2 +-
 drivers/tty/tty_ldisc.c |  6 ------
 include/linux/tty.h     |  3 +--
 4 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 4f2b5dc..d294e24 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2499,7 +2499,7 @@ static void n_tty_closing(struct tty_struct *tty)
 	ldata->closing = 1;
 }
 
-struct tty_ldisc_ops tty_ldisc_N_TTY = {
+static struct tty_ldisc_ops n_tty_ops = {
 	.magic           = TTY_LDISC_MAGIC,
 	.name            = "n_tty",
 	.open            = n_tty_open,
@@ -2521,14 +2521,18 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = {
  *	n_tty_inherit_ops	-	inherit N_TTY methods
  *	@ops: struct tty_ldisc_ops where to save N_TTY methods
  *
- *	Enables a 'subclass' line discipline to 'inherit' N_TTY
- *	methods.
+ *	Enables a 'subclass' line discipline to 'inherit' N_TTY methods.
  */
 
 void n_tty_inherit_ops(struct tty_ldisc_ops *ops)
 {
-	*ops = tty_ldisc_N_TTY;
+	*ops = n_tty_ops;
 	ops->owner = NULL;
 	ops->refcount = ops->flags = 0;
 }
 EXPORT_SYMBOL_GPL(n_tty_inherit_ops);
+
+void __init n_tty_init(void)
+{
+	tty_register_ldisc(N_TTY, &n_tty_ops);
+}
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 64c4a7e..0778fa9 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3566,7 +3566,7 @@ void __init console_init(void)
 	initcall_t *call;
 
 	/* Setup the default TTY line discipline. */
-	tty_ldisc_begin();
+	n_tty_init();
 
 	/*
 	 * set up the console device so that later boot sequences can
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 8a960fd..5734c22 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -840,9 +840,3 @@ void tty_ldisc_deinit(struct tty_struct *tty)
 		tty_ldisc_put(tty->ldisc);
 	tty->ldisc = NULL;
 }
-
-void tty_ldisc_begin(void)
-{
-	/* Setup the default TTY line discipline. */
-	(void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY);
-}
diff --git a/include/linux/tty.h b/include/linux/tty.h
index cc15147..9e3231e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -577,7 +577,6 @@ extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
 extern void tty_ldisc_release(struct tty_struct *tty);
 extern void tty_ldisc_init(struct tty_struct *tty);
 extern void tty_ldisc_deinit(struct tty_struct *tty);
-extern void tty_ldisc_begin(void);
 
 static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
 					char *f, int count)
@@ -594,8 +593,8 @@ static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
 
 
 /* n_tty.c */
-extern struct tty_ldisc_ops tty_ldisc_N_TTY;
 extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
+extern void __init n_tty_init(void);
 
 /* tty_audit.c */
 #ifdef CONFIG_AUDIT
-- 
2.6.3


  parent reply	other threads:[~2015-11-28  2:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-28  2:38 [PATCH 0/6] Peter Hurley
2015-11-28  2:38 ` [PATCH 1/6] tty: Unexport system-wide tty_mutex Peter Hurley
2015-11-28  2:38 ` Peter Hurley [this message]
2015-11-28  2:38 ` [PATCH 3/6] tty: Remove declarations to non-existent functions Peter Hurley
2015-11-28  2:38 ` [PATCH 4/6] tty: Move tty_check_change() helper Peter Hurley
2015-11-28  2:38 ` [PATCH 5/6] tty: Remove unreferenced tty flags macro TTY_DEBUG Peter Hurley
2015-11-28  2:38 ` [PATCH 6/6] tty: Make tty_files_lock per-tty Peter Hurley
2016-01-10  5:35 ` [PATCH v2 0/6] tty globals cleanup (cont'd) Peter Hurley
2016-01-10  5:35   ` [PATCH v2 1/6] tty: Unexport system-wide tty_mutex Peter Hurley
2016-01-10  5:35   ` [PATCH v2 2/6] tty: Eliminate global symbol tty_ldisc_N_TTY Peter Hurley
2016-01-10  5:35   ` [PATCH v2 3/6] tty: Remove declarations to non-existent functions Peter Hurley
2016-01-10  5:35   ` [PATCH v2 4/6] tty: Move tty_check_change() helper Peter Hurley
2016-01-10  5:35   ` [PATCH v2 5/6] tty: Remove unreferenced tty flags macro TTY_DEBUG Peter Hurley
2016-01-10  5:35   ` [PATCH v2 6/6] tty: Make tty_files_lock per-tty Peter Hurley

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=1448678317-9093-3-git-send-email-peter@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox