mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] serial: ns16550: fall back to using uart8250/ttyS as Linux console names
@ 2026-05-19  5:53 Ahmad Fatoum
  2026-05-21 11:41 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2026-05-19  5:53 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Most Linux drivers use the same names, so make them the default and only
list differing ones in the different ns16550_drvdata.

This also ensures, we don't end up with <NULL> formatted into the kernel
command-line by mistake.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Unlike [1], which is for the next release, this one is meant for next to
avoid such issues in future altogether.

[1]: https://lore.barebox.org/barebox/20260519053350.4061870-1-a.fatoum@pengutronix.de/T/#u
---
 drivers/serial/serial_ns16550.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 31e7c006d004..72bf8e464759 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -390,21 +390,15 @@ static void ns16550_probe_dt(struct device *dev, struct ns16550_priv *priv)
 
 static struct ns16550_drvdata ns16450_drvdata = {
 	.init_port = ns16450_serial_init_port,
-	.linux_console_name = "ttyS",
-	.linux_earlycon_name = "uart8250",
 };
 
 static struct ns16550_drvdata ns16550_drvdata = {
 	.init_port = ns16550_serial_init_port,
-	.linux_console_name = "ttyS",
-	.linux_earlycon_name = "uart8250",
 };
 
 static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 	.init_port = ns16550_omap_init_port,
-#ifdef CONFIG_DRIVER_SERIAL_NS16550_OMAP_TTYS
-	.linux_console_name = "ttyS",
-#else
+#ifndef CONFIG_DRIVER_SERIAL_NS16550_OMAP_TTYS
 	.linux_console_name = "ttyO",
 #endif
 	.linux_earlycon_name = "omap8250",
@@ -412,20 +406,16 @@ static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 
 static __maybe_unused struct ns16550_drvdata omap_clk48m_drvdata = {
 	.init_port = ns16550_omap_init_port,
-	.linux_console_name = "ttyS",
-	.linux_earlycon_name = "uart8250",
 	.clk_default = 48000000,
 };
 
 static __maybe_unused struct ns16550_drvdata jz_drvdata = {
 	.init_port = ns16550_jz_init_port,
-	.linux_console_name = "ttyS",
 	.linux_earlycon_name = "jz4740_uart",
 };
 
 static __maybe_unused struct ns16550_drvdata rpi_drvdata = {
 	.init_port = rpi_init_port,
-	.linux_console_name = "ttyS",
 	.linux_earlycon_name = "bcm2835aux",
 };
 
@@ -510,6 +500,7 @@ static int ns16550_probe(struct device *dev)
 	struct NS16550_plat *plat = (struct NS16550_plat *)dev->platform_data;
 	const struct ns16550_drvdata *devtype;
 	struct resource *iores;
+	const char *linux_earlycon_name;
 	int ret;
 
 	devtype = device_get_match_data(dev) ?: &ns16550_drvdata;
@@ -550,8 +541,10 @@ static int ns16550_probe(struct device *dev)
 	cdev->getc = ns16550_getc;
 	cdev->setbrg = priv->plat.clock ? ns16550_setbaudrate : NULL;
 	cdev->flush = ns16550_flush;
-	cdev->linux_console_name = devtype->linux_console_name;
-	cdev->linux_earlycon_name = basprintf("%s,%s", devtype->linux_earlycon_name,
+	cdev->linux_console_name = devtype->linux_console_name ?: "ttyS";
+	linux_earlycon_name = devtype->linux_earlycon_name ?: "uart8250";
+
+	cdev->linux_earlycon_name = basprintf("%s,%s", linux_earlycon_name,
 					      priv->access_type);
 	cdev->phys_base = !strcmp(priv->access_type, "io") ?
 		IOMEM((ulong)priv->iobase) : priv->mmiobase;
-- 
2.47.3




^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] serial: ns16550: fall back to using uart8250/ttyS as Linux console names
@ 2026-05-20  6:09 Ahmad Fatoum
  0 siblings, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-05-20  6:09 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Most Linux drivers use the same names, so make them the default and only
list differing ones in the different ns16550_drvdata.

This also ensures, we don't end up with <NULL> formatted into the kernel
command-line by mistake.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/serial/serial_ns16550.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 31e7c006d004..72bf8e464759 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -390,21 +390,15 @@ static void ns16550_probe_dt(struct device *dev, struct ns16550_priv *priv)
 
 static struct ns16550_drvdata ns16450_drvdata = {
 	.init_port = ns16450_serial_init_port,
-	.linux_console_name = "ttyS",
-	.linux_earlycon_name = "uart8250",
 };
 
 static struct ns16550_drvdata ns16550_drvdata = {
 	.init_port = ns16550_serial_init_port,
-	.linux_console_name = "ttyS",
-	.linux_earlycon_name = "uart8250",
 };
 
 static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 	.init_port = ns16550_omap_init_port,
-#ifdef CONFIG_DRIVER_SERIAL_NS16550_OMAP_TTYS
-	.linux_console_name = "ttyS",
-#else
+#ifndef CONFIG_DRIVER_SERIAL_NS16550_OMAP_TTYS
 	.linux_console_name = "ttyO",
 #endif
 	.linux_earlycon_name = "omap8250",
@@ -412,20 +406,16 @@ static __maybe_unused struct ns16550_drvdata omap_drvdata = {
 
 static __maybe_unused struct ns16550_drvdata omap_clk48m_drvdata = {
 	.init_port = ns16550_omap_init_port,
-	.linux_console_name = "ttyS",
-	.linux_earlycon_name = "uart8250",
 	.clk_default = 48000000,
 };
 
 static __maybe_unused struct ns16550_drvdata jz_drvdata = {
 	.init_port = ns16550_jz_init_port,
-	.linux_console_name = "ttyS",
 	.linux_earlycon_name = "jz4740_uart",
 };
 
 static __maybe_unused struct ns16550_drvdata rpi_drvdata = {
 	.init_port = rpi_init_port,
-	.linux_console_name = "ttyS",
 	.linux_earlycon_name = "bcm2835aux",
 };
 
@@ -510,6 +500,7 @@ static int ns16550_probe(struct device *dev)
 	struct NS16550_plat *plat = (struct NS16550_plat *)dev->platform_data;
 	const struct ns16550_drvdata *devtype;
 	struct resource *iores;
+	const char *linux_earlycon_name;
 	int ret;
 
 	devtype = device_get_match_data(dev) ?: &ns16550_drvdata;
@@ -550,8 +541,10 @@ static int ns16550_probe(struct device *dev)
 	cdev->getc = ns16550_getc;
 	cdev->setbrg = priv->plat.clock ? ns16550_setbaudrate : NULL;
 	cdev->flush = ns16550_flush;
-	cdev->linux_console_name = devtype->linux_console_name;
-	cdev->linux_earlycon_name = basprintf("%s,%s", devtype->linux_earlycon_name,
+	cdev->linux_console_name = devtype->linux_console_name ?: "ttyS";
+	linux_earlycon_name = devtype->linux_earlycon_name ?: "uart8250";
+
+	cdev->linux_earlycon_name = basprintf("%s,%s", linux_earlycon_name,
 					      priv->access_type);
 	cdev->phys_base = !strcmp(priv->access_type, "io") ?
 		IOMEM((ulong)priv->iobase) : priv->mmiobase;
-- 
2.47.3




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-21 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-19  5:53 [PATCH] serial: ns16550: fall back to using uart8250/ttyS as Linux console names Ahmad Fatoum
2026-05-21 11:41 ` Sascha Hauer
2026-05-20  6:09 Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox