Merge tag 'thermal-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/therma...
[linux-2.6-microblaze.git] / drivers / tty / pty.c
index ef72031..23368ce 100644 (file)
@@ -100,7 +100,7 @@ static void pty_unthrottle(struct tty_struct *tty)
  *     pty_write               -       write to a pty
  *     @tty: the tty we write from
  *     @buf: kernel buffer of data
- *     @count: bytes to write
+ *     @c: bytes to write
  *
  *     Our "hardware" write method. Data is coming from the ldisc which
  *     may be in a non sleeping state. We simply throw this at the other
@@ -116,22 +116,15 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
        if (tty->stopped)
                return 0;
 
-       mutex_lock(&tty_mutex);
-       if (to->magic != TTY_MAGIC) {
-               mutex_unlock(&tty_mutex);
-               return -EIO;
-       }
-
        if (c > 0) {
                spin_lock_irqsave(&to->port->lock, flags);
                /* Stuff the data into the input queue of the other end */
                c = tty_insert_flip_string(to->port, buf, c);
+               spin_unlock_irqrestore(&to->port->lock, flags);
                /* And shovel */
                if (c)
                        tty_flip_buffer_push(to->port);
-               spin_unlock_irqrestore(&to->port->lock, flags);
        }
-       mutex_unlock(&tty_mutex);
        return c;
 }