aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_buffer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 15:17:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 15:17:25 -0500
commit37c85961c3f87f2141c84e53df31e59db072fd2e (patch)
treeff020df86c8c893e4524dda9205254be202560cc /drivers/tty/tty_buffer.c
parentcaa59428971d5ad81d19512365c9ba580d83268c (diff)
parentd8a4995bcea168dfac8ee41c28c79109907e4fba (diff)
Merge tag 'tty-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver updates from Greg KH: "Here is the big tty/serial driver patchset for 4.11-rc1. Not much here, but a lot of little fixes and individual serial driver updates all over the subsystem. Majority are for the sh-sci driver and platform (the arch-specific changes have acks from the maintainer). The start of the "serial bus" code is here as well, but nothing is converted to use it yet. That work is still ongoing, hopefully will start to show up across different subsystems for 4.12 (bluetooth is one major place that will be used.) All of these have been in linux-next for a while with no reported issues" * tag 'tty-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (109 commits) tty: pl011: Work around QDF2400 E44 stuck BUSY bit atmel_serial: Use the fractional divider when possible tty: Remove extra include in HVC console tty framework serial: exar: Enable MSI support serial: exar: Move register defines from uapi header to consumer site serial: pci: Remove unused pci_boards entries serial: exar: Move Commtech adapters to 8250_exar as well serial: exar: Fix feature control register constants serial: exar: Fix initialization of EXAR registers for ports > 0 serial: exar: Fix mapping of port I/O resources serial: sh-sci: fix hardware RX trigger level setting tty/serial: atmel: ensure state is restored after suspending serial: 8250_dw: Avoid "too much work" from bogus rx timeout interrupt serdev: ttyport: check whether tty_init_dev() fails serial: 8250_pci: make pciserial_detach_ports() static ARM: dts: STiH410-b2260: Enable HW flow-control ARM: dts: STiH407-family: Use new Pinctrl groups ARM: dts: STiH407-pinctrl: Add Pinctrl group for HW flow-control ARM: dts: STiH410-b2260: Identify the UART RTS line dt-bindings: serial: Update 'uart-has-rtscts' description ...
Diffstat (limited to 'drivers/tty/tty_buffer.c')
-rw-r--r--drivers/tty/tty_buffer.c19
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 */
425int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p, 425int 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,
437EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf); 437EXPORT_SYMBOL_GPL(tty_ldisc_receive_buf);
438 438
439static int 439static int
440receive_buf(struct tty_ldisc *ld, struct tty_buffer *head, int count) 440receive_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/**