From 37f286e5d4c1eb5a8165e3fc5040b4c09332d8d9 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 13 Oct 2008 10:39:23 +0100 Subject: [PATCH] --- yaml --- r: 113446 b: refs/heads/master c: 95f9bfc6b76e862265a2d70ae061eec18fe14140 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/char/tty_io.c | 25 +++++++++++++++++++++++++ trunk/kernel/printk.c | 16 ---------------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 28a940e71975..f997d1d2c240 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 452a00d2ee288f2cbc36f676edd06cb14d2878c1 +refs/heads/master: 95f9bfc6b76e862265a2d70ae061eec18fe14140 diff --git a/trunk/drivers/char/tty_io.c b/trunk/drivers/char/tty_io.c index 4c0e4ed31a48..913b50258f90 100644 --- a/trunk/drivers/char/tty_io.c +++ b/trunk/drivers/char/tty_io.c @@ -1081,6 +1081,31 @@ static inline ssize_t do_tty_write( return ret; } +/** + * tty_write_message - write a message to a certain tty, not just the console. + * @tty: the destination tty_struct + * @msg: the message to write + * + * This is used for messages that need to be redirected to a specific tty. + * We don't put it into the syslog queue right now maybe in the future if + * really needed. + * + * We must still hold the BKL and test the CLOSING flag for the moment. + */ + +void tty_write_message(struct tty_struct *tty, char *msg) +{ + lock_kernel(); + if (tty) { + mutex_lock(&tty->atomic_write_lock); + if (tty->ops->write && !test_bit(TTY_CLOSING, &tty->flags)) + tty->ops->write(tty, msg, strlen(msg)); + tty_write_unlock(tty); + } + unlock_kernel(); + return; +} + /** * tty_write - write method for tty device file diff --git a/trunk/kernel/printk.c b/trunk/kernel/printk.c index b51b1567bb55..a430fd04008b 100644 --- a/trunk/kernel/printk.c +++ b/trunk/kernel/printk.c @@ -1291,22 +1291,6 @@ static int __init disable_boot_consoles(void) } late_initcall(disable_boot_consoles); -/** - * tty_write_message - write a message to a certain tty, not just the console. - * @tty: the destination tty_struct - * @msg: the message to write - * - * This is used for messages that need to be redirected to a specific tty. - * We don't put it into the syslog queue right now maybe in the future if - * really needed. - */ -void tty_write_message(struct tty_struct *tty, char *msg) -{ - if (tty && tty->ops->write) - tty->ops->write(tty, msg, strlen(msg)); - return; -} - #if defined CONFIG_PRINTK /*