Commit efa6b0a1 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240606184841.3102545-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f0a17485
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/array_size.h> #include <linux/array_size.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/once.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
...@@ -53,15 +54,10 @@ void serial8250_set_isa_configurator(serial8250_isa_config_fn v) ...@@ -53,15 +54,10 @@ void serial8250_set_isa_configurator(serial8250_isa_config_fn v)
} }
EXPORT_SYMBOL(serial8250_set_isa_configurator); EXPORT_SYMBOL(serial8250_set_isa_configurator);
void __init serial8250_isa_init_ports(void) static void __init __serial8250_isa_init_ports(void)
{ {
static int first = 1;
int i, irqflag = 0; int i, irqflag = 0;
if (!first)
return;
first = 0;
if (nr_uarts > UART_NR) if (nr_uarts > UART_NR)
nr_uarts = UART_NR; nr_uarts = UART_NR;
...@@ -102,6 +98,11 @@ void __init serial8250_isa_init_ports(void) ...@@ -102,6 +98,11 @@ void __init serial8250_isa_init_ports(void)
} }
} }
void __init serial8250_isa_init_ports(void)
{
DO_ONCE(__serial8250_isa_init_ports);
}
/* /*
* Register a set of serial devices attached to a platform device. The * Register a set of serial devices attached to a platform device. The
* list is terminated with a zero flags entry, which means we expect * list is terminated with a zero flags entry, which means we expect
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment