aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/pty.c31
-rw-r--r--include/linux/tty_driver.h4
2 files changed, 24 insertions, 11 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d9ea9e2c9ec..f5a27c66ff6 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
674static void __init unix98_pty_init(void) 677static 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
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 3adc362f0bd..1a85f003d64 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -391,6 +391,9 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
391 * the requested timeout to the caller instead of using a simple 391 * the requested timeout to the caller instead of using a simple
392 * on/off interface. 392 * on/off interface.
393 * 393 *
394 * TTY_DRIVER_DYNAMIC_ALLOC -- do not allocate structures which are
395 * needed per line for this driver as it would waste memory.
396 * The driver will take care.
394 */ 397 */
395#define TTY_DRIVER_INSTALLED 0x0001 398#define TTY_DRIVER_INSTALLED 0x0001
396#define TTY_DRIVER_RESET_TERMIOS 0x0002 399#define TTY_DRIVER_RESET_TERMIOS 0x0002
@@ -398,6 +401,7 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
398#define TTY_DRIVER_DYNAMIC_DEV 0x0008 401#define TTY_DRIVER_DYNAMIC_DEV 0x0008
399#define TTY_DRIVER_DEVPTS_MEM 0x0010 402#define TTY_DRIVER_DEVPTS_MEM 0x0010
400#define TTY_DRIVER_HARDWARE_BREAK 0x0020 403#define TTY_DRIVER_HARDWARE_BREAK 0x0020
404#define TTY_DRIVER_DYNAMIC_ALLOC 0x0040
401 405
402/* tty driver types */ 406/* tty driver types */
403#define TTY_DRIVER_TYPE_SYSTEM 0x0001 407#define TTY_DRIVER_TYPE_SYSTEM 0x0001