tty: Replace ldisc locking with ldisc_sem
[linux-2.6-block.git] / drivers / tty / tty_io.c
index fa80af3656a3b8f1d5ba6041ccd380e8479de4b8..0fa5db4c7a7a9614d055457649f9add9493d95b3 100644 (file)
@@ -1388,8 +1388,7 @@ static int tty_reopen(struct tty_struct *tty)
        struct tty_driver *driver = tty->driver;
 
        if (test_bit(TTY_CLOSING, &tty->flags) ||
-                       test_bit(TTY_HUPPING, &tty->flags) ||
-                       test_bit(TTY_LDISC_CHANGING, &tty->flags))
+                       test_bit(TTY_HUPPING, &tty->flags))
                return -EIO;
 
        if (driver->type == TTY_DRIVER_TYPE_PTY &&
@@ -1405,7 +1404,7 @@ static int tty_reopen(struct tty_struct *tty)
        }
        tty->count++;
 
-       WARN_ON(!test_bit(TTY_LDISC, &tty->flags));
+       WARN_ON(!tty->ldisc);
 
        return 0;
 }
@@ -3017,7 +3016,7 @@ void initialize_tty_struct(struct tty_struct *tty,
        tty->pgrp = NULL;
        mutex_init(&tty->legacy_mutex);
        mutex_init(&tty->termios_mutex);
-       mutex_init(&tty->ldisc_mutex);
+       init_ldsem(&tty->ldisc_sem);
        init_waitqueue_head(&tty->write_wait);
        init_waitqueue_head(&tty->read_wait);
        INIT_WORK(&tty->hangup_work, do_tty_hangup);