提交 8ce73264 编写于 作者: A Alan Cox 提交者: Greg Kroah-Hartman

tty: Move the vt_tty field from the vc_data into the standard tty_port

This takes all the tty references through the expected interface points so
we can refcount them.
Signed-off-by: NAlan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 ff917ba4
...@@ -299,7 +299,7 @@ int kbd_rate(struct kbd_repeat *rep) ...@@ -299,7 +299,7 @@ int kbd_rate(struct kbd_repeat *rep)
*/ */
static void put_queue(struct vc_data *vc, int ch) static void put_queue(struct vc_data *vc, int ch)
{ {
struct tty_struct *tty = vc->vc_tty; struct tty_struct *tty = vc->port.tty;
if (tty) { if (tty) {
tty_insert_flip_char(tty, ch, 0); tty_insert_flip_char(tty, ch, 0);
...@@ -309,7 +309,7 @@ static void put_queue(struct vc_data *vc, int ch) ...@@ -309,7 +309,7 @@ static void put_queue(struct vc_data *vc, int ch)
static void puts_queue(struct vc_data *vc, char *cp) static void puts_queue(struct vc_data *vc, char *cp)
{ {
struct tty_struct *tty = vc->vc_tty; struct tty_struct *tty = vc->port.tty;
if (!tty) if (!tty)
return; return;
...@@ -485,7 +485,7 @@ static void fn_show_ptregs(struct vc_data *vc) ...@@ -485,7 +485,7 @@ static void fn_show_ptregs(struct vc_data *vc)
static void fn_hold(struct vc_data *vc) static void fn_hold(struct vc_data *vc)
{ {
struct tty_struct *tty = vc->vc_tty; struct tty_struct *tty = vc->port.tty;
if (rep || !tty) if (rep || !tty)
return; return;
...@@ -563,7 +563,7 @@ static void fn_inc_console(struct vc_data *vc) ...@@ -563,7 +563,7 @@ static void fn_inc_console(struct vc_data *vc)
static void fn_send_intr(struct vc_data *vc) static void fn_send_intr(struct vc_data *vc)
{ {
struct tty_struct *tty = vc->vc_tty; struct tty_struct *tty = vc->port.tty;
if (!tty) if (!tty)
return; return;
...@@ -1162,7 +1162,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) ...@@ -1162,7 +1162,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down }; struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down };
int rc; int rc;
tty = vc->vc_tty; tty = vc->port.tty;
if (tty && (!tty->driver_data)) { if (tty && (!tty->driver_data)) {
/* No driver data? Strange. Okay we fix it then. */ /* No driver data? Strange. Okay we fix it then. */
......
...@@ -973,12 +973,12 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, ...@@ -973,12 +973,12 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
* Resize a virtual console as seen from the console end of things. We * Resize a virtual console as seen from the console end of things. We
* use the common vc_do_resize methods to update the structures. The * use the common vc_do_resize methods to update the structures. The
* caller must hold the console sem to protect console internals and * caller must hold the console sem to protect console internals and
* vc->vc_tty * vc->port.tty
*/ */
int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows)
{ {
return vc_do_resize(vc->vc_tty, vc, cols, rows); return vc_do_resize(vc->port.tty, vc, cols, rows);
} }
/** /**
...@@ -2807,12 +2807,12 @@ static int con_open(struct tty_struct *tty, struct file *filp) ...@@ -2807,12 +2807,12 @@ static int con_open(struct tty_struct *tty, struct file *filp)
struct vc_data *vc = vc_cons[currcons].d; struct vc_data *vc = vc_cons[currcons].d;
/* Still being freed */ /* Still being freed */
if (vc->vc_tty) { if (vc->port.tty) {
release_console_sem(); release_console_sem();
return -ERESTARTSYS; return -ERESTARTSYS;
} }
tty->driver_data = vc; tty->driver_data = vc;
vc->vc_tty = tty; vc->port.tty = tty;
if (!tty->winsize.ws_row && !tty->winsize.ws_col) { if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; tty->winsize.ws_row = vc_cons[currcons].d->vc_rows;
...@@ -2840,7 +2840,7 @@ static void con_shutdown(struct tty_struct *tty) ...@@ -2840,7 +2840,7 @@ static void con_shutdown(struct tty_struct *tty)
struct vc_data *vc = tty->driver_data; struct vc_data *vc = tty->driver_data;
BUG_ON(vc == NULL); BUG_ON(vc == NULL);
acquire_console_sem(); acquire_console_sem();
vc->vc_tty = NULL; vc->port.tty = NULL;
release_console_sem(); release_console_sem();
tty_shutdown(tty); tty_shutdown(tty);
} }
......
...@@ -1369,7 +1369,7 @@ void vc_SAK(struct work_struct *work) ...@@ -1369,7 +1369,7 @@ void vc_SAK(struct work_struct *work)
acquire_console_sem(); acquire_console_sem();
vc = vc_con->d; vc = vc_con->d;
if (vc) { if (vc) {
tty = vc->vc_tty; tty = vc->port.tty;
/* /*
* SAK should also work in all raw modes and reset * SAK should also work in all raw modes and reset
* them properly. * them properly.
......
...@@ -58,7 +58,6 @@ struct vc_data { ...@@ -58,7 +58,6 @@ struct vc_data {
/* VT terminal data */ /* VT terminal data */
unsigned int vc_state; /* Escape sequence parser state */ unsigned int vc_state; /* Escape sequence parser state */
unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
struct tty_struct *vc_tty; /* TTY we are attached to */
/* data for manual vt switching */ /* data for manual vt switching */
struct vt_mode vt_mode; struct vt_mode vt_mode;
struct pid *vt_pid; struct pid *vt_pid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册