diff options
author | David S. Miller <davem@davemloft.net> | 2011-09-16 05:09:02 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-16 05:09:02 (GMT) |
commit | 52b9aca7ae8726d1fb41b97dd1d243d107fef11b (patch) | |
tree | 7acee111840bd25183513e9bde08e939ffd57be8 /drivers/tty/pty.c | |
parent | 7756332f5b64c9c1535712b9679792e8bd4f0019 (diff) | |
parent | e2faeec2de9e2c73958e6ea6065dde1e8cd6f3a2 (diff) | |
download | linux-fsl-qoriq-52b9aca7ae8726d1fb41b97dd1d243d107fef11b.tar.xz |
Merge branch 'master' of ../netdev/
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r-- | drivers/tty/pty.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 98b6e3b..e809e9d 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -446,8 +446,19 @@ static inline void legacy_pty_init(void) { } int pty_limit = NR_UNIX98_PTY_DEFAULT; static int pty_limit_min; static int pty_limit_max = NR_UNIX98_PTY_MAX; +static int tty_count; static int pty_count; +static inline void pty_inc_count(void) +{ + pty_count = (++tty_count) / 2; +} + +static inline void pty_dec_count(void) +{ + pty_count = (--tty_count) / 2; +} + static struct cdev ptmx_cdev; static struct ctl_table pty_table[] = { @@ -542,6 +553,7 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, static void pty_unix98_shutdown(struct tty_struct *tty) { + tty_driver_remove_tty(tty->driver, tty); /* We have our own method as we don't use the tty index */ kfree(tty->termios); } @@ -588,7 +600,8 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) */ tty_driver_kref_get(driver); tty->count++; - pty_count++; + pty_inc_count(); /* tty */ + pty_inc_count(); /* tty->link */ return 0; err_free_mem: deinitialize_tty_struct(o_tty); @@ -602,7 +615,7 @@ err_free_tty: static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) { - pty_count--; + pty_dec_count(); } static const struct tty_operations ptm_unix98_ops = { |