Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
8ce73264 ff917ba4

+11 -12
+5 -5
drivers/char/keyboard.c
··· 299 299 */ 300 300 static 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 304 if (tty) { 305 305 tty_insert_flip_char(tty, ch, 0); ··· 309 309 310 310 static 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 314 if (!tty) 315 315 return; ··· 485 485 486 486 static 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 490 if (rep || !tty) 491 491 return; ··· 563 563 564 564 static 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 568 if (!tty) 569 569 return; ··· 1162 1162 struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down }; 1163 1163 int rc; 1164 1164 1165 - tty = vc->vc_tty; 1165 + tty = vc->port.tty; 1166 1166 1167 1167 if (tty && (!tty->driver_data)) { 1168 1168 /* No driver data? Strange. Okay we fix it then. */
+5 -5
drivers/char/vt.c
··· 973 973 * Resize a virtual console as seen from the console end of things. We 974 974 * use the common vc_do_resize methods to update the structures. The 975 975 * caller must hold the console sem to protect console internals and 976 - * vc->vc_tty 976 + * vc->port.tty 977 977 */ 978 978 979 979 int 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 2807 struct vc_data *vc = vc_cons[currcons].d; 2808 2808 2809 2809 /* Still being freed */ 2810 - if (vc->vc_tty) { 2810 + if (vc->port.tty) { 2811 2811 release_console_sem(); 2812 2812 return -ERESTARTSYS; 2813 2813 } 2814 2814 tty->driver_data = vc; 2815 - vc->vc_tty = tty; 2815 + vc->port.tty = tty; 2816 2816 2817 2817 if (!tty->winsize.ws_row && !tty->winsize.ws_col) { 2818 2818 tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; ··· 2840 2840 struct vc_data *vc = tty->driver_data; 2841 2841 BUG_ON(vc == NULL); 2842 2842 acquire_console_sem(); 2843 - vc->vc_tty = NULL; 2843 + vc->port.tty = NULL; 2844 2844 release_console_sem(); 2845 2845 tty_shutdown(tty); 2846 2846 }
+1 -1
drivers/char/vt_ioctl.c
··· 1369 1369 acquire_console_sem(); 1370 1370 vc = vc_con->d; 1371 1371 if (vc) { 1372 - tty = vc->vc_tty; 1372 + tty = vc->port.tty; 1373 1373 /* 1374 1374 * SAK should also work in all raw modes and reset 1375 1375 * them properly.
-1
include/linux/console_struct.h
··· 58 58 /* VT terminal data */ 59 59 unsigned int vc_state; /* Escape sequence parser state */ 60 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 61 /* data for manual vt switching */ 63 62 struct vt_mode vt_mode; 64 63 struct pid *vt_pid;