Skip to content

Commit da21840

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
serial: 8250_platform: simplify IRQF_SHARED handling
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> Link: https://patch.msgid.link/20251119092457.826789-7-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f9066da commit da21840

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

drivers/tty/serial/8250/8250_platform.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(serial8250_set_isa_configurator);
5858

5959
static void __init __serial8250_isa_init_ports(void)
6060
{
61-
int i, irqflag = 0;
61+
int i;
6262

6363
if (nr_uarts > UART_NR)
6464
nr_uarts = UART_NR;
@@ -75,9 +75,6 @@ static void __init __serial8250_isa_init_ports(void)
7575
univ8250_port_ops = *univ8250_port_base_ops;
7676
univ8250_rsa_support(&univ8250_port_ops);
7777

78-
if (share_irqs)
79-
irqflag = IRQF_SHARED;
80-
8178
for (i = 0; i < ARRAY_SIZE(old_serial_port) && i < nr_uarts; i++) {
8279
struct uart_8250_port *up = serial8250_get_port(i);
8380
struct uart_port *port = &up->port;
@@ -92,7 +89,9 @@ static void __init __serial8250_isa_init_ports(void)
9289
port->iotype = old_serial_port[i].io_type;
9390
port->regshift = old_serial_port[i].iomem_reg_shift;
9491

95-
port->irqflags |= irqflag;
92+
if (share_irqs)
93+
port->irqflags |= IRQF_SHARED;
94+
9695
if (serial8250_isa_config != NULL)
9796
serial8250_isa_config(i, &up->port, &up->capabilities);
9897
}
@@ -155,15 +154,12 @@ static int serial8250_probe_acpi(struct platform_device *pdev)
155154

156155
static int serial8250_probe_platform(struct platform_device *dev, struct plat_serial8250_port *p)
157156
{
158-
int ret, i, irqflag = 0;
157+
int ret, i;
159158

160159
struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL);
161160
if (!uart)
162161
return -ENOMEM;
163162

164-
if (share_irqs)
165-
irqflag = IRQF_SHARED;
166-
167163
for (i = 0; p && p->flags != 0; p++, i++) {
168164
uart->port.iobase = p->iobase;
169165
uart->port.membase = p->membase;
@@ -191,7 +187,10 @@ static int serial8250_probe_platform(struct platform_device *dev, struct plat_se
191187
uart->port.get_mctrl = p->get_mctrl;
192188
uart->port.pm = p->pm;
193189
uart->port.dev = &dev->dev;
194-
uart->port.irqflags |= irqflag;
190+
191+
if (share_irqs)
192+
uart->port.irqflags |= IRQF_SHARED;
193+
195194
ret = serial8250_register_8250_port(uart);
196195
if (ret < 0) {
197196
dev_err(&dev->dev, "unable to register port at index %d "

0 commit comments

Comments
 (0)