Commit 226314a1 authored by Peter Hurley's avatar Peter Hurley Committed by Kleber Sacilotto de Souza

tty: Use 'disc' for line discipline index name

BugLink: http://bugs.launchpad.net/bugs/1709126

tty->ldisc is a ptr to struct tty_ldisc, but unfortunately 'ldisc' is
also used as a parameter or local name to refer to the line discipline
index value (ie, N_TTY, N_GSM, etc.); instead prefer the name used
by the line discipline registration/ref counting functions.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c12da96f)
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Acked-by: default avatarMarcelo Cerri <marcelo.cerri@canonical.com>
Acked-by: default avatarBenjamin M Romer <benjamin.romer@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent c27a9718
...@@ -2651,13 +2651,13 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _ ...@@ -2651,13 +2651,13 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _
static int tiocsetd(struct tty_struct *tty, int __user *p) static int tiocsetd(struct tty_struct *tty, int __user *p)
{ {
int ldisc; int disc;
int ret; int ret;
if (get_user(ldisc, p)) if (get_user(disc, p))
return -EFAULT; return -EFAULT;
ret = tty_set_ldisc(tty, ldisc); ret = tty_set_ldisc(tty, disc);
return ret; return ret;
} }
......
...@@ -412,7 +412,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush); ...@@ -412,7 +412,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
/** /**
* tty_set_termios_ldisc - set ldisc field * tty_set_termios_ldisc - set ldisc field
* @tty: tty structure * @tty: tty structure
* @num: line discipline number * @disc: line discipline number
* *
* This is probably overkill for real world processors but * This is probably overkill for real world processors but
* they are not on hot paths so a little discipline won't do * they are not on hot paths so a little discipline won't do
...@@ -425,10 +425,10 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush); ...@@ -425,10 +425,10 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
* Locking: takes termios_rwsem * Locking: takes termios_rwsem
*/ */
static void tty_set_termios_ldisc(struct tty_struct *tty, int num) static void tty_set_termios_ldisc(struct tty_struct *tty, int disc)
{ {
down_write(&tty->termios_rwsem); down_write(&tty->termios_rwsem);
tty->termios.c_line = num; tty->termios.c_line = disc;
up_write(&tty->termios_rwsem); up_write(&tty->termios_rwsem);
tty->disc_data = NULL; tty->disc_data = NULL;
...@@ -526,12 +526,12 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) ...@@ -526,12 +526,12 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
* the close of one side of a tty/pty pair, and eventually hangup. * the close of one side of a tty/pty pair, and eventually hangup.
*/ */
int tty_set_ldisc(struct tty_struct *tty, int ldisc) int tty_set_ldisc(struct tty_struct *tty, int disc)
{ {
int retval; int retval;
struct tty_ldisc *old_ldisc, *new_ldisc; struct tty_ldisc *old_ldisc, *new_ldisc;
new_ldisc = tty_ldisc_get(tty, ldisc); new_ldisc = tty_ldisc_get(tty, disc);
if (IS_ERR(new_ldisc)) if (IS_ERR(new_ldisc))
return PTR_ERR(new_ldisc); return PTR_ERR(new_ldisc);
...@@ -546,7 +546,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) ...@@ -546,7 +546,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
} }
/* Check the no-op case */ /* Check the no-op case */
if (tty->ldisc->ops->num == ldisc) if (tty->ldisc->ops->num == disc)
goto out; goto out;
if (test_bit(TTY_HUPPED, &tty->flags)) { if (test_bit(TTY_HUPPED, &tty->flags)) {
...@@ -562,7 +562,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) ...@@ -562,7 +562,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
/* Now set up the new line discipline. */ /* Now set up the new line discipline. */
tty->ldisc = new_ldisc; tty->ldisc = new_ldisc;
tty_set_termios_ldisc(tty, ldisc); tty_set_termios_ldisc(tty, disc);
retval = tty_ldisc_open(tty, new_ldisc); retval = tty_ldisc_open(tty, new_ldisc);
if (retval < 0) { if (retval < 0) {
...@@ -634,15 +634,15 @@ static void tty_reset_termios(struct tty_struct *tty) ...@@ -634,15 +634,15 @@ static void tty_reset_termios(struct tty_struct *tty)
/** /**
* tty_ldisc_reinit - reinitialise the tty ldisc * tty_ldisc_reinit - reinitialise the tty ldisc
* @tty: tty to reinit * @tty: tty to reinit
* @ldisc: line discipline to reinitialize * @disc: line discipline to reinitialize
* *
* Switch the tty to a line discipline and leave the ldisc * Switch the tty to a line discipline and leave the ldisc
* state closed * state closed
*/ */
static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc) static int tty_ldisc_reinit(struct tty_struct *tty, int disc)
{ {
struct tty_ldisc *ld = tty_ldisc_get(tty, ldisc); struct tty_ldisc *ld = tty_ldisc_get(tty, disc);
if (IS_ERR(ld)) if (IS_ERR(ld))
return -1; return -1;
...@@ -653,7 +653,7 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc) ...@@ -653,7 +653,7 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
* Switch the line discipline back * Switch the line discipline back
*/ */
tty->ldisc = ld; tty->ldisc = ld;
tty_set_termios_ldisc(tty, ldisc); tty_set_termios_ldisc(tty, disc);
return 0; return 0;
} }
......
...@@ -580,7 +580,7 @@ static inline int tty_port_users(struct tty_port *port) ...@@ -580,7 +580,7 @@ static inline int tty_port_users(struct tty_port *port)
extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
extern int tty_unregister_ldisc(int disc); extern int tty_unregister_ldisc(int disc);
extern int tty_set_ldisc(struct tty_struct *tty, int ldisc); extern int tty_set_ldisc(struct tty_struct *tty, int disc);
extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); 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_release(struct tty_struct *tty);
extern void tty_ldisc_init(struct tty_struct *tty); extern void tty_ldisc_init(struct tty_struct *tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment