aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-06-01 16:52:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 16:47:42 -0400
commit8ce73264b75be4d5ed480440ac32dfc1f25ff678 (patch)
treed604eda549bee636d8132994496ba2f1406fb8f1
parentff917ba4f1a6189f90ed2c975984d6a1a1dc553d (diff)
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: Alan Cox <alan@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/char/keyboard.c10
-rw-r--r--drivers/char/vt.c10
-rw-r--r--drivers/char/vt_ioctl.c2
-rw-r--r--include/linux/console_struct.h1
4 files changed, 11 insertions, 12 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 25be2102a60a..a7ca75212bfe 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -299,7 +299,7 @@ int kbd_rate(struct kbd_repeat *rep)
299 */ 299 */
300static void put_queue(struct vc_data *vc, int ch) 300static void put_queue(struct vc_data *vc, int ch)
301{ 301{
302 struct tty_struct *tty = vc->vc_tty; 302 struct tty_struct *tty = vc->port.tty;
303 303
304 if (tty) { 304 if (tty) {
305 tty_insert_flip_char(tty, ch, 0); 305 tty_insert_flip_char(tty, ch, 0);
@@ -309,7 +309,7 @@ static void put_queue(struct vc_data *vc, int ch)
309 309
310static void puts_queue(struct vc_data *vc, char *cp) 310static void puts_queue(struct vc_data *vc, char *cp)
311{ 311{
312 struct tty_struct *tty = vc->vc_tty; 312 struct tty_struct *tty = vc->port.tty;
313 313
314 if (!tty) 314 if (!tty)
315 return; 315 return;
@@ -485,7 +485,7 @@ static void fn_show_ptregs(struct vc_data *vc)
485 485
486static void fn_hold(struct vc_data *vc) 486static void fn_hold(struct vc_data *vc)
487{ 487{
488 struct tty_struct *tty = vc->vc_tty; 488 struct tty_struct *tty = vc->port.tty;
489 489
490 if (rep || !tty) 490 if (rep || !tty)
491 return; 491 return;
@@ -563,7 +563,7 @@ static void fn_inc_console(struct vc_data *vc)
563 563
564static void fn_send_intr(struct vc_data *vc) 564static void fn_send_intr(struct vc_data *vc)
565{ 565{
566 struct tty_struct *tty = vc->vc_tty; 566 struct tty_struct *tty = vc->port.tty;
567 567
568 if (!tty) 568 if (!tty)
569 return; 569 return;
@@ -1162,7 +1162,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1162 struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down }; 1162 struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down };
1163 int rc; 1163 int rc;
1164 1164
1165 tty = vc->vc_tty; 1165 tty = vc->port.tty;
1166 1166
1167 if (tty && (!tty->driver_data)) { 1167 if (tty && (!tty->driver_data)) {
1168 /* No driver data? Strange. Okay we fix it then. */ 1168 /* No driver data? Strange. Okay we fix it then. */
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 295af823a074..c734f9b1263a 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -973,12 +973,12 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
973 * Resize a virtual console as seen from the console end of things. We 973 * Resize a virtual console as seen from the console end of things. We
974 * use the common vc_do_resize methods to update the structures. The 974 * use the common vc_do_resize methods to update the structures. The
975 * caller must hold the console sem to protect console internals and 975 * caller must hold the console sem to protect console internals and
976 * vc->vc_tty 976 * vc->port.tty
977 */ 977 */
978 978
979int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) 979int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows)
980{ 980{
981 return vc_do_resize(vc->vc_tty, vc, cols, rows); 981 return vc_do_resize(vc->port.tty, vc, cols, rows);
982} 982}
983 983
984/** 984/**
@@ -2807,12 +2807,12 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2807 struct vc_data *vc = vc_cons[currcons].d; 2807 struct vc_data *vc = vc_cons[currcons].d;
2808 2808
2809 /* Still being freed */ 2809 /* Still being freed */
2810 if (vc->vc_tty) { 2810 if (vc->port.tty) {
2811 release_console_sem(); 2811 release_console_sem();
2812 return -ERESTARTSYS; 2812 return -ERESTARTSYS;
2813 } 2813 }
2814 tty->driver_data = vc; 2814 tty->driver_data = vc;
2815 vc->vc_tty = tty; 2815 vc->port.tty = tty;
2816 2816
2817 if (!tty->winsize.ws_row && !tty->winsize.ws_col) { 2817 if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
2818 tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; 2818 tty->winsize.ws_row = vc_cons[currcons].d->vc_rows;
@@ -2840,7 +2840,7 @@ static void con_shutdown(struct tty_struct *tty)
2840 struct vc_data *vc = tty->driver_data; 2840 struct vc_data *vc = tty->driver_data;
2841 BUG_ON(vc == NULL); 2841 BUG_ON(vc == NULL);
2842 acquire_console_sem(); 2842 acquire_console_sem();
2843 vc->vc_tty = NULL; 2843 vc->port.tty = NULL;
2844 release_console_sem(); 2844 release_console_sem();
2845 tty_shutdown(tty); 2845 tty_shutdown(tty);
2846} 2846}
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index cb19dbc52136..72dcfb2dc126 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -1369,7 +1369,7 @@ void vc_SAK(struct work_struct *work)
1369 acquire_console_sem(); 1369 acquire_console_sem();
1370 vc = vc_con->d; 1370 vc = vc_con->d;
1371 if (vc) { 1371 if (vc) {
1372 tty = vc->vc_tty; 1372 tty = vc->port.tty;
1373 /* 1373 /*
1374 * SAK should also work in all raw modes and reset 1374 * SAK should also work in all raw modes and reset
1375 * them properly. 1375 * them properly.
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 25bf67f541fc..7f0c32908568 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -58,7 +58,6 @@ struct vc_data {
58 /* VT terminal data */ 58 /* VT terminal data */
59 unsigned int vc_state; /* Escape sequence parser state */ 59 unsigned int vc_state; /* Escape sequence parser state */
60 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 60 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
61 struct tty_struct *vc_tty; /* TTY we are attached to */
62 /* data for manual vt switching */ 61 /* data for manual vt switching */
63 struct vt_mode vt_mode; 62 struct vt_mode vt_mode;
64 struct pid *vt_pid; 63 struct pid *vt_pid;