From patchwork Mon Jun 23 07:46:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899427 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 2146F1FCFE7; Mon, 23 Jun 2025 07:46:10 +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=1750664771; cv=none; b=JKe8O5i8AsGKvt5NG0aiW5vv7wPk3neARajHiK1Zc2kOxgqvakDElzmIwhGc7mR5BRR8zenOQU7qMtAev/zE6jy2icjmP5oGVUr4yKEwBheto5lDkMEG6Ba4rOkulR9824KKTX9er/XBe0zVJSLoNhsPRr4DobgOW5zmovW97v8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750664771; c=relaxed/simple; bh=8PdxRbGHrTIbYeZaZWAnu2iO4cbJH8QbP9FyCJlwLrc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HeuAviQE7mrCQPS060LC3943DAAUp+sxjdfS8ssBL6bZ7AEsML9/lD/LSUNv5wVJLJal9cnNVVFYyY8fOUaKmdoLuC9XFiDU/345Cufuf14tfv3yXLXAsIumnUu4y06MGFUZlpGRzA42x1SKAmXWLxiNlwVXDLfjVeZQNSfrGds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y3r2X5tu; 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="Y3r2X5tu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6599BC4CEEF; Mon, 23 Jun 2025 07:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750664770; bh=8PdxRbGHrTIbYeZaZWAnu2iO4cbJH8QbP9FyCJlwLrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y3r2X5tu3C6XnqrDjuoak9CQfAHrjMxtutDEN73F2HgTBUcWlQajudqPqLnlWql+v ldBKzbjJrsS7QpxJRv1lb05lErjT5UTqzhrkhFYnFNcYSXh501wV4r423W+rLfTCXy X/rabZyiYFurgKwR6Up2NDUPdnKWAjTlx/5P4GsvXlRGMK5cJpUDWDitfBvkXTVJTP 7CzOYfUfe2I6L+YJIY8oCOmBT2rij2R+/q8YvBsuVif8hRuZJT91ilRNp7aaHbSAZr iE3spA8thxaVirbVt26JtpFOuIG2rMFYPpgA0hikZgv2KBXjdLJ0uVDMHvJvGHENTZ zcrT/yXXNrpiA== 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 1/5] serial: 8250: extract serial8250_init_mctrl() Date: Mon, 23 Jun 2025 09:46:02 +0200 Message-ID: <20250623074606.456532-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250623074606.456532-1-jirislaby@kernel.org> References: <20250623074606.456532-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 --- drivers/tty/serial/8250/8250_port.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 48c30e158cb8..ca82ce26715a 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2216,6 +2216,23 @@ static void serial8250_THRE_test(struct uart_port *port) up->bugs |= UART_BUG_THRE; } +static void serial8250_init_mctrl(struct uart_port *port) +{ + struct uart_8250_port *up = up_to_u8250p(port); + + if (up->port.flags & UPF_FOURPORT) { + if (!up->port.irq) + up->port.mctrl |= TIOCM_OUT1; + } else + /* + * Most PC uarts need OUT2 raised to enable interrupts. + */ + if (port->irq) + up->port.mctrl |= TIOCM_OUT2; + + serial8250_set_mctrl(port, port->mctrl); +} + static void serial8250_initialize(struct uart_port *port) { struct uart_8250_port *up = up_to_u8250p(port); @@ -2225,16 +2242,7 @@ static void serial8250_initialize(struct uart_port *port) 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; - } else { - /* Most PC uarts need OUT2 raised to enable interrupts. */ - if (port->irq) - port->mctrl |= TIOCM_OUT2; - } - - serial8250_set_mctrl(port, port->mctrl); + serial8250_init_mctrl(port); /* * Serial over Lan (SoL) hack: From patchwork Mon Jun 23 07:46:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899678 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 A4CC71F416C; Mon, 23 Jun 2025 07:46:12 +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=1750664772; cv=none; b=TIWo5Shfi1DuVp0HmrznmKSD+uWyP+2lr/51lskrVu3831s1/2MXcd9z9M48BiygfdSxSP+y+Kgn6A23GB5+9i5VUH+TE+5ytc9q/eMd97K2LxaI3rzxCOJwhQDlqXRBJOl/HnI4iznz5e79ufwV7Y3qLyYun41WQLvMXeNc3IA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750664772; c=relaxed/simple; bh=ZnV7znpD2ocTdeYohSYU9ZU52h1QVnyZ0yB7lLjcdyw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NLEhT+eAR6lBJfDOJDxpAYzBCn7IFQP/e6b05dM50XiNNmB0WTfopS7Nk8F7j+d8njIz9dM9lW/Dq5bU5+dYIQjPVdhLMfBjEcHsaKbcLgk8OWh4Nm5jIvugNmof1xM78Ndmqv2j2kbKSGl+EGgAyKQrgjOsabSy9UkGaioZ0js= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ejh4Msyh; 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="ejh4Msyh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11DA7C4CEF2; Mon, 23 Jun 2025 07:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750664772; bh=ZnV7znpD2ocTdeYohSYU9ZU52h1QVnyZ0yB7lLjcdyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejh4Msyhb0i90JH/nBKT4I+U4nHF3A6OX3faAjZozFN8qf+PNCptHmhVg1J8TNgZ+ VCER9fQNrgsixQnSKKDk9cdzEnJRa2/3Rcs1InvhP1Uxo2hWr9HErvXB09m8eTiScT UnKQMlR/VQ8uFSTG7vQ0w8Zd6ozxW0WLDgSgbJz7u9XI3m/xJC6olZlSeUyjsvJRrJ KEmbS9iEafT/hHz70GeGSqYn5YuPqIltghndfhC442bpwHxV81+eTDcG6leOUuiRxD EJZvftm1ewNou0H/QpBRZBsVdOPuN64jZy3gRkUiK2NurGwQdAMPtNBNngz888HFIW cr7bNvldiMiKQ== 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 2/5] serial: 8250: extract serial8250_iir_txen_test() Date: Mon, 23 Jun 2025 09:46:03 +0200 Message-ID: <20250623074606.456532-3-jirislaby@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250623074606.456532-1-jirislaby@kernel.org> References: <20250623074606.456532-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 TX enable test part of this code can be separated into serial8250_iir_txen_test(). Signed-off-by: Jiri Slaby (SUSE) Suggested-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 49 ++++++++++++++++------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index ca82ce26715a..584563c45424 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2233,16 +2233,19 @@ static void serial8250_init_mctrl(struct uart_port *port) serial8250_set_mctrl(port, port->mctrl); } -static void serial8250_initialize(struct uart_port *port) +static void serial8250_iir_txen_test(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); + if (port->quirks & UPQ_NO_TXEN_TEST) + return; - uart_port_lock_irqsave(port, &flags); - serial8250_init_mctrl(port); + /* 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; + serial_port_out(port, UART_IER, 0); /* * Serial over Lan (SoL) hack: @@ -2250,26 +2253,30 @@ static void serial8250_initialize(struct uart_port *port) * Lan. Those chips take a longer time than a normal serial device to signalize that a * transmission data was queued. Due to that, the above test generally fails. One solution * would be to delay the reading of iir. However, this is not reliable, since the timeout is - * variable. So, let's just don't test if we receive TX irq. This way, we'll never enable - * UART_BUG_TXEN. + * 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 (!(port->quirks & UPQ_NO_TXEN_TEST)) { - /* 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; - serial_port_out(port, UART_IER, 0); - - 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"); - } - } else { - up->bugs &= ~UART_BUG_TXEN; + 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"); } + return; } + /* FIXME: why is this needed? */ + up->bugs &= ~UART_BUG_TXEN; +} + +static void serial8250_initialize(struct uart_port *port) +{ + unsigned long flags; + + serial_port_out(port, UART_LCR, UART_LCR_WLEN8); + + uart_port_lock_irqsave(port, &flags); + serial8250_init_mctrl(port); + serial8250_iir_txen_test(port); uart_port_unlock_irqrestore(port, flags); } From patchwork Mon Jun 23 07:46:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899426 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 5936121765E; Mon, 23 Jun 2025 07:46:14 +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=1750664774; cv=none; b=iG+zXQhZ9SWdNLo88Pnw6oJsZscJiEHm8f2Xzy+R9blJ3aZqdc9AWRLLcxCbRspcXV9DQ2cSYssMf54Ol00SdqLngRFxijasUJbF4EYknY+KF7NjvLe3lGpzJoy0A0EQ6GMHHb0d8o6v67V+9ysOTlkvTxiogdvwr0cklhgAz00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750664774; c=relaxed/simple; bh=Ha3d6EU+LDV8//CrsuOIY0ka7VTKRN1AMCeo/OLzfXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SuaShGdva5q8yxiR0/ep5VkC4+K1T58aadL1x57IOof6Hq3Zkvzjjb0llkF7Yq5n2GePVjVcH4rQH+anQkcjs1DRwJ47AAGr4rss6WGF1Q2Eww/9G7LWPKAAzPY0BB3GyfNXpat13pvwmVqAwrPJ5Xz1ZUy7FwbdTlVrzNxixNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EBiEwCSB; 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="EBiEwCSB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B318DC4CEF1; Mon, 23 Jun 2025 07:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750664773; bh=Ha3d6EU+LDV8//CrsuOIY0ka7VTKRN1AMCeo/OLzfXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EBiEwCSBhpEIDigOflulIbx5UFxYA6mn32of2lHlOC8emMq6LcnardFJWQPgev02y LL2HENdK0xnNxjvsUScqjI+w8L0RGGKVl24OIL8+SLuT5IVWSRSciawQZ02Vb8+jaJ DjvFBxE9SdcoMac/ghGcNfBOAoW5PIugXRzG/j+z9dJkQ7G4En+Rks6Dzz/enk4XUy G/F321QOLcBZmeO60JH41OEaLW1GM46wKdL21mQjhzk2vgsgojT7TV4oHP1G0ntekt yU6Z9Qs+VuHUpPoPc2yV/i+oEE1/IDQK91jNgAdNsVsLbqj677132V4Zxg+Zes8WuN kifL1+0Fa/VWA== 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 3/5] serial: 8250: rename lsr_TEMT, iir_NOINT to lowercase Date: Mon, 23 Jun 2025 09:46:04 +0200 Message-ID: <20250623074606.456532-4-jirislaby@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250623074606.456532-1-jirislaby@kernel.org> References: <20250623074606.456532-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 584563c45424..f67b206d1676 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2236,15 +2236,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); /* @@ -2256,7 +2256,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 Mon Jun 23 07:46:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899677 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 416CA21B9C8; Mon, 23 Jun 2025 07:46:15 +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=1750664776; cv=none; b=oUHnq7CB/ERMxMUH9nyNbCamVIQmftqUxN53jr2qYCQHtr0lSWxHGxSL+7zvoRa1dEv84S2DR0A1JuY8pNCohMG/WYGISY6xUzKPWsk6JF/ua3Crarta3Ujg0y3ISyU6OLXs/IuFusLwmUONGk6dsaGMUIKbtpNIhat99N6r5JM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750664776; c=relaxed/simple; bh=smpKSO6O9D81D3q6N5YAOrgecS7Nl7xNAoJ7zHJtccI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UV9PsxIyzqUIKkAICbBb6XHoECY8iMZX/AKMIzyqnjD9eTL/EHxB1xW9N2wEFz58LH9MF2XsA3aiLIhGAUdCLjPDGUm9BztANOJzNp14NvyslxA/qZ3agS1SeMbdUt60RkQbJGeK46PBtsExxLHvxc3L+yFMOAsnB+WyExjRCcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wis3Uiic; 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="Wis3Uiic" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61A3AC4CEED; Mon, 23 Jun 2025 07:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750664775; bh=smpKSO6O9D81D3q6N5YAOrgecS7Nl7xNAoJ7zHJtccI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wis3UiiclxSQdffgfqsnVlk2ELRucQmBF4WJ/dezNyPE/Yt6ne0HSvYJcU1C97JDf bVa/4Bh3eXgY4tEkK1vCBEbcH4PviDpofxFCwrWQjuai9i+dikL0cGjtE8pvMLJxB5 FaFF1A81FMcJfa3rdenQqXlStObwGMHLvYcXmEm9kiXsWU7dJ+WU/WbBAw4sjkFlVO /w3QP7dyMPq5Wuyw1XCEDQNVTvW1YSCiufj6GI2OYgtESYNPwVElDKKtroi1ITiwca ADRfTUtRCHjM+Bs/pE0CGqbi10XUv5WMe9LbzuVYSrwL2LGP9o7HBGJzpgrl3IUyMY SJxofE9FSeVDw== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Andy Shevchenko , "Maciej S. Szmigiero" Subject: [PATCH 4/5] serial: 8250: document doubled "type == PORT_8250_CIR" check Date: Mon, 23 Jun 2025 09:46:05 +0200 Message-ID: <20250623074606.456532-5-jirislaby@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250623074606.456532-1-jirislaby@kernel.org> References: <20250623074606.456532-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 check for "port.type == PORT_8250_CIR" is present twice in serial8250_register_8250_port(). The latter was already tried to be dropped by 1104321a7b3b ("serial: Delete dead code for CIR serial ports") and then reverted by 9527b82ae3af ("Revert "serial: Delete dead code for CIR serial ports""). Document this weirdness with a reason. Signed-off-by: Jiri Slaby (SUSE) Suggested-by: Andy Shevchenko Cc: Maciej S. Szmigiero Link: https://lore.kernel.org/all/aFcDOx1bdB34I5hS@surfacebook.localdomain/ --- drivers/tty/serial/8250/8250_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index a6ecb8575da4..feb920c5b2e8 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -717,6 +717,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) nr_uarts++; } + /* Check if it is CIR already. We check this below again, see there why. */ if (uart->port.type == PORT_8250_CIR) { ret = -ENODEV; goto unlock; @@ -815,6 +816,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) if (up->dl_write) uart->dl_write = up->dl_write; + /* Check the type (again)! It might have changed by the port.type assignment above. */ if (uart->port.type != PORT_8250_CIR) { if (uart_console_registered(&uart->port)) pm_runtime_get_sync(uart->port.dev); From patchwork Mon Jun 23 07:46:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 899425 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 3A0A8376; Mon, 23 Jun 2025 07:46:17 +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=1750664778; cv=none; b=fRyxFeUnFlkl11vPcjZX7TPxUnS3h0IYw9H3xfp5Vqi4ZFNkUHwhW4RuFcgMh9WR0GRvjubP3E7KB8CcmlM0gWI/wbkRHE93aHNTL2UavuGl1LSer/DCJFazd82XiBIwcj0e4tPQTUOsigtYrKquX8dboav/+AKiO5nyC5i1Ye8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750664778; c=relaxed/simple; bh=+Uu7ZDBV8otT4ly3/z72aeMoH2gzzQm99pYq+sIxM2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F93B18YQB6aI/MMa68IFkR0yvy4moSNGunejaeCeMSEH8m3gTcY+0mjLi7qcOu4ob5t1Kokdo6kRgQP8bU/Cru5LIk8fS6uSaUrZssDndLSOLSFgB85QnVLZBr6vSqtSm7H9MiDjvs+hnhAzops8oRweN/WRfTpQKRWKOcji4NI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YaTiHsmx; 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="YaTiHsmx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A964C4CEF1; Mon, 23 Jun 2025 07:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750664777; bh=+Uu7ZDBV8otT4ly3/z72aeMoH2gzzQm99pYq+sIxM2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YaTiHsmx9fcU1jHFGTUE/P7l3uItgMpvwlksKjUK53q1DIR4RLx3wMKNmRozrrruh kaVvWaOA0dUwrWOAfsrKQ8u+SShD72545UAh7cJNWDEI9KlJ19fctj26riZvz6dd3j 8eZMzSAQ1WtC+ZrCF+l/JA5EHP2ZhyqS6Al4tEb5IUooUo49FwEABwK04ZSCFvksp8 fyJlgW1iyyVhgZEgvtD2WcVMop7HBcjKfQrxXXI7FcHBH6Vxpvv/tBD4bf5bR6hxZP Ny3zUE2QLzOX6G8Ht4fQTWzUKIjKrD6PIUm7mzzM3GsBtg0axOO9fjjIYa9aln1Tou gmsqITgESetxQ== 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 5/5] tty: fix tty_port_tty_*hangup() kernel-doc Date: Mon, 23 Jun 2025 09:46:06 +0200 Message-ID: <20250623074606.456532-6-jirislaby@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250623074606.456532-1-jirislaby@kernel.org> References: <20250623074606.456532-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);