From 321337c9e82f016a0cd64f81573c18b5731ffa8d Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Thu, 17 Oct 2024 17:33:46 +0530 Subject: Merge remote-tracking branch 'msm8998/lineage-20' into lineage-20 Change-Id: I126075a330f305c85f8fe1b8c9d408f368be95d1 --- drivers/tty/pty.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'drivers/tty/pty.c') diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 8ee146b14aae..6a024b5cfb0f 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -106,21 +106,11 @@ static void pty_unthrottle(struct tty_struct *tty) static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) { struct tty_struct *to = tty->link; - unsigned long flags; - if (tty->stopped) + if (tty->stopped || !c) return 0; - if (c > 0) { - spin_lock_irqsave(&to->port->lock, flags); - /* Stuff the data into the input queue of the other end */ - c = tty_insert_flip_string(to->port, buf, c); - spin_unlock_irqrestore(&to->port->lock, flags); - /* And shovel */ - if (c) - tty_flip_buffer_push(to->port); - } - return c; + return tty_insert_flip_string_and_push_buffer(to->port, buf, c); } /** -- cgit v1.2.3