diff options
Diffstat (limited to 'drivers/tty/tty_buffer.c')
-rw-r--r-- | drivers/tty/tty_buffer.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index aa80dc94ddc2..4e7a4e9dcf4d 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -422,7 +422,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); | |||
422 | * | 422 | * |
423 | * Returns the number of bytes not processed | 423 | * Returns the number of bytes not processed |
424 | */ | 424 | */ |
425 | int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p, | 425 | int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, |
426 | char *f, int count) | 426 | char *f, int count) |
427 | { | 427 | { |
428 | if (ld->ops->receive_buf2) | 428 | if (ld->ops->receive_buf2) |
@@ -437,7 +437,7 @@ int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p, | |||
437 | EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf); | 437 | EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf); |
438 | 438 | ||
439 | static int | 439 | static int |
440 | receive_buf(struct tty_ldisc *ld, struct tty_buffer *head, int count) | 440 | receive_buf(struct tty_port *port, struct tty_buffer *head, int count) |
441 | { | 441 | { |
442 | unsigned char *p = char_buf_ptr(head, head->read); | 442 | unsigned char *p = char_buf_ptr(head, head->read); |
443 | char *f = NULL; | 443 | char *f = NULL; |
@@ -445,7 +445,7 @@ receive_buf(struct tty_ldisc *ld, struct tty_buffer *head, int count) | |||
445 | if (~head->flags & TTYB_NORMAL) | 445 | if (~head->flags & TTYB_NORMAL) |
446 | f = flag_buf_ptr(head, head->read); | 446 | f = flag_buf_ptr(head, head->read); |
447 | 447 | ||
448 | return tty_ldisc_receive_buf(ld, p, f, count); | 448 | return port->client_ops->receive_buf(port, p, f, count); |
449 | } | 449 | } |
450 | 450 | ||
451 | /** | 451 | /** |
@@ -465,16 +465,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
465 | { | 465 | { |
466 | struct tty_port *port = container_of(work, struct tty_port, buf.work); | 466 | struct tty_port *port = container_of(work, struct tty_port, buf.work); |
467 | struct tty_bufhead *buf = &port->buf; | 467 | struct tty_bufhead *buf = &port->buf; |
468 | struct tty_struct *tty; | ||
469 | struct tty_ldisc *disc; | ||
470 | |||
471 | tty = READ_ONCE(port->itty); | ||
472 | if (tty == NULL) | ||
473 | return; | ||
474 | |||
475 | disc = tty_ldisc_ref(tty); | ||
476 | if (disc == NULL) | ||
477 | return; | ||
478 | 468 | ||
479 | mutex_lock(&buf->lock); | 469 | mutex_lock(&buf->lock); |
480 | 470 | ||
@@ -504,7 +494,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
504 | continue; | 494 | continue; |
505 | } | 495 | } |
506 | 496 | ||
507 | count = receive_buf(disc, head, count); | 497 | count = receive_buf(port, head, count); |
508 | if (!count) | 498 | if (!count) |
509 | break; | 499 | break; |
510 | head->read += count; | 500 | head->read += count; |
@@ -512,7 +502,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
512 | 502 | ||
513 | mutex_unlock(&buf->lock); | 503 | mutex_unlock(&buf->lock); |
514 | 504 | ||
515 | tty_ldisc_deref(disc); | ||
516 | } | 505 | } |
517 | 506 | ||
518 | /** | 507 | /** |