diff options
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 26 |
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) { } | |||
446 | int pty_limit = NR_UNIX98_PTY_DEFAULT; | 446 | int pty_limit = NR_UNIX98_PTY_DEFAULT; |
447 | static int pty_limit_min; | 447 | static int pty_limit_min; |
448 | static int pty_limit_max = NR_UNIX98_PTY_MAX; | 448 | static int pty_limit_max = NR_UNIX98_PTY_MAX; |
449 | static int tty_count; | ||
450 | static int pty_count; | 449 | static int pty_count; |
451 | 450 | ||
452 | static inline void pty_inc_count(void) | ||
453 | { | ||
454 | pty_count = (++tty_count) / 2; | ||
455 | } | ||
456 | |||
457 | static inline void pty_dec_count(void) | ||
458 | { | ||
459 | pty_count = (--tty_count) / 2; | ||
460 | } | ||
461 | |||
462 | static struct cdev ptmx_cdev; | 451 | static struct cdev ptmx_cdev; |
463 | 452 | ||
464 | static struct ctl_table pty_table[] = { | 453 | static 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; |
606 | err_free_mem: | 594 | err_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 | ||
616 | static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) | 604 | static void ptm_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) |
605 | { | ||
606 | pty_count--; | ||
607 | } | ||
608 | |||
609 | static void pts_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) | ||
617 | { | 610 | { |
618 | pty_dec_count(); | ||
619 | } | 611 | } |
620 | 612 | ||
621 | static const struct tty_operations ptm_unix98_ops = { | 613 | static 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 = { | |||
638 | static const struct tty_operations pty_unix98_ops = { | 630 | static 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, |