aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index e18604b3fc7d..d8653ab6f498 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -446,19 +446,8 @@ static inline void legacy_pty_init(void) { }
446int pty_limit = NR_UNIX98_PTY_DEFAULT; 446int pty_limit = NR_UNIX98_PTY_DEFAULT;
447static int pty_limit_min; 447static int pty_limit_min;
448static int pty_limit_max = NR_UNIX98_PTY_MAX; 448static int pty_limit_max = NR_UNIX98_PTY_MAX;
449static int tty_count;
450static int pty_count; 449static int pty_count;
451 450
452static inline void pty_inc_count(void)
453{
454 pty_count = (++tty_count) / 2;
455}
456
457static inline void pty_dec_count(void)
458{
459 pty_count = (--tty_count) / 2;
460}
461
462static struct cdev ptmx_cdev; 451static struct cdev ptmx_cdev;
463 452
464static struct ctl_table pty_table[] = { 453static struct ctl_table pty_table[] = {
@@ -600,8 +589,7 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)
600 */ 589 */
601 tty_driver_kref_get(driver); 590 tty_driver_kref_get(driver);
602 tty->count++; 591 tty->count++;
603 pty_inc_count(); /* tty */ 592 pty_count++;
604 pty_inc_count(); /* tty->link */
605 return 0; 593 return 0;
606err_free_mem: 594err_free_mem:
607 deinitialize_tty_struct(o_tty); 595 deinitialize_tty_struct(o_tty);
@@ -613,15 +601,19 @@ err_free_tty:
613 return -ENOMEM; 601 return -ENOMEM;
614} 602}
615 603
616static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) 604static void ptm_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
605{
606 pty_count--;
607}
608
609static void pts_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
617{ 610{
618 pty_dec_count();
619} 611}
620 612
621static const struct tty_operations ptm_unix98_ops = { 613static const struct tty_operations ptm_unix98_ops = {
622 .lookup = ptm_unix98_lookup, 614 .lookup = ptm_unix98_lookup,
623 .install = pty_unix98_install, 615 .install = pty_unix98_install,
624 .remove = pty_unix98_remove, 616 .remove = ptm_unix98_remove,
625 .open = pty_open, 617 .open = pty_open,
626 .close = pty_close, 618 .close = pty_close,
627 .write = pty_write, 619 .write = pty_write,
@@ -638,7 +630,7 @@ static const struct tty_operations ptm_unix98_ops = {
638static const struct tty_operations pty_unix98_ops = { 630static const struct tty_operations pty_unix98_ops = {
639 .lookup = pts_unix98_lookup, 631 .lookup = pts_unix98_lookup,
640 .install = pty_unix98_install, 632 .install = pty_unix98_install,
641 .remove = pty_unix98_remove, 633 .remove = pts_unix98_remove,
642 .open = pty_open, 634 .open = pty_open,
643 .close = pty_close, 635 .close = pty_close,
644 .write = pty_write, 636 .write = pty_write,