Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305426

[PATCH v2 14/19] tty: Move tty_ldisc_kill()

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject [PATCH v2 14/19] tty: Move tty_ldisc_kill()
Date 2016-01-10 05:50 +0100
Message-ID <qPg70-7Hn-29@gated-at.bofh.it> (permalink)
References <qzyUh-8cQ-9@gated-at.bofh.it> <qPg6Z-7Hn-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In preparation for destroying the line discipline instance on hangup,
move tty_ldisc_kill() to eliminate needless forward declarations.
No functional change.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/tty_ldisc.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 5115230..d91122d 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -603,6 +603,25 @@ err:
 }
 
 /**
+ *	tty_ldisc_kill	-	teardown ldisc
+ *	@tty: tty being released
+ *
+ *	Perform final close of the ldisc and reset tty->ldisc
+ */
+static void tty_ldisc_kill(struct tty_struct *tty)
+{
+	if (!tty->ldisc)
+		return;
+	/*
+	 * Now kill off the ldisc
+	 */
+	tty_ldisc_close(tty, tty->ldisc);
+	tty_ldisc_put(tty->ldisc);
+	/* Force an oops if we mess this up */
+	tty->ldisc = NULL;
+}
+
+/**
  *	tty_reset_termios	-	reset terminal state
  *	@tty: tty to reset
  *
@@ -749,19 +768,6 @@ int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty)
 	return 0;
 }
 
-static void tty_ldisc_kill(struct tty_struct *tty)
-{
-	if (!tty->ldisc)
-		return;
-	/*
-	 * Now kill off the ldisc
-	 */
-	tty_ldisc_close(tty, tty->ldisc);
-	tty_ldisc_put(tty->ldisc);
-	/* Force an oops if we mess this up */
-	tty->ldisc = NULL;
-}
-
 /**
  *	tty_ldisc_release		-	release line discipline
  *	@tty: tty being shut down (or one end of pty pair)
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/19] Fix driver crashes on hangup Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 05/19] tty: Remove chars_in_buffer() line discipline method Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 14/19] tty: Move tty_ldisc_kill() Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 01/19] staging: digi: Replace open-coded tty_wakeup() Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 12/19] tty: Prepare for destroying line discipline on hangup Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 08/19] tty: Reset c_line from driver's init_termios Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 02/19] serial: 68328: Remove bogus ldisc reset Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 16/19] tty: Refactor tty_ldisc_reinit() for reuse Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v2 03/19] bluetooth: hci_ldisc: Remove dead code Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  [PATCH v3 19/19] tty: Avoid unnecessary temporaries for tty->ldisc Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 17/19] tty: Destroy ldisc instance on hangup Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 08/19] tty: Reset c_line from driver's init_termios Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 06/19] tty: Fix unsafe ldisc reference via ioctl(TIOCGETD) Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 04/19] NFC: nci: Remove dead code Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 15/19] tty: Use 'disc' for line discipline index name Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 01/19] staging: digi: Replace open-coded tty_wakeup() Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 14/19] tty: Move tty_ldisc_kill() Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 05/19] tty: Remove chars_in_buffer() line discipline method Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 02/19] serial: 68328: Remove bogus ldisc reset Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
    Re: [PATCH v3 02/19] serial: 68328: Remove bogus ldisc reset One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-01-11 15:20 +0100
  [PATCH v3 13/19] tty: Handle NULL tty->ldisc Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 12/19] tty: Prepare for destroying line discipline on hangup Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 03/19] bluetooth: hci_ldisc: Remove dead code Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 10/19] tty: Fix comments for tty_ldisc_get() Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 07/19] n_tty: Fix unsafe reference to "other" ldisc Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 11/19] tty: Fix comments for tty_ldisc_release() Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 09/19] staging/speakup: Use tty_ldisc_ref() for paste kworker Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 18/19] tty: Document c_line == N_TTY initial condition Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 16/19] tty: Refactor tty_ldisc_reinit() for reuse Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100
  [PATCH v3 00/19] Fix driver crashes on hangup Peter Hurley <peter@hurleysoftware.com> - 2016-01-11 07:50 +0100

csiph-web