From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Subject: [PATCH 6/6] serial: 8250_platform: simplify IRQF_SHARED handling
Date: Wed, 19 Nov 2025 10:24:57 +0100 [thread overview]
Message-ID: <20251119092457.826789-7-jirislaby@kernel.org> (raw)
In-Reply-To: <20251119092457.826789-1-jirislaby@kernel.org>
IRQF_SHARED is the only flag handled in __serial8250_isa_init_ports()
and serial8250_probe_platform(). There is no need to precompute the
flags. Instead, initialize port->irqflags directly in the for loop.
Note the "if (bool)" is cheap and these are not hot paths anyway.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/serial/8250/8250_platform.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c
index 4c1166a46a1f..af16a36193bf 100644
--- a/drivers/tty/serial/8250/8250_platform.c
+++ b/drivers/tty/serial/8250/8250_platform.c
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(serial8250_set_isa_configurator);
static void __init __serial8250_isa_init_ports(void)
{
- int i, irqflag = 0;
+ int i;
if (nr_uarts > UART_NR)
nr_uarts = UART_NR;
@@ -75,9 +75,6 @@ static void __init __serial8250_isa_init_ports(void)
univ8250_port_ops = *univ8250_port_base_ops;
univ8250_rsa_support(&univ8250_port_ops);
- if (share_irqs)
- irqflag = IRQF_SHARED;
-
for (i = 0; i < ARRAY_SIZE(old_serial_port) && i < nr_uarts; i++) {
struct uart_8250_port *up = serial8250_get_port(i);
struct uart_port *port = &up->port;
@@ -92,7 +89,9 @@ static void __init __serial8250_isa_init_ports(void)
port->iotype = old_serial_port[i].io_type;
port->regshift = old_serial_port[i].iomem_reg_shift;
- port->irqflags |= irqflag;
+ if (share_irqs)
+ port->irqflags |= IRQF_SHARED;
+
if (serial8250_isa_config != NULL)
serial8250_isa_config(i, &up->port, &up->capabilities);
}
@@ -155,15 +154,12 @@ static int serial8250_probe_acpi(struct platform_device *pdev)
static int serial8250_probe_platform(struct platform_device *dev, struct plat_serial8250_port *p)
{
- int ret, i, irqflag = 0;
+ int ret, i;
struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL);
if (!uart)
return -ENOMEM;
- if (share_irqs)
- irqflag = IRQF_SHARED;
-
for (i = 0; p && p->flags != 0; p++, i++) {
uart->port.iobase = p->iobase;
uart->port.membase = p->membase;
@@ -191,7 +187,10 @@ static int serial8250_probe_platform(struct platform_device *dev, struct plat_se
uart->port.get_mctrl = p->get_mctrl;
uart->port.pm = p->pm;
uart->port.dev = &dev->dev;
- uart->port.irqflags |= irqflag;
+
+ if (share_irqs)
+ uart->port.irqflags |= IRQF_SHARED;
+
ret = serial8250_register_8250_port(uart);
if (ret < 0) {
dev_err(&dev->dev, "unable to register port at index %d "
--
2.51.1
prev parent reply other threads:[~2025-11-19 9:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 9:24 [PATCH 0/6] tty cleanup for 6.19 or later Jiri Slaby (SUSE)
2025-11-19 9:24 ` [PATCH 1/6] tty: vt: do not open code DIV_ROUND_UP() Jiri Slaby (SUSE)
2025-11-19 9:24 ` [PATCH 2/6] serial: xilinx_uartps: drop cdns_uart::cdns_uart_driver Jiri Slaby (SUSE)
2025-11-20 7:30 ` Michal Simek
2025-11-19 9:24 ` [PATCH 3/6] serial: drop SERIAL_8250_DEPRECATED_OPTIONS Jiri Slaby (SUSE)
2025-11-19 9:24 ` [PATCH 4/6] serial: 8250: move skip_txen_test to core Jiri Slaby (SUSE)
2025-11-19 9:24 ` [PATCH 5/6] serial: 8250: make share_irqs local to 8250_platform Jiri Slaby (SUSE)
2025-11-19 9:24 ` Jiri Slaby (SUSE) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251119092457.826789-7-jirislaby@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®