diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-08-08 16:26:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-13 19:45:38 -0400 |
commit | 21aca2fa00259f781d228496631b61dbb4274e90 (patch) | |
tree | 825e2b2ce47f55c27948112e89238c2a2a831f48 /drivers/tty/pty.c | |
parent | 7f0bc6a68ed93f3b4ad77b94df5ef32446c583e3 (diff) |
TTY: pty, switch to tty_alloc_driver
Switch to the new driver allocation interface, as this is one of the
special call-sites. Here, we need TTY_DRIVER_DYNAMIC_ALLOC to not
allocate tty_driver->ports, cdevs and potentially other structures
because we reserve too many lines in pty. Instead, it provides the
tty_port<->tty_struct link in tty->ops->install already.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index d9ea9e2c9ec5..f5a27c66ff60 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -444,11 +444,17 @@ static void __init legacy_pty_init(void) | |||
444 | if (legacy_count <= 0) | 444 | if (legacy_count <= 0) |
445 | return; | 445 | return; |
446 | 446 | ||
447 | pty_driver = alloc_tty_driver(legacy_count); | 447 | pty_driver = tty_alloc_driver(legacy_count, |
448 | TTY_DRIVER_RESET_TERMIOS | | ||
449 | TTY_DRIVER_REAL_RAW | | ||
450 | TTY_DRIVER_DYNAMIC_ALLOC); | ||
448 | if (!pty_driver) | 451 | if (!pty_driver) |
449 | panic("Couldn't allocate pty driver"); | 452 | panic("Couldn't allocate pty driver"); |
450 | 453 | ||
451 | pty_slave_driver = alloc_tty_driver(legacy_count); | 454 | pty_slave_driver = tty_alloc_driver(legacy_count, |
455 | TTY_DRIVER_RESET_TERMIOS | | ||
456 | TTY_DRIVER_REAL_RAW | | ||
457 | TTY_DRIVER_DYNAMIC_ALLOC); | ||
452 | if (!pty_slave_driver) | 458 | if (!pty_slave_driver) |
453 | panic("Couldn't allocate pty slave driver"); | 459 | panic("Couldn't allocate pty slave driver"); |
454 | 460 | ||
@@ -465,7 +471,6 @@ static void __init legacy_pty_init(void) | |||
465 | pty_driver->init_termios.c_lflag = 0; | 471 | pty_driver->init_termios.c_lflag = 0; |
466 | pty_driver->init_termios.c_ispeed = 38400; | 472 | pty_driver->init_termios.c_ispeed = 38400; |
467 | pty_driver->init_termios.c_ospeed = 38400; | 473 | pty_driver->init_termios.c_ospeed = 38400; |
468 | pty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW; | ||
469 | pty_driver->other = pty_slave_driver; | 474 | pty_driver->other = pty_slave_driver; |
470 | tty_set_operations(pty_driver, &master_pty_ops_bsd); | 475 | tty_set_operations(pty_driver, &master_pty_ops_bsd); |
471 | 476 | ||
@@ -479,8 +484,6 @@ static void __init legacy_pty_init(void) | |||
479 | pty_slave_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; | 484 | pty_slave_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; |
480 | pty_slave_driver->init_termios.c_ispeed = 38400; | 485 | pty_slave_driver->init_termios.c_ispeed = 38400; |
481 | pty_slave_driver->init_termios.c_ospeed = 38400; | 486 | pty_slave_driver->init_termios.c_ospeed = 38400; |
482 | pty_slave_driver->flags = TTY_DRIVER_RESET_TERMIOS | | ||
483 | TTY_DRIVER_REAL_RAW; | ||
484 | pty_slave_driver->other = pty_driver; | 487 | pty_slave_driver->other = pty_driver; |
485 | tty_set_operations(pty_slave_driver, &slave_pty_ops_bsd); | 488 | tty_set_operations(pty_slave_driver, &slave_pty_ops_bsd); |
486 | 489 | ||
@@ -673,10 +676,20 @@ static struct file_operations ptmx_fops; | |||
673 | 676 | ||
674 | static void __init unix98_pty_init(void) | 677 | static void __init unix98_pty_init(void) |
675 | { | 678 | { |
676 | ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); | 679 | ptm_driver = tty_alloc_driver(NR_UNIX98_PTY_MAX, |
680 | TTY_DRIVER_RESET_TERMIOS | | ||
681 | TTY_DRIVER_REAL_RAW | | ||
682 | TTY_DRIVER_DYNAMIC_DEV | | ||
683 | TTY_DRIVER_DEVPTS_MEM | | ||
684 | TTY_DRIVER_DYNAMIC_ALLOC); | ||
677 | if (!ptm_driver) | 685 | if (!ptm_driver) |
678 | panic("Couldn't allocate Unix98 ptm driver"); | 686 | panic("Couldn't allocate Unix98 ptm driver"); |
679 | pts_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); | 687 | pts_driver = tty_alloc_driver(NR_UNIX98_PTY_MAX, |
688 | TTY_DRIVER_RESET_TERMIOS | | ||
689 | TTY_DRIVER_REAL_RAW | | ||
690 | TTY_DRIVER_DYNAMIC_DEV | | ||
691 | TTY_DRIVER_DEVPTS_MEM | | ||
692 | TTY_DRIVER_DYNAMIC_ALLOC); | ||
680 | if (!pts_driver) | 693 | if (!pts_driver) |
681 | panic("Couldn't allocate Unix98 pts driver"); | 694 | panic("Couldn't allocate Unix98 pts driver"); |
682 | 695 | ||
@@ -693,8 +706,6 @@ static void __init unix98_pty_init(void) | |||
693 | ptm_driver->init_termios.c_lflag = 0; | 706 | ptm_driver->init_termios.c_lflag = 0; |
694 | ptm_driver->init_termios.c_ispeed = 38400; | 707 | ptm_driver->init_termios.c_ispeed = 38400; |
695 | ptm_driver->init_termios.c_ospeed = 38400; | 708 | ptm_driver->init_termios.c_ospeed = 38400; |
696 | ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | | ||
697 | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; | ||
698 | ptm_driver->other = pts_driver; | 709 | ptm_driver->other = pts_driver; |
699 | tty_set_operations(ptm_driver, &ptm_unix98_ops); | 710 | tty_set_operations(ptm_driver, &ptm_unix98_ops); |
700 | 711 | ||
@@ -708,8 +719,6 @@ static void __init unix98_pty_init(void) | |||
708 | pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; | 719 | pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; |
709 | pts_driver->init_termios.c_ispeed = 38400; | 720 | pts_driver->init_termios.c_ispeed = 38400; |
710 | pts_driver->init_termios.c_ospeed = 38400; | 721 | pts_driver->init_termios.c_ospeed = 38400; |
711 | pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | | ||
712 | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; | ||
713 | pts_driver->other = ptm_driver; | 722 | pts_driver->other = ptm_driver; |
714 | tty_set_operations(pts_driver, &pty_unix98_ops); | 723 | tty_set_operations(pts_driver, &pty_unix98_ops); |
715 | 724 | ||