From: Corbin Atkinson <corbinat@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Cox <alan@linux.intel.com>
Cc: linux-serial@vger.kernel.org, Corbin Atkinson <corbin.atkinson@ni.com>
Subject: [PATCH 1/1] serial_core: Update buffer overrun statistics.
Date: Fri, 4 May 2012 12:35:10 -0500 [thread overview]
Message-ID: <1336152910-5276-1-git-send-email-corbin.atkinson@ni.com> (raw)
Currently, serial drivers don't report buffer overruns. When a buffer overrun
occurs, tty_insert_flip_char returns 0, and no attempt is made to insert that
same character again (i.e. it is lost). This patch reports buffer overruns via
the buf_overrun field in the port's icount structure.
Signed-off-by: Corbin Atkinson <corbin.atkinson@ni.com>
---
drivers/tty/serial/serial_core.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 9c4c05b..59fb3ba 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2526,14 +2526,16 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
struct tty_struct *tty = port->state->port.tty;
if ((status & port->ignore_status_mask & ~overrun) == 0)
- tty_insert_flip_char(tty, ch, flag);
+ if (tty_insert_flip_char(tty, ch, flag) == 0)
+ ++port->icount.buf_overrun;
/*
* Overrun is special. Since it's reported immediately,
* it doesn't affect the current character.
*/
if (status & ~port->ignore_status_mask & overrun)
- tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+ if (tty_insert_flip_char(tty, 0, TTY_OVERRUN) == 0)
+ ++port->icount.buf_overrun;
}
EXPORT_SYMBOL_GPL(uart_insert_char);
--
1.7.5.4
next reply other threads:[~2012-05-04 17:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-04 17:35 Corbin Atkinson [this message]
2012-05-15 15:53 ` [PATCH 1/1] serial_core: Update buffer overrun statistics Alan Cox
2012-05-15 15:58 ` Greg Kroah-Hartman
2012-05-15 16:20 ` Corbin
2012-05-15 16:27 ` Alan Cox
2012-05-15 18:41 ` Corbin
2012-05-15 19:34 ` Jason Smith
2012-05-15 21:08 ` Alan Cox
2012-05-15 22:46 ` Corbin
2012-05-21 15:12 ` Jason Smith
2012-05-21 16:05 ` Alan Cox
2012-05-22 20:31 ` Corbin
2012-05-22 20:38 ` Jiri Slaby
2012-05-23 14:37 ` Corbin
2012-06-06 22:34 ` Corbin
2012-06-06 22:50 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336152910-5276-1-git-send-email-corbin.atkinson@ni.com \
--to=corbinat@gmail.com \
--cc=alan@linux.intel.com \
--cc=corbin.atkinson@ni.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).