From 415782f70f7be12ba7354e0396cb03a17f7fd234 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Tue, 25 Feb 2014 14:44:58 +0100 Subject: [PATCH] TTY: do not reply to KERNEL Diagnostics messages are printed using locally generated requests, using KERNEL as the calling endpoint. No reply should be sent for such cases. This check was accidentally lost with the previous removal of tty_reply(). Change-Id: I4b76215a4d90e927b0071675d89d861aa399abb3 --- drivers/tty/arch/earm/rs232.c | 9 ++++++--- drivers/tty/arch/i386/console.c | 7 ++++--- drivers/tty/arch/i386/rs232.c | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/tty/arch/earm/rs232.c b/drivers/tty/arch/earm/rs232.c index 13d817591..f9a9e8777 100644 --- a/drivers/tty/arch/earm/rs232.c +++ b/drivers/tty/arch/earm/rs232.c @@ -266,8 +266,9 @@ rs_write(register tty_t *tp, int try) tp->tty_outcum += count; if ((tp->tty_outleft -= count) == 0) { /* Output is finished, reply to the writer. */ - chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, - tp->tty_outcum); + if (tp->tty_outcaller != KERNEL) + chardriver_reply_task(tp->tty_outcaller, + tp->tty_outid, tp->tty_outcum); tp->tty_outcum = 0; tp->tty_outcaller = NONE; } @@ -275,7 +276,9 @@ rs_write(register tty_t *tp, int try) } if (tp->tty_outleft > 0 && tp->tty_termios.c_ospeed == B0) { /* Oops, the line has hung up. */ - chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, EIO); + if (tp->tty_outcaller != KERNEL) + chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, + EIO); tp->tty_outleft = tp->tty_outcum = 0; tp->tty_outcaller = NONE; } diff --git a/drivers/tty/arch/i386/console.c b/drivers/tty/arch/i386/console.c index efb49e852..27d95db5b 100644 --- a/drivers/tty/arch/i386/console.c +++ b/drivers/tty/arch/i386/console.c @@ -223,10 +223,11 @@ int try; flush(cons); /* transfer anything buffered to the screen */ - /* Reply to the writer if all output is finished or if an error occured. */ + /* Reply to the writer if all output is finished or if an error occurred. */ if (tp->tty_outleft == 0 || result != OK) { - chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, - result != OK ? result : tp->tty_outcum); + if (tp->tty_outcaller != KERNEL) + chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, + result != OK ? result : tp->tty_outcum); tp->tty_outcum = tp->tty_outleft = 0; tp->tty_outcaller = NONE; } diff --git a/drivers/tty/arch/i386/rs232.c b/drivers/tty/arch/i386/rs232.c index d98979d3d..0e29628e3 100644 --- a/drivers/tty/arch/i386/rs232.c +++ b/drivers/tty/arch/i386/rs232.c @@ -274,15 +274,17 @@ static int rs_write(register tty_t *tp, int try) tp->tty_outcum += count; if ((tp->tty_outleft -= count) == 0) { /* Output is finished, reply to the writer. */ - chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, - tp->tty_outcum); + if (tp->tty_outcaller != KERNEL) + chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, + tp->tty_outcum); tp->tty_outcum = 0; tp->tty_outcaller = NONE; } } if (tp->tty_outleft > 0 && tp->tty_termios.c_ospeed == B0) { /* Oops, the line has hung up. */ - chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, EIO); + if (tp->tty_outcaller != KERNEL) + chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, EIO); tp->tty_outleft = tp->tty_outcum = 0; tp->tty_outcaller = NONE; } -- 2.44.0