From: Ilya Zykov <ilya@ilyx.ru>
To: Alan Cox <alan@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew McGregor <andrew.mcgregor@alliedtelesis.co.nz>,
linux-kernel@vger.kernel.org, ilya@ilyx.ru
Subject: [PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers.
Date: Fri, 23 Nov 2012 22:42:46 +0400 [thread overview]
Message-ID: <50AFC3A6.7010308@ilyx.ru> (raw)
This patch correct tty serial drivers.
Unfortunately, many drivers indirectly call ldisc's flush_buffer() function
in own callback function close(). Рarticularly, by the use of tty_ldisc_flush(),
before TTY LAYER calls ldisc's flush_buffer() in the right moment.
1. It disturb the logic of work ldisc's layer.
2. It is simple overhead because we call ldisc's flush_buffer() at least two times.
Signed-off-by: Ilya Zykov <ilya@ilyx.ru>
---
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a21dc8e..c4a0a6d 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1288,7 +1288,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
uart_shutdown(tty, state);
uart_flush_buffer(tty);
- tty_ldisc_flush(tty);
+ tty_buffer_flush(tty);
tty_port_tty_set(port, NULL);
spin_lock_irqsave(&port->lock, flags);
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index bf6e238..c23dd30 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -364,8 +364,8 @@ int tty_port_close_start(struct tty_port *port,
timeout = 2 * HZ;
schedule_timeout_interruptible(timeout);
}
- /* Flush the ldisc buffering */
- tty_ldisc_flush(tty);
+ /* Flush the driver buffering */
+ tty_buffer_flush(tty);
/* Drop DTR/RTS if HUPCL is set. This causes any attached modem to
hang up the line */
next reply other threads:[~2012-11-23 18:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 18:42 Ilya Zykov [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-11-27 0:06 [PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers Ilya Zykov
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=50AFC3A6.7010308@ilyx.ru \
--to=ilya@ilyx.ru \
--cc=alan@linux.intel.com \
--cc=andrew.mcgregor@alliedtelesis.co.nz \
--cc=gregkh@linuxfoundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.