Skip to content

Commit efa6b0a

Browse files
andy-shevgregkh
authored andcommitted
serial: 8250_platform: Explicitly show we initialise ISA ports only once
serial8250_isa_init_ports() uses home grown approach to make itself a singleton. Instead, explicitly show that we initialise ISA ports once by providing a helper function which calls the original function via DO_ONCE() macro. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f0a1748 commit efa6b0a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/array_size.h>
1010
#include <linux/module.h>
1111
#include <linux/moduleparam.h>
12+
#include <linux/once.h>
1213
#include <linux/platform_device.h>
1314

1415
#include <linux/serial_8250.h>
@@ -53,15 +54,10 @@ void serial8250_set_isa_configurator(serial8250_isa_config_fn v)
5354
}
5455
EXPORT_SYMBOL(serial8250_set_isa_configurator);
5556

56-
void __init serial8250_isa_init_ports(void)
57+
static void __init __serial8250_isa_init_ports(void)
5758
{
58-
static int first = 1;
5959
int i, irqflag = 0;
6060

61-
if (!first)
62-
return;
63-
first = 0;
64-
6561
if (nr_uarts > UART_NR)
6662
nr_uarts = UART_NR;
6763

@@ -102,6 +98,11 @@ void __init serial8250_isa_init_ports(void)
10298
}
10399
}
104100

101+
void __init serial8250_isa_init_ports(void)
102+
{
103+
DO_ONCE(__serial8250_isa_init_ports);
104+
}
105+
105106
/*
106107
* Register a set of serial devices attached to a platform device. The
107108
* list is terminated with a zero flags entry, which means we expect

0 commit comments

Comments
 (0)