Add trace support for echo output but leave it separately selectable/
buildable from the base trace support.

Signed-off-by: Peter Hurley <[email protected]>
---
 drivers/tty/n_tty.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 26ae9d7..bd01d97 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -94,6 +94,13 @@
 # define n_tty_trace(tty, f, args...)  do { } while (0)
 #endif
 
+#undef N_TTY_TRACE_ECHOES
+#ifdef N_TTY_TRACE_ECHOES
+# define n_tty_trace_echoes(tty, f, args...)   _n_tty_trace(tty, f, args)
+#else
+# define n_tty_trace_echoes(tty, f, args...)   do { } while (0)
+#endif
+
 struct n_tty_data {
        /* producer-published */
        size_t read_head;
@@ -791,13 +798,18 @@ static size_t __process_echoes(struct tty_struct *tty)
                }
        }
 
+       n_tty_trace_echoes(tty, "echoes:%zu,%zu commit:%zu head:%zu\n",
+                          ldata->echo_tail, tail, ldata->echo_commit,
+                          ldata->echo_head);
+
        /* If the echo buffer is nearly full (so that the possibility exists
         * of echo overrun before the next commit), then discard enough
         * data at the tail to prevent a subsequent overrun */
        while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) {
 
-               n_tty_trace(tty, "discard echoes (%zu - %zu > %d)\n",
-                           ldata->echo_commit, tail, ECHO_DISCARD_WATERMARK);
+               n_tty_trace_echoes(tty, "discard echoes (%zu - %zu > %d)\n",
+                                  ldata->echo_commit, tail,
+                                  ECHO_DISCARD_WATERMARK);
 
                if (echo_buf(ldata, tail) == ECHO_OP_START) {
                        if (echo_buf(ldata, tail + 1) == ECHO_OP_ERASE_TAB)
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to