ChangeSet 1.2231.1.6, 2005/03/28 19:17:52-08:00, [EMAIL PROTECTED]

        [PATCH] tty overrun time fix
        
        moreau francis <[EMAIL PROTECTED]> points out that we need to
        initialise overrun_time, else the overrun reporting screws up when 
jiffies is
        "negative".
        
        So initialise tty->overrun_time apropriately, and handle the case where 
the
        tty has been open for so long that the overrun time has become "greater 
than"
        jiffies.
        
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 n_tty.c  |    8 +++++---
 tty_io.c |    1 +
 2 files changed, 6 insertions(+), 3 deletions(-)


diff -Nru a/drivers/char/n_tty.c b/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c      2005-03-28 21:07:32 -08:00
+++ b/drivers/char/n_tty.c      2005-03-28 21:07:32 -08:00
@@ -606,9 +606,11 @@
        char buf[64];
 
        tty->num_overrun++;
-       if (time_before(tty->overrun_time, jiffies - HZ)) {
-               printk(KERN_WARNING "%s: %d input overrun(s)\n", tty_name(tty, 
buf),
-                      tty->num_overrun);
+       if (time_before(tty->overrun_time, jiffies - HZ) ||
+                       time_after(tty->overrun_time, jiffies)) {
+               printk(KERN_WARNING "%s: %d input overrun(s)\n",
+                       tty_name(tty, buf),
+                       tty->num_overrun);
                tty->overrun_time = jiffies;
                tty->num_overrun = 0;
        }
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c     2005-03-28 21:07:32 -08:00
+++ b/drivers/char/tty_io.c     2005-03-28 21:07:32 -08:00
@@ -2630,6 +2630,7 @@
        tty->magic = TTY_MAGIC;
        tty_ldisc_assign(tty, tty_ldisc_get(N_TTY));
        tty->pgrp = -1;
+       tty->overrun_time = jiffies;
        tty->flip.char_buf_ptr = tty->flip.char_buf;
        tty->flip.flag_buf_ptr = tty->flip.flag_buf;
        INIT_WORK(&tty->flip.work, flush_to_ldisc, tty);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to