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

tty: move tioclinux from a special case

Right now we have ifdefs and hooks in the core ioctl handler for TIOCLINUX
and then test if its a console. This is brain dead. Instead call the
tioclinux helper from the relevant driver ioctl methods.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
e6885107 b70ac771

+2 -6
-4
drivers/char/tty_io.c
··· 3026 3026 return put_user(tty->ldisc.ops->num, (int __user *)p); 3027 3027 case TIOCSETD: 3028 3028 return tiocsetd(tty, p); 3029 - #ifdef CONFIG_VT 3030 - case TIOCLINUX: 3031 - return tioclinux(tty, arg); 3032 - #endif 3033 3029 /* 3034 3030 * Break handling 3035 3031 */
-2
drivers/char/vt.c
··· 2583 2583 int lines; 2584 2584 int ret; 2585 2585 2586 - if (tty->driver->type != TTY_DRIVER_TYPE_CONSOLE) 2587 - return -EINVAL; 2588 2586 if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN)) 2589 2587 return -EPERM; 2590 2588 if (get_user(type, p))
+2
drivers/char/vt_ioctl.c
··· 395 395 396 396 kbd = kbd_table + console; 397 397 switch (cmd) { 398 + case TIOCLINUX: 399 + return tioclinux(tty, arg); 398 400 case KIOCSOUND: 399 401 if (!perm) 400 402 goto eperm;