From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Subject: [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once
Date: Thu, 6 Jun 2024 21:48:41 +0300 [thread overview]
Message-ID: <20240606184841.3102545-1-andriy.shevchenko@linux.intel.com> (raw)
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@linux.intel.com>
---
drivers/tty/serial/8250/8250_platform.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c
index ded985182e04..5817c1d72314 100644
--- a/drivers/tty/serial/8250/8250_platform.c
+++ b/drivers/tty/serial/8250/8250_platform.c
@@ -9,6 +9,7 @@
#include <linux/array_size.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/once.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
@@ -53,15 +54,10 @@ void serial8250_set_isa_configurator(serial8250_isa_config_fn v)
}
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;
- if (!first)
- return;
- first = 0;
-
if (nr_uarts > UART_NR)
nr_uarts = UART_NR;
@@ -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
* list is terminated with a zero flags entry, which means we expect
--
2.43.0.rc1.1336.g36b5255a03ac
next reply other threads:[~2024-06-06 18:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 18:48 Andy Shevchenko [this message]
2024-06-07 13:48 ` [PATCH v1 1/1] serial: 8250_platform: Explicitly show we initialise ISA ports only once kernel test robot
2024-06-11 15:55 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240606184841.3102545-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox