summaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-09-10 15:06:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-23 21:19:35 -0700
commit01adc80706f80a583948db6768c5571204cd5f99 (patch)
tree070bd77695ad97ee4d8541a4f97dc78d049a04d8 /drivers/tty/tty_io.c
parentf9e053dcfc02b0ad29daec8524fb1afe09774976 (diff)
tty: Move packet mode flow control notifications to pty driver
When a master pty is set to packet mode, flow control changes to the slave pty cause notifications to the master pty via reads and polls. However, these tests are occurring for all ttys, not just ptys. Implement flow control packet mode notifications in the pty driver. Only the slave side implements the flow control handlers since packet mode is asymmetric; the master pty receives notifications for slave-side changes, but not vice versa. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r--drivers/tty/tty_io.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index b8ddfef6b5d..c249ff1d51c 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -908,8 +908,7 @@ void no_tty(void)
* stop_tty - propagate flow control
* @tty: tty to stop
*
- * Perform flow control to the driver. For PTY/TTY pairs we
- * must also propagate the TIOCKPKT status. May be called
+ * Perform flow control to the driver. May be called
* on an already stopped device and will not re-call the driver
* method.
*
@@ -919,24 +918,14 @@ void no_tty(void)
* but not always.
*
* Locking:
- * ctrl_lock
* flow_lock
*/
void __stop_tty(struct tty_struct *tty)
{
- unsigned long flags;
-
if (tty->stopped)
return;
tty->stopped = 1;
- spin_lock_irqsave(&tty->ctrl_lock, flags);
- if (tty->link && tty->link->packet) {
- tty->ctrl_status &= ~TIOCPKT_START;
- tty->ctrl_status |= TIOCPKT_STOP;
- wake_up_interruptible_poll(&tty->link->read_wait, POLLIN);
- }
- spin_unlock_irqrestore(&tty->ctrl_lock, flags);
if (tty->ops->stop)
(tty->ops->stop)(tty);
}
@@ -955,33 +944,21 @@ EXPORT_SYMBOL(stop_tty);
* start_tty - propagate flow control
* @tty: tty to start
*
- * Start a tty that has been stopped if at all possible. Perform
- * any necessary wakeups and propagate the TIOCPKT status. If this
- * is the tty was previous stopped and is being started then the
- * driver start method is invoked and the line discipline woken.
+ * Start a tty that has been stopped if at all possible. If this
+ * tty was previous stopped and is now being started, the driver
+ * start method is invoked and the line discipline woken.
*
* Locking:
- * ctrl_lock
* flow_lock
*/
void __start_tty(struct tty_struct *tty)
{
- unsigned long flags;
-
if (!tty->stopped || tty->flow_stopped)
return;
tty->stopped = 0;
- spin_lock_irqsave(&tty->ctrl_lock, flags);
- if (tty->link && tty->link->packet) {
- tty->ctrl_status &= ~TIOCPKT_STOP;
- tty->ctrl_status |= TIOCPKT_START;
- wake_up_interruptible_poll(&tty->link->read_wait, POLLIN);
- }
- spin_unlock_irqrestore(&tty->ctrl_lock, flags);
if (tty->ops->start)
(tty->ops->start)(tty);
- /* If we have a running line discipline it may need kicking */
tty_wakeup(tty);
}