Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c67716d authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman
Browse files

n_tty: Only perform wakeups for waiters



Only wakeup the _waiting_ reader, polls and/or writer(s).

Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eafbe67f
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ static void n_tty_check_unthrottle(struct tty_struct *tty)
			return;
		n_tty_set_room(tty);
		n_tty_write_wakeup(tty->link);
		if (waitqueue_active(&tty->link->write_wait))
			wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
		return;
	}
@@ -349,6 +350,7 @@ static void n_tty_packet_mode_flush(struct tty_struct *tty)
	spin_lock_irqsave(&tty->ctrl_lock, flags);
	if (tty->link->packet) {
		tty->ctrl_status |= TIOCPKT_FLUSHREAD;
		if (waitqueue_active(&tty->link->read_wait))
			wake_up_interruptible(&tty->link->read_wait);
	}
	spin_unlock_irqrestore(&tty->ctrl_lock, flags);
@@ -1155,6 +1157,7 @@ static void n_tty_receive_break(struct tty_struct *tty)
		put_tty_queue('\0', ldata);
	}
	put_tty_queue('\0', ldata);
	if (waitqueue_active(&tty->read_wait))
		wake_up_interruptible(&tty->read_wait);
}

@@ -1213,6 +1216,7 @@ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c)
		put_tty_queue('\0', ldata);
	else
		put_tty_queue(c, ldata);
	if (waitqueue_active(&tty->read_wait))
		wake_up_interruptible(&tty->read_wait);
}

@@ -1802,7 +1806,9 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
		start_tty(tty);

	/* The termios change make the tty ready for I/O */
	if (waitqueue_active(&tty->write_wait))
		wake_up_interruptible(&tty->write_wait);
	if (waitqueue_active(&tty->read_wait))
		wake_up_interruptible(&tty->read_wait);
}