Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
da218406 f9066dac

+9 -10
+9 -10
drivers/tty/serial/8250/8250_platform.c
··· 58 58 59 59 static void __init __serial8250_isa_init_ports(void) 60 60 { 61 - int i, irqflag = 0; 61 + int i; 62 62 63 63 if (nr_uarts > UART_NR) 64 64 nr_uarts = UART_NR; ··· 75 75 univ8250_port_ops = *univ8250_port_base_ops; 76 76 univ8250_rsa_support(&univ8250_port_ops); 77 77 78 - if (share_irqs) 79 - irqflag = IRQF_SHARED; 80 - 81 78 for (i = 0; i < ARRAY_SIZE(old_serial_port) && i < nr_uarts; i++) { 82 79 struct uart_8250_port *up = serial8250_get_port(i); 83 80 struct uart_port *port = &up->port; ··· 89 92 port->iotype = old_serial_port[i].io_type; 90 93 port->regshift = old_serial_port[i].iomem_reg_shift; 91 94 92 - port->irqflags |= irqflag; 95 + if (share_irqs) 96 + port->irqflags |= IRQF_SHARED; 97 + 93 98 if (serial8250_isa_config != NULL) 94 99 serial8250_isa_config(i, &up->port, &up->capabilities); 95 100 } ··· 154 155 155 156 static int serial8250_probe_platform(struct platform_device *dev, struct plat_serial8250_port *p) 156 157 { 157 - int ret, i, irqflag = 0; 158 + int ret, i; 158 159 159 160 struct uart_8250_port *uart __free(kfree) = kzalloc(sizeof(*uart), GFP_KERNEL); 160 161 if (!uart) 161 162 return -ENOMEM; 162 - 163 - if (share_irqs) 164 - irqflag = IRQF_SHARED; 165 163 166 164 for (i = 0; p && p->flags != 0; p++, i++) { 167 165 uart->port.iobase = p->iobase; ··· 187 191 uart->port.get_mctrl = p->get_mctrl; 188 192 uart->port.pm = p->pm; 189 193 uart->port.dev = &dev->dev; 190 - uart->port.irqflags |= irqflag; 194 + 195 + if (share_irqs) 196 + uart->port.irqflags |= IRQF_SHARED; 197 + 191 198 ret = serial8250_register_8250_port(uart); 192 199 if (ret < 0) { 193 200 dev_err(&dev->dev, "unable to register port at index %d "