]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/tty/tty_buffer.c
Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
[karo-tx-linux.git] / drivers / tty / tty_buffer.c
index aa80dc94ddc2fe6969049a62479548c22a7931b5..4e7a4e9dcf4d3740b7c4655c37ec54d9ff93b76c 100644 (file)
@@ -422,7 +422,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
  *
  *     Returns the number of bytes not processed
  */
-int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
+int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
                          char *f, int count)
 {
        if (ld->ops->receive_buf2)
@@ -437,7 +437,7 @@ int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
 EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf);
 
 static int
-receive_buf(struct tty_ldisc *ld, struct tty_buffer *head, int count)
+receive_buf(struct tty_port *port, struct tty_buffer *head, int count)
 {
        unsigned char *p = char_buf_ptr(head, head->read);
        char          *f = NULL;
@@ -445,7 +445,7 @@ receive_buf(struct tty_ldisc *ld, struct tty_buffer *head, int count)
        if (~head->flags & TTYB_NORMAL)
                f = flag_buf_ptr(head, head->read);
 
-       return tty_ldisc_receive_buf(ld, p, f, count);
+       return port->client_ops->receive_buf(port, p, f, count);
 }
 
 /**
@@ -465,16 +465,6 @@ static void flush_to_ldisc(struct work_struct *work)
 {
        struct tty_port *port = container_of(work, struct tty_port, buf.work);
        struct tty_bufhead *buf = &port->buf;
-       struct tty_struct *tty;
-       struct tty_ldisc *disc;
-
-       tty = READ_ONCE(port->itty);
-       if (tty == NULL)
-               return;
-
-       disc = tty_ldisc_ref(tty);
-       if (disc == NULL)
-               return;
 
        mutex_lock(&buf->lock);
 
@@ -504,7 +494,7 @@ static void flush_to_ldisc(struct work_struct *work)
                        continue;
                }
 
-               count = receive_buf(disc, head, count);
+               count = receive_buf(port, head, count);
                if (!count)
                        break;
                head->read += count;
@@ -512,7 +502,6 @@ static void flush_to_ldisc(struct work_struct *work)
 
        mutex_unlock(&buf->lock);
 
-       tty_ldisc_deref(disc);
 }
 
 /**