On Fri, Jul 31, 2020 at 03:37:33PM +0300, Andy Shevchenko wrote: > 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 <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/tty/serial/8250/8250_core.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c > index cae61d1ebec5..9c0d6693f745 100644 > --- a/drivers/tty/serial/8250/8250_core.c > +++ b/drivers/tty/serial/8250/8250_core.c > @@ -22,6 +22,7 @@ > #include <linux/console.h> > #include <linux/sysrq.h> > #include <linux/delay.h> > +#include <linux/once.h> > #include <linux/platform_device.h> > #include <linux/tty.h> > #include <linux/ratelimit.h> > @@ -495,13 +496,8 @@ static inline void serial8250_apply_quirks(struct uart_8250_port *up) > static void __init serial8250_isa_init_ports(void) > { > struct uart_8250_port *up; > - static int first = 1; > int i, irqflag = 0; > > - if (!first) > - return; > - first = 0; > - > if (nr_uarts > UART_NR) > nr_uarts = UART_NR; > > @@ -555,6 +551,11 @@ static void __init serial8250_isa_init_ports(void) > } > } > > +static void __init serial8250_isa_init_ports_once(void) > +{ > + DO_ONCE(serial8250_isa_init_ports); DO_ONCE() is there for fast-path code, where the code is then patched out of the kernel after it is run. That's not the case here and is not needed, please just do this "normally". thanks, greg k-h