Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364270
b: refs/heads/master
c: f480704
h: refs/heads/master
v: v3
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Mar 18, 2013
1 parent 9709620 commit 63655b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16759f6cd8c590fa23cb2956fdf32fe23a67e482
refs/heads/master: f48070457c728a1ff8f327240e70483cebabf83b
31 changes: 6 additions & 25 deletions trunk/drivers/tty/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,24 +227,6 @@ const struct file_operations tty_ldiscs_proc_fops = {
.release = seq_release,
};

/**
* tty_ldisc_assign - set ldisc on a tty
* @tty: tty to assign
* @ld: line discipline
*
* Install an instance of a line discipline into a tty structure. The
* ldisc must have a reference count above zero to ensure it remains.
* The tty instance refcount starts at zero.
*
* Locking:
* Caller must hold references
*/

static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld)
{
tty->ldisc = ld;
}

/**
* tty_ldisc_try - internal helper
* @tty: the tty
Expand Down Expand Up @@ -488,15 +470,15 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
/* There is an outstanding reference here so this is safe */
old = tty_ldisc_get(old->ops->num);
WARN_ON(IS_ERR(old));
tty_ldisc_assign(tty, old);
tty->ldisc = old;
tty_set_termios_ldisc(tty, old->ops->num);
if (tty_ldisc_open(tty, old) < 0) {
tty_ldisc_put(old);
/* This driver is always present */
new_ldisc = tty_ldisc_get(N_TTY);
if (IS_ERR(new_ldisc))
panic("n_tty: get");
tty_ldisc_assign(tty, new_ldisc);
tty->ldisc = new_ldisc;
tty_set_termios_ldisc(tty, N_TTY);
r = tty_ldisc_open(tty, new_ldisc);
if (r < 0)
Expand Down Expand Up @@ -725,7 +707,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
tty_ldisc_close(tty, o_ldisc);

/* Now set up the new line discipline. */
tty_ldisc_assign(tty, new_ldisc);
tty->ldisc = new_ldisc;
tty_set_termios_ldisc(tty, ldisc);

retval = tty_ldisc_open(tty, new_ldisc);
Expand Down Expand Up @@ -799,11 +781,10 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)

tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc);
tty->ldisc = NULL;
/*
* Switch the line discipline back
*/
tty_ldisc_assign(tty, ld);
tty->ldisc = ld;
tty_set_termios_ldisc(tty, ldisc);

return 0;
Expand Down Expand Up @@ -986,7 +967,7 @@ void tty_ldisc_init(struct tty_struct *tty)
struct tty_ldisc *ld = tty_ldisc_get(N_TTY);
if (IS_ERR(ld))
panic("n_tty: init_tty");
tty_ldisc_assign(tty, ld);
tty->ldisc = ld;
}

/**
Expand All @@ -999,7 +980,7 @@ void tty_ldisc_init(struct tty_struct *tty)
void tty_ldisc_deinit(struct tty_struct *tty)
{
tty_ldisc_put(tty->ldisc);
tty_ldisc_assign(tty, NULL);
tty->ldisc = NULL;
}

void tty_ldisc_begin(void)
Expand Down

0 comments on commit 63655b3

Please sign in to comment.