public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers.
@ 2012-11-27  0:06 Ilya Zykov
  0 siblings, 0 replies; 2+ messages in thread
From: Ilya Zykov @ 2012-11-27  0:06 UTC (permalink / raw)
  To: Alan Cox
  Cc: Andrew McGregor, Greg Kroah-Hartman, linux-serial, linux-kernel,
	ilya

Sorry. Correct patch format.

Related bug 'tty: fix "IRQ45: nobody cared"'
Related commit 7b292b4bf9a9d6098440d85616d6ca4c608b8304

  Unfortunately, some drivers indirectly call ldisc's flush_buffer() function 
in own callback function close(). In particularly, 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.

Please, tell me what do you think about this? Can I make the adjustment for other drivers?

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 0fcfd98..d87f353 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1304,7 +1304,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 d7bdd8d..8a02996 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -428,8 +428,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 */

^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers.
@ 2012-11-23 18:42 Ilya Zykov
  0 siblings, 0 replies; 2+ messages in thread
From: Ilya Zykov @ 2012-11-23 18:42 UTC (permalink / raw)
  To: Alan Cox; +Cc: Greg Kroah-Hartman, Andrew McGregor, linux-kernel, ilya

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 */


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-27  0:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-27  0:06 [PATCH]tty: Incorrect use tty_ldisc_flush() in TTY drivers Ilya Zykov
  -- strict thread matches above, loose matches on Subject: below --
2012-11-23 18:42 Ilya Zykov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox