From patchwork Tue Jun 24 08:06:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899675 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 408CF2571A2; Tue, 24 Jun 2025 08:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750752407; cv=none; b=P7AywD5ZKZNPW/4Eghb91siu5N2oLKkdlv4N13QRndq+xTqi0sdUJj0pMXKl9ewfUpvcYqTVzVyv5ep6nCjNneROZvgxpNIEVM18LQ8VI9nF1D41flFUo1f51vtHd2ExfPSaNqRujsieR/2rZ8tG4SLLlkxPBukpDIjlH6wGpic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750752407; c=relaxed/simple; bh=ZDOr+KyMbsjP150xtbS+m55ZlY3PgRkTcYJNBAoR6bw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vD47Z0so83hc44woCDS+E+UCvMZVsrOwl6B18qnSHaBA5fNKYUY5LRiHdsXR9wzcD230vbo+C8oS+VK7Mys2Ekc4npOsdbNdpVziN+ahj0kRSQsfIFisFF2aIL3aJDFbrnHzaYSdVIlUL3nZwkXTvHK/mIVwThpmAoNQH6oWgtI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZK+gTj6z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZK+gTj6z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F5A0C4CEF2; Tue, 24 Jun 2025 08:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750752406; bh=ZDOr+KyMbsjP150xtbS+m55ZlY3PgRkTcYJNBAoR6bw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZK+gTj6zBEYCkP5QGKOUTM0u9El+p1qcOXeqAcSiDJpGxAAIjyptVoredENyt0+7e BoWxMy4jgZFwPQafSuWc6CQjpjRuZiELL9oeLosAKdNECMjHW5axvZuYuxJvAwGf2u 8MmMJCPtSjql7kcMEdoaWNOTcc+kEuX1FqtPrsljG+H9rTPmLAfXzn1MDDOadCABzm xXTJS/2BVhxt/4CU+8FiyjdCJX6OWTj/2q+ElOTMosy7g6TVqTADnwYQj1pDpW0tFX DLhpel13xyQCjXiFQYfWHIRohJwMrMXNHZSOAan8C9c4APV9hF7tDlpB4Xu8GpGLIY JvN6rvbnX80+Q== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Subject: [PATCH v2 1/5] serial: 8250: extract serial8250_init_mctrl() Date: Tue, 24 Jun 2025 10:06:37 +0200 Message-ID: <20250624080641.509959-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250624080641.509959-1-jirislaby@kernel.org> References: <20250624080641.509959-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After commit 795158691cc0 ("serial: 8250: extract serial8250_initialize()"), split serial8250_initialize() even more -- the mctrl part of this code can be separated into serial8250_init_mctrl() -- done now. Signed-off-by: Jiri Slaby (SUSE) Suggested-by: Ilpo Järvinen Cc: Andy Shevchenko --- [v2] * use port-> directly. * do not remove curly braces. Both rebase errors -- noticed by Andy. --- drivers/tty/serial/8250/8250_port.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 48c30e158cb8..0f85a2f292fc 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2216,15 +2216,8 @@ static void serial8250_THRE_test(struct uart_port *port) up->bugs |= UART_BUG_THRE; } -static void serial8250_initialize(struct uart_port *port) +static void serial8250_init_mctrl(struct uart_port *port) { - struct uart_8250_port *up = up_to_u8250p(port); - unsigned long flags; - bool lsr_TEMT, iir_NOINT; - - serial_port_out(port, UART_LCR, UART_LCR_WLEN8); - - uart_port_lock_irqsave(port, &flags); if (port->flags & UPF_FOURPORT) { if (!port->irq) port->mctrl |= TIOCM_OUT1; @@ -2235,6 +2228,18 @@ static void serial8250_initialize(struct uart_port *port) } serial8250_set_mctrl(port, port->mctrl); +} + +static void serial8250_initialize(struct uart_port *port) +{ + struct uart_8250_port *up = up_to_u8250p(port); + unsigned long flags; + bool lsr_TEMT, iir_NOINT; + + serial_port_out(port, UART_LCR, UART_LCR_WLEN8); + + uart_port_lock_irqsave(port, &flags); + serial8250_init_mctrl(port); /* * Serial over Lan (SoL) hack: From patchwork Tue Jun 24 08:06:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899674 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 98463258CEC; Tue, 24 Jun 2025 08:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750752410; cv=none; b=WIkPc+5QPvToeTxXdTtonn/ZPUzYpB7V3upWiLeAwfGgeDmnOoed7R6TMmFoGCQijOBzweiGF/vlPwryz0nF/l68yr2hYxsVHalZ3rbMqX/QSYj40ipCZHWaMZzQUShzcNIchwhSXSI79Rbc4R5PrPIDAhFD3/0fwHz7+3wPSiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750752410; c=relaxed/simple; bh=4xjvZivOuut/sjOkmbzk/yXmDgBAAax9IEc4i93j2Cs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kjpZOLvOiWy8RjadDmaa5qE8V50VgD3qLgaWPZ2d23PQiRV7H/kO+xl82/63YWlBoH55G1+571Zf/WemtEHkbcTtSuqb+uPn2c+YcXYxnLgq+2cpE1+usl6PgW65OA4Q1C5yGXEM47ER8bx7n9f6MZ/FlxrzyhUlCrGH5uVRDJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rOktpqFV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rOktpqFV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0DC0C4CEF2; Tue, 24 Jun 2025 08:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750752410; bh=4xjvZivOuut/sjOkmbzk/yXmDgBAAax9IEc4i93j2Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOktpqFVl0L/fzuqOcAsQg6Ih9Xe4VfDIiKI+TQZldN4orRSbzRLKOTObOynLDeaS QjbigIniEBfTu0SWWf6dKxSezyLsT/Jkj/Zyw/vJ0hdVLGgMSwzar0AUJhDlbJDGp+ RxhP1qkv5t4dBvQ5ntgPGBc85PgUT4fASr/1MsjownnpK9gedxNALWCwT5Ymc73tR2 rRNJvGs4za80ys8i9Uepa1+JE6QB+aKrNaAnxLooWQkfqvYz3xZT6XQkxFNCchbUBd OV7/4Jm0uHsiGjbeLt7b1TDzACn0JrQBaemt1jEcz/magYAdGKGXw2pTUisEYXsY3O GM6wdHV3ktPIg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 3/5] serial: 8250: rename lsr_TEMT, iir_NOINT to lowercase Date: Tue, 24 Jun 2025 10:06:39 +0200 Message-ID: <20250624080641.509959-4-jirislaby@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250624080641.509959-1-jirislaby@kernel.org> References: <20250624080641.509959-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are already variables like 'iir_noint1' and 'iir_noint2'. Follow the preexisting lowercase naming of variables. So s/lsr_TEMT/lsr_temt/ and 'iir_NOINT' likewise. Signed-off-by: Jiri Slaby (SUSE) Suggested-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 5bb0ca04da55..7eddcab318b4 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2233,15 +2233,15 @@ static void serial8250_init_mctrl(struct uart_port *port) static void serial8250_iir_txen_test(struct uart_port *port) { struct uart_8250_port *up = up_to_u8250p(port); - bool lsr_TEMT, iir_NOINT; + bool lsr_temt, iir_noint; if (port->quirks & UPQ_NO_TXEN_TEST) return; /* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ serial_port_out(port, UART_IER, UART_IER_THRI); - lsr_TEMT = serial_port_in(port, UART_LSR) & UART_LSR_TEMT; - iir_NOINT = serial_port_in(port, UART_IIR) & UART_IIR_NO_INT; + lsr_temt = serial_port_in(port, UART_LSR) & UART_LSR_TEMT; + iir_noint = serial_port_in(port, UART_IIR) & UART_IIR_NO_INT; serial_port_out(port, UART_IER, 0); /* @@ -2253,7 +2253,7 @@ static void serial8250_iir_txen_test(struct uart_port *port) * variable. So, in case of UPQ_NO_TXEN_TEST, let's just don't test if we receive TX irq. * This way, we'll never enable UART_BUG_TXEN. */ - if (lsr_TEMT && iir_NOINT) { + if (lsr_temt && iir_noint) { if (!(up->bugs & UART_BUG_TXEN)) { up->bugs |= UART_BUG_TXEN; dev_dbg(port->dev, "enabling bad tx status workarounds\n"); From patchwork Tue Jun 24 08:06:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899673 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 464C5190664; Tue, 24 Jun 2025 08:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750752414; cv=none; b=IqSlN5ICp5ZeyfMz0tpvP2c97qzm13EUa9weiL/ck1yC0hgJ8Ntw0ELl1Lfo+/ozDWPI/AA1u62KV8EgeqVgozyu9wdcwRIT4vKFynGdNfFCZ1gzgy5z5NAnEbEWlhdn7tGId1jdifTszjmQHWn3X98QTIaccFRKNXel1Dd6ES0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750752414; c=relaxed/simple; bh=rONZBqSu0G336QD6fdEcLUvwhyF4RivARlvQIYQaJu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LF66IqYHpw0R27vnJmRDyqs+/O2bIJF7AvtXgUgbSiR3QaTLtFLpsg5u3dJZMYc2S8O9dRCk5383zimZGVClb20ksRzDDfAK331fFI06hWb+947XFas26gfMBhu3w8wnrYDlP2AnUGppSfRzICxX/2J5oc9/oOGsjdY4Ms2TG7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G/9oKIGy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G/9oKIGy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D05EC4CEEF; Tue, 24 Jun 2025 08:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750752413; bh=rONZBqSu0G336QD6fdEcLUvwhyF4RivARlvQIYQaJu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/9oKIGypl9sgF5wi0bI6DQWCsjBJW4+FlBDMK61TRiZyAz92va9RLWsu4sdbpB9X b7/PNne8bE4qUL/cpttYo16r+fGTPKNYruANTu+nXoAd9p8+Wkdk+uy7zr6KMvY1oh 0PyTGm3+jhHFz6gEZOFMmVAQHRgS2CbLmS98RBy2wULZThNEXkVe4R2gZ3OSOhP5X7 Hw7EQc0F4iFxPWEic/GOvMuvRFHk/SYeZ5jax1PQczZqgT1sk4XwDx19xc6gTN9J2+ FmR1FaM5gjjQ/cGBzZVq3ItGp6DXEqvVhiSdlIWfRn3npU8KIT+j0SR+902vy1tLSc xNnluErWJ81Cg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v2 5/5] tty: fix tty_port_tty_*hangup() kernel-doc Date: Tue, 24 Jun 2025 10:06:41 +0200 Message-ID: <20250624080641.509959-6-jirislaby@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250624080641.509959-1-jirislaby@kernel.org> References: <20250624080641.509959-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The commit below added a new helper, but omitted to move (and add) the corressponding kernel-doc. Do it now. Signed-off-by: Jiri Slaby (SUSE) Fixes: 2b5eac0f8c6e ("tty: introduce and use tty_port_tty_vhangup() helper") Link: https://lore.kernel.org/all/b23d566c-09dc-7374-cc87-0ad4660e8b2e@linux.intel.com/ Reported-by: Ilpo Järvinen Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org --- Documentation/driver-api/tty/tty_port.rst | 5 +++-- drivers/tty/tty_port.c | 5 ----- include/linux/tty_port.h | 9 +++++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Documentation/driver-api/tty/tty_port.rst b/Documentation/driver-api/tty/tty_port.rst index 5cb90e954fcf..504a353f2682 100644 --- a/Documentation/driver-api/tty/tty_port.rst +++ b/Documentation/driver-api/tty/tty_port.rst @@ -42,9 +42,10 @@ TTY Refcounting TTY Helpers ----------- +.. kernel-doc:: include/linux/tty_port.h + :identifiers: tty_port_tty_hangup tty_port_tty_vhangup .. kernel-doc:: drivers/tty/tty_port.c - :identifiers: tty_port_tty_hangup tty_port_tty_wakeup - + :identifiers: tty_port_tty_wakeup Modem Signals ------------- diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 903eebdbe12d..5b4d5fb99a59 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -391,11 +391,6 @@ void tty_port_hangup(struct tty_port *port) } EXPORT_SYMBOL(tty_port_hangup); -/** - * tty_port_tty_hangup - helper to hang up a tty - * @port: tty port - * @check_clocal: hang only ttys with %CLOCAL unset? - */ void __tty_port_tty_hangup(struct tty_port *port, bool check_clocal, bool async) { struct tty_struct *tty = tty_port_tty_get(port); diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h index 021f9a8415c0..332ddb93603e 100644 --- a/include/linux/tty_port.h +++ b/include/linux/tty_port.h @@ -251,11 +251,20 @@ static inline int tty_port_users(struct tty_port *port) return port->count + port->blocked_open; } +/** + * tty_port_tty_hangup - helper to hang up a tty asynchronously + * @port: tty port + * @check_clocal: hang only ttys with %CLOCAL unset? + */ static inline void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) { __tty_port_tty_hangup(port, check_clocal, true); } +/** + * tty_port_tty_vhangup - helper to hang up a tty synchronously + * @port: tty port + */ static inline void tty_port_tty_vhangup(struct tty_port *port) { __tty_port_tty_hangup(port, false, false);