Merge commit '3cf2f34' into sched/core, to fix build error
[linux-2.6-block.git] / drivers / tty / n_tty.c
index 41fe8a047d373cf84b14a9a2f5d8f41e07fd3b5f..f95569dedc88b4b60a07428bfe70069b22f561e6 100644 (file)
@@ -2041,7 +2041,7 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
 
        if (found)
                clear_bit(eol, ldata->read_flags);
-       smp_mb__after_clear_bit();
+       smp_mb__after_atomic();
        ldata->read_tail += c;
 
        if (found) {
@@ -2353,8 +2353,12 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
                        if (tty->ops->flush_chars)
                                tty->ops->flush_chars(tty);
                } else {
+                       struct n_tty_data *ldata = tty->disc_data;
+
                        while (nr > 0) {
+                               mutex_lock(&ldata->output_lock);
                                c = tty->ops->write(tty, b, nr);
+                               mutex_unlock(&ldata->output_lock);
                                if (c < 0) {
                                        retval = c;
                                        goto break_out;