mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] Char: tty, add tty_schedule_wakeup
Date: Thu,  1 Nov 2007 11:55:56 +0100 (CET)	[thread overview]
Message-ID: <15530290543226725036.slaby@karneval.cz> (raw)
In-Reply-To: <14457172322573118772.slaby@karneval.cz>

UNTESTED so far

--
tty, add tty_schedule_wakeup

Because several drivers schedule a workqueue only for tty_wakeup, move this
functionality into tty layer and use newly added centralized work.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>

---
commit 0e9d5add01e8835407bd9f67b9fd82f98e19e122
tree a566aa490d247b5d5b9ff8e6ed437268c495f86b
parent 1ce760b56883d3c99b914266bca939f8d3ade1fd
author Jiri Slaby <jirislaby@gmail.com> Thu, 01 Nov 2007 10:56:24 +0100
committer Jiri Slaby <jirislaby@gmail.com> Thu, 01 Nov 2007 10:56:24 +0100

 drivers/char/tty_io.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 0eb979d..fd4a0e4 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -112,6 +112,7 @@
 
 #define TTY_WORK_HANGUP		1
 #define TTY_WORK_SAK		2
+#define TTY_WORK_WAKEUP		3
 
 struct ktermios tty_std_termios = {	/* for the benefit of tty drivers  */
 	.c_iflag = ICRNL | IXON,
@@ -1296,6 +1297,20 @@ void tty_wakeup(struct tty_struct *tty)
 EXPORT_SYMBOL_GPL(tty_wakeup);
 
 /**
+ *	tty_schedule_wakeup	-	request more data
+ *	@tty: terminal
+ *
+ *	Functionally the same as tty_wakeup, but it can be used in hot
+ *	paths. since the wakeup is scheduled and done in the future.
+ */
+void tty_schedule_wakeup(struct tty_struct *tty)
+{
+	set_bit(TTY_WORK_WAKEUP, tty->work_todo);
+	schedule_work(&tty->work);
+}
+EXPORT_SYMBOL_GPL(tty_schedule_wakeup);
+
+/**
  *	tty_ldisc_flush	-	flush line discipline queue
  *	@tty: tty
  *
@@ -3599,6 +3614,8 @@ static void tty_work(struct work_struct *work)
 		do_tty_hangup(tty);
 	if (test_and_clear_bit(TTY_WORK_SAK, tty->work_todo))
 		__do_SAK(tty);
+	if (test_and_clear_bit(TTY_WORK_WAKEUP, tty->work_todo))
+		tty_wakeup(tty);
 }
 
 /**

  reply	other threads:[~2007-11-01 11:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 10:55 [RFC 1/2] Char: tty, centralize works Jiri Slaby
2007-11-01 10:55 ` Jiri Slaby [this message]
2007-11-01 14:34   ` [PATCH 2/2] Char: tty, add tty_schedule_wakeup Paul Fulghum
2007-11-01 15:07     ` Jiri Slaby
2007-11-01 15:48   ` Alan Cox
2007-11-01 15:50     ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15530290543226725036.slaby@karneval.cz \
    --to=jirislaby@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®