[PATCH] TTY: tty_ldisc_wait_idle debug

From: Jiri Slaby
Date: Mon Aug 08 2011 - 10:00:59 EST


Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
drivers/tty/tty_ldisc.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 512c49f..0b90801 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -26,6 +26,7 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/seq_file.h>
+#include <linux/ratelimit.h>

#include <linux/uaccess.h>
#include <asm/system.h>
@@ -758,11 +759,17 @@ static void tty_reset_termios(struct tty_struct *tty)
static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
{
struct tty_ldisc *ld = tty_ldisc_get(ldisc);
+ int ret;

if (IS_ERR(ld))
return -1;

- WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
+ ret = tty_ldisc_wait_idle(tty);
+ if (ret)
+ printk_ratelimited(KERN_DEBUG "%s: refcount of %ps is still %d\n",
+ __func__,
+ tty->ldisc->ops,
+ atomic_read(&tty->ldisc->users));

tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc);
--
1.7.6


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