From nobody Tue Feb 10 01:19:39 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C2962AD2C; Mon, 16 Dec 2024 17:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369168; cv=none; b=ONCau07PGw3O1EFJajhVeEVMnuFawSq6TOTJwvLPav55/2P0jmLLBbcJnhxAt9b7ASe+3s8x1PiuXFMNQ+xJetEMjhrfhNRFi6vCeG1TQZp9RyR+jrX5qRBGT9MA2et2qcwY1fEf+kufg2qnvIPISc5GRIYefsd2VoaNg3hR0Gs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369168; c=relaxed/simple; bh=2zHGMhXczieY8uy03r4x9wyNQErE608yROGA/U9K5GM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XFr5rpMpjUIZZ6P1GMvIdNYGBjzFISQRwj3ZlGwqxFTsJ69xC17ERTmBa0/+nLGWYWfk0pnripbQY6MyekyNiymU8FQ+mfPcGt4+mmQ7A0HE2MqUxz/8r7F+uoLGEnNmQ/OuinZma1j7QoFObousOXjXor0NILa1/EJ2w7WP3cM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tZjolHmA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=4nWHBpZY; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tZjolHmA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4nWHBpZY" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734369165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/Ho2g2JVR/Wkh20uSYT1koH8iN5EU9nEd431AmzNkK0=; b=tZjolHmAa84GEQRZ+3Vx76cAXFZNIz9SwAlBhtJg894g7JzkWM2edI13BEN5PrvF7sl8oj jFU1meOAVPukd9oBoiPm9saY07iISQOtKx4TIKx5ObL7G5wyBfjoG8AItsObvPtC48QF54 SB+R5etiJ49E3GFNrcvBWH+GCV5ItFZLXgJRhtgzqWO7bJUYAoJZ0G9+Onrea68atyfcYB iNvpuBsQ3BKGr5kIUiW8EWp4f78wdp6P5ju/PYj0MXPcp9bhMuRwkfUG6fhw+8ADbMFHeN cl4v+d08Adal+p0+j7DWmLnaansm3tRz6TUozyWgIYwy86hd1j1crcCLAYsppA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734369165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/Ho2g2JVR/Wkh20uSYT1koH8iN5EU9nEd431AmzNkK0=; b=4nWHBpZYK9THsJ7KAOWOZmMRG6EtQ3gJBVHg86XvG4ZBsokVNF+U4hf4XShEL01ysRAu/8 bAIo93W1FTI4gSCQ== To: Greg Kroah-Hartman Cc: Jiri Slaby , Esben Haabendal , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , Arnd Bergmann , Rengarajan S , Bart Van Assche , Niklas Schnelle , Serge Semin , Lino Sanfilippo , Peter Collingbourne Subject: [PATCH tty-next v1 1/4] serial: 8250: Use @ier bits to determine if Rx is stopped Date: Mon, 16 Dec 2024 18:18:41 +0106 Message-Id: <20241216171244.12783-2-john.ogness@linutronix.de> In-Reply-To: <20241216171244.12783-1-john.ogness@linutronix.de> References: <20241216171244.12783-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit f19c3f6c8109 ("serial: 8250_port: Don't service RX FIFO if throttled") uses @read_status_mask (bit UART_LSR_DR) to determine if Rx has been stopped. However, the bit UART_LSR_DR is not managed properly in @read_status_mask for all Rx stop/start situations and is therefore not suitable for this purpose. Use the UART_IER_RLSI and UART_IER_RDI bits in @ier instead, as this is already common in 8250-variants and drivers. Signed-off-by: John Ogness --- drivers/tty/serial/8250/8250_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 1ea52fce9bf1..4d742bfb7e9a 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1931,7 +1931,7 @@ int serial8250_handle_irq(struct uart_port *port, uns= igned int iir) */ if (!(status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS)) && (port->status & (UPSTAT_AUTOCTS | UPSTAT_AUTORTS)) && - !(port->read_status_mask & UART_LSR_DR)) + !(up->ier & (UART_IER_RLSI | UART_IER_RDI))) skip_rx =3D true; =20 if (status & (UART_LSR_DR | UART_LSR_BI) && !skip_rx) { --=20 2.39.5 From nobody Tue Feb 10 01:19:39 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6564B1B412A; Mon, 16 Dec 2024 17:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369169; cv=none; b=tgnvaC89zCEK5Ab3H/dU41FeBmIJ8mzfO8mc70DA2WN5rfXj8yyq0SgNHTCr//iwW1P/w1pjuHA1EaJX5N73vVYoAJccJ8znaPLjIXPJTO3+6sYkhi2XzKVjUXB0DSVKaH/EH8ch7bfAosvUD0lZnYc86w9pWLkt0vFTH+zM1EU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369169; c=relaxed/simple; bh=9ulM/VLZgmh6Vb61H3gobPJULnBEd94G/t+5gQOobO0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JIkjfAqkULFUsKl+qIXBaCSdoWLcyDC4NeNhV45TqAN3zIwZLNE0S1ylyMobAh3v9ru2ck8kvZjEdzPPsCJf7iVIc/HxrAZW+f0AuK3FFLT/yXbmwA+De8Puxl0Bz+/v44DBVWeO5yntIxBxeYjRfTQQNwC7TL1Jmtj+MjTxYVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ZVZKCP/s; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iL1Jf2wy; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ZVZKCP/s"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iL1Jf2wy" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734369166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lHekKzUh6KDzBa4Wm/wnMVOz430Naq4Xufxov1IYktQ=; b=ZVZKCP/sC7pSSh58XjkURjnz0P+SeKRcufTrVly1ZJqqlHUKmrtq9qofVVmpWXdZAY0Yn3 Rjpq5gO+BM7WAmgjqrazXBXYzrV0po4FTh/YgszxQr3cwcOCKAqUIICcBALL30lSuDscmC TEuA5fhW+MpMDz6YwuNrXV65RNPwmx1i/Rd8pry/AkmVZljT04oi0auxBvQG6tVp1xOwCq z0r5V5bI5Y1omlke6Ae/Undfns3ccPWdGe8AAi7Br7vVHkASnpcf/GnSwrnmx2pKsFUv2C OZOOXr2AkfqozNatVQhBmU53Ma5ekgdPxzFnI3iW7M8nnRBoLDnv+pyqJf+jEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734369166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lHekKzUh6KDzBa4Wm/wnMVOz430Naq4Xufxov1IYktQ=; b=iL1Jf2wySkY85dB3YmsPSfqZLtfb/Nz/3G2uOCp9qAftgnocBHLyIYgT+EwarUX9q4BxAE flmXPleQcV62gCDQ== To: Greg Kroah-Hartman Cc: Jiri Slaby , Esben Haabendal , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Kevin Hilman , Markus Schneider-Pargmann , Andy Shevchenko , Udit Kumar , Griffin Kroah-Hartman , Arnd Bergmann , Rengarajan S , Lino Sanfilippo , Niklas Schnelle , Serge Semin , Peter Collingbourne Subject: [PATCH tty-next v1 2/4] serial: 8250: Do not set UART_LSR_THRE in @read_status_mask Date: Mon, 16 Dec 2024 18:18:42 +0106 Message-Id: <20241216171244.12783-3-john.ogness@linutronix.de> In-Reply-To: <20241216171244.12783-1-john.ogness@linutronix.de> References: <20241216171244.12783-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since Linux 2.1.8 @read_status_mask is no longer used as a general control of which bits are used from the LSR register. Instead it has become an additional mask applied to @ignore_status_mask. Since UART_LSR_THRE is never set for @ignore_status_mask, it serves no purpose to set it for @read_status_mask. In fact, it propagates the misconception that @read_status_mask can be used as a general mask for LSR bits. Do not set UART_LSR_THRE for @read_status_mask. Signed-off-by: John Ogness --- drivers/tty/serial/8250/8250_omap.c | 2 +- drivers/tty/serial/8250/8250_port.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/= 8250_omap.c index 9eb9aa766811..5290aed76a5e 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -412,7 +412,7 @@ static void omap_8250_set_termios(struct uart_port *por= t, */ uart_update_timeout(port, termios->c_cflag, baud); =20 - up->port.read_status_mask =3D UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; + up->port.read_status_mask =3D UART_LSR_OE | UART_LSR_DR; if (termios->c_iflag & INPCK) up->port.read_status_mask |=3D UART_LSR_FE | UART_LSR_PE; if (termios->c_iflag & (IGNBRK | PARMRK)) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 4d742bfb7e9a..a5c1b069c67b 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2786,7 +2786,7 @@ serial8250_do_set_termios(struct uart_port *port, str= uct ktermios *termios, */ uart_update_timeout(port, termios->c_cflag, baud); =20 - port->read_status_mask =3D UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; + port->read_status_mask =3D UART_LSR_OE | UART_LSR_DR; if (termios->c_iflag & INPCK) port->read_status_mask |=3D UART_LSR_FE | UART_LSR_PE; if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) --=20 2.39.5 From nobody Tue Feb 10 01:19:39 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 655EC146599; Mon, 16 Dec 2024 17:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369169; cv=none; b=t6kr/sTHg40rfa2psx9NmyNVayv3RRqVztPXKuL94S0IGMda4JSwUhuPAkAzdG+3Rqa3KV1tw86H8vfNc5MEtDrV8kkELoqwDy6RqWs/Re8PwH2YCTlLkAGm3Z6fSfaABv5f33TijQ6xZU+Qe2nU/SqbI7r3Yin1H5hTkzOVdGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369169; c=relaxed/simple; bh=sVMl+jn1gO7/B56wvNDox+JTcyMMStgWzsj2WddAzZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FKnYA41hQhVgk6Olcx0uzk//eg78MaBXGRxAuwA9XaMTHD2LCvlo3ch/pHDwWY/Uvj1ncdOdB3LS6He/m4MVXnNuBgG1TBFbxDY2sOgnv4ZEmW8dFpFU/i4MrBWR1fPnhfb7ST17wTwZ/Rq8RQxO+V0mxbAYt14JvYSyOMYryws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OEBIBINY; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/vUGJZ7f; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OEBIBINY"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/vUGJZ7f" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734369166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y4LDy/bdxAIfmqXtWO12bc7RfBH5jaXLX1SR92lnOds=; b=OEBIBINYLCgJV4AMjqIupQwWPmRWmPqQhhOEoXZSzYL61UQB+2Tmq6oA3IrlHZP7NoCU6p 5UVmGd3zWgM5i99VhHqe3AAViTGrcidUv+PVRDwi+BDJnpEWUnQGg6L44oAlcDMUkFmjDj BYhK6aQS9lVaJ22pXEnnZ+ldGAlegZRqntJGz9VoqG/loIs+nbBUSh2ud64UBdQi1RQ0Fh x4ibcsg8Vtof9ACmYDd2sqiz+iuNhwdkWnvP7QpoUoZu3U6+YANUa3UR7/6DaiOxwpIqu0 TWRenhHAASipkLtuWdDGBgUaKBSdyTC3Dz4rjPsgVO3pnIAViomvboqNdV7eeA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734369166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y4LDy/bdxAIfmqXtWO12bc7RfBH5jaXLX1SR92lnOds=; b=/vUGJZ7fPqiA2R9JZiyiz9KkBnErqaYSVsmHW+iYjh4d2YQwxOjLlIDThkf232I8knc2to /bx9kVjMTmhCsLDQ== To: Greg Kroah-Hartman Cc: Jiri Slaby , Esben Haabendal , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Mladek , Andy Shevchenko , Arnd Bergmann , Tony Lindgren , Kevin Hilman , Markus Schneider-Pargmann , Udit Kumar , Griffin Kroah-Hartman , Rengarajan S , Guenter Roeck , Jeff Johnson , Niklas Schnelle , Serge Semin , Lino Sanfilippo , Peter Collingbourne Subject: [PATCH tty-next v1 3/4] serial: 8250: Never adjust UART_LSR_DR in @read_status_mask Date: Mon, 16 Dec 2024 18:18:43 +0106 Message-Id: <20241216171244.12783-4-john.ogness@linutronix.de> In-Reply-To: <20241216171244.12783-1-john.ogness@linutronix.de> References: <20241216171244.12783-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The CREAD feature of termios is implemented by setting/clearing UART_LSR_DR within @ignore_status_mask. For this feature to function correctly, it requires that UART_LSR_DR is never masked (unset) in @read_status_mask so that uart_insert_char() can properly drop the character if CREAD is disabled. Currently there are code paths that clear/set UART_LSR_DR from @read_status_mask at times. This appears to be a relic from Linux 1.1.60, where @read_status_mask could be used to mask all UART_LSR reading. However, since Linux 2.1.8 that is no longer the case. Now if UART_LSR_DR is cleared from @read_status_mask, received characters may not be dropped even though CREAD is disabled. This can be seen when: - CREAD is disabled (UART_LSR_DR is set in @ignore_status_mask) - LSR has an error bit set from UART_LSR_BRK_ERROR_BITS (and that error is not ignored via @ignore_status_mask) - UART_LSR_DR is cleared in @read_status_mask In this case characters will be inserted into the tty buffer even though they should be ignored. Remove all setting/clearing of UART_LSR_DR for @read_status_mask except for its initialization. Signed-off-by: John Ogness --- drivers/tty/serial/8250/8250_core.c | 1 - drivers/tty/serial/8250/8250_omap.c | 1 - drivers/tty/serial/8250/8250_port.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/= 8250_core.c index 5f9f06911795..2b70e82dffeb 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -675,7 +675,6 @@ static void serial_8250_overrun_backoff_work(struct wor= k_struct *work) =20 uart_port_lock_irqsave(port, &flags); up->ier |=3D UART_IER_RLSI | UART_IER_RDI; - up->port.read_status_mask |=3D UART_LSR_DR; serial_out(up, UART_IER, up->ier); uart_port_unlock_irqrestore(port, flags); } diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/= 8250_omap.c index 5290aed76a5e..10144fcc0363 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -838,7 +838,6 @@ static void omap_8250_unthrottle(struct uart_port *port) if (up->dma) up->dma->rx_dma(up); up->ier |=3D UART_IER_RLSI | UART_IER_RDI; - port->read_status_mask |=3D UART_LSR_DR; serial_out(up, UART_IER, up->ier); uart_port_unlock_irqrestore(port, flags); =20 diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index a5c1b069c67b..3b9dc2bb06eb 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1390,7 +1390,6 @@ static void serial8250_stop_rx(struct uart_port *port) serial8250_rpm_get(up); =20 up->ier &=3D ~(UART_IER_RLSI | UART_IER_RDI); - up->port.read_status_mask &=3D ~UART_LSR_DR; serial_port_out(port, UART_IER, up->ier); =20 serial8250_rpm_put(up); --=20 2.39.5 From nobody Tue Feb 10 01:19:39 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D358520457E; Mon, 16 Dec 2024 17:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369170; cv=none; b=g4RNAH8sgsMSYow6TJ2ZpmtnWHOo1tPp1Vls4JJzCWSB4xvkKWqa4GBSv4cQRVyiMFD8sDPlIg6nbYB3X3nzj9tPwZ4+1OibSfPDBo9fOrYPTvpKpqDLLzzR144+1Ye7qz08QJtcel0bRPhMqPKQsopDjY6Zj5x179C7tmyMrnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734369170; c=relaxed/simple; bh=j6/QL3gdZfERetxbMI/0rk9rf92p20Yw3Wr+IsPrr6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=P6tiuyn2monopMXO07gAyY7T+n7xvyid/7QEuqQ68pzBZNFi1+bzEfVMvjtPkLaofD5U95DLmVlT0YPBzIHWnaIICI5B2HUhssmYmQ0WCpBQ9P68p2jorZkyU90mhUIC0xcr4qEJ3lkcbzjuWG+7R/IQVOQ7288UEraOlF8T8WM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UAKnRJGO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NKyg8KQc; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UAKnRJGO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NKyg8KQc" From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734369167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pR/sHqHxQXpD31p3g1/0O7LvU9aHX60Ye5Sne1phnAo=; b=UAKnRJGOs4Z/oTlCMOW2xarcaNaOSY9PNcZhuA24YTVuMtKm2avq0jfbfpXh9N21Kyi392 ZG2sG1LDqZ77RjRpJBB/sACEkB+uLILrnuVs4UfauyMxuCjaN2t1ZrB4Oyy5eTY3yylJ+6 bKDIYHoz6MseJ4ahfcUB97v8iTLfzy0y8dp8x9FWhpXBr23f/VpvcsKYtVyBj/dLbhx+jd gFG5wqwW1HWBdoX13H3zKwOsU3pUe3sbk/36WS3sxDHcucGvnTlibdqJgQiiv1FeI+fguJ KMqxQ2D6uIBi1tF+CCMFz4FDc1yhUho8pQbRW3PtPrY31J1uPMaOam9t56afuQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734369167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pR/sHqHxQXpD31p3g1/0O7LvU9aHX60Ye5Sne1phnAo=; b=NKyg8KQcahkoUwXURAyuEcC6z42AkS/jfd7ylZKnRCJalZTvAIuWmF8KjzhZboMdpQtENa 3m/xqnAo4AvYB9Ag== To: Greg Kroah-Hartman Cc: Jiri Slaby , Esben Haabendal , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Kevin Hilman , Markus Schneider-Pargmann , Andy Shevchenko , Udit Kumar , Griffin Kroah-Hartman , Arnd Bergmann , Rengarajan S , Bart Van Assche , Niklas Schnelle , Serge Semin , Lino Sanfilippo , Peter Collingbourne Subject: [PATCH tty-next v1 4/4] serial: 8250: Explain the role of @read_status_mask Date: Mon, 16 Dec 2024 18:18:44 +0106 Message-Id: <20241216171244.12783-5-john.ogness@linutronix.de> In-Reply-To: <20241216171244.12783-1-john.ogness@linutronix.de> References: <20241216171244.12783-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The role of @read_status_mask has changed over time and seems to still cause confusion. This can be expected since there is zero documentation about this driver-specific variable. Add comments to the initialization of @read_status_mask to clarify its role. Signed-off-by: John Ogness --- drivers/tty/serial/8250/8250_omap.c | 6 ++++++ drivers/tty/serial/8250/8250_port.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/= 8250_omap.c index 10144fcc0363..42b4aa56b902 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -412,6 +412,12 @@ static void omap_8250_set_termios(struct uart_port *po= rt, */ uart_update_timeout(port, termios->c_cflag, baud); =20 + /* + * Specify which conditions may be considered for error + * handling and the ignoring of characters. The actual + * ignoring of characters only occurs if the bit is set + * in @ignore_status_mask as well. + */ up->port.read_status_mask =3D UART_LSR_OE | UART_LSR_DR; if (termios->c_iflag & INPCK) up->port.read_status_mask |=3D UART_LSR_FE | UART_LSR_PE; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 3b9dc2bb06eb..1a65d3e5f3c0 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2785,6 +2785,12 @@ serial8250_do_set_termios(struct uart_port *port, st= ruct ktermios *termios, */ uart_update_timeout(port, termios->c_cflag, baud); =20 + /* + * Specify which conditions may be considered for error + * handling and the ignoring of characters. The actual + * ignoring of characters only occurs if the bit is set + * in @ignore_status_mask as well. + */ port->read_status_mask =3D UART_LSR_OE | UART_LSR_DR; if (termios->c_iflag & INPCK) port->read_status_mask |=3D UART_LSR_FE | UART_LSR_PE; --=20 2.39.5