From dafa4e4413b4bc336171b5f2c6cab642ce9040f6 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 20 Sep 2023 19:33:13 +0200 Subject: [PATCH] arch/nrf{52|53|91}/serial: fix serial registration when ther is no console on serial --- arch/arm/src/nrf52/nrf52_serial.c | 7 +++---- arch/arm/src/nrf53/nrf53_serial.c | 7 +++---- arch/arm/src/nrf91/nrf91_serial.c | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/arm/src/nrf52/nrf52_serial.c b/arch/arm/src/nrf52/nrf52_serial.c index ab242e77a0..6d3ef94e11 100644 --- a/arch/arm/src/nrf52/nrf52_serial.c +++ b/arch/arm/src/nrf52/nrf52_serial.c @@ -86,7 +86,7 @@ #ifdef CONFIG_UART0_SERIAL_CONSOLE # define CONSOLE_DEV g_uart0port /* UART0 is console */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ -#elif CONFIG_UART1_SERIAL_CONSOLE +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart1port /* UART1 is console */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ #endif @@ -773,10 +773,9 @@ void arm_serialinit(void) /* Register the serial console */ uart_register("/dev/console", &CONSOLE_DEV); -#endif - uart_register("/dev/ttyS0", &TTYS0_DEV); minor = 1; +#endif /* Register all remaining UARTs */ @@ -786,7 +785,7 @@ void arm_serialinit(void) { /* Don't create a device for non-configured ports. */ - if (g_uart_devs[i] == 0) + if (g_uart_devs[i] == NULL) { continue; } diff --git a/arch/arm/src/nrf53/nrf53_serial.c b/arch/arm/src/nrf53/nrf53_serial.c index d9b41e63cc..8487e75d97 100644 --- a/arch/arm/src/nrf53/nrf53_serial.c +++ b/arch/arm/src/nrf53/nrf53_serial.c @@ -86,7 +86,7 @@ #ifdef CONFIG_UART0_SERIAL_CONSOLE # define CONSOLE_DEV g_uart0port /* UART0 is console */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ -#elif CONFIG_UART1_SERIAL_CONSOLE +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart1port /* UART1 is console */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ #endif @@ -773,10 +773,9 @@ void arm_serialinit(void) /* Register the serial console */ uart_register("/dev/console", &CONSOLE_DEV); -#endif - uart_register("/dev/ttyS0", &TTYS0_DEV); minor = 1; +#endif /* Register all remaining UARTs */ @@ -786,7 +785,7 @@ void arm_serialinit(void) { /* Don't create a device for non-configured ports. */ - if (g_uart_devs[i] == 0) + if (g_uart_devs[i] == NULL) { continue; } diff --git a/arch/arm/src/nrf91/nrf91_serial.c b/arch/arm/src/nrf91/nrf91_serial.c index 1495696d0b..bdedf73e4a 100644 --- a/arch/arm/src/nrf91/nrf91_serial.c +++ b/arch/arm/src/nrf91/nrf91_serial.c @@ -86,7 +86,7 @@ #ifdef CONFIG_UART0_SERIAL_CONSOLE # define CONSOLE_DEV g_uart0port /* UART0 is console */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ -#elif CONFIG_UART1_SERIAL_CONSOLE +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart1port /* UART1 is console */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ #endif @@ -773,10 +773,9 @@ void arm_serialinit(void) /* Register the serial console */ uart_register("/dev/console", &CONSOLE_DEV); -#endif - uart_register("/dev/ttyS0", &TTYS0_DEV); minor = 1; +#endif /* Register all remaining UARTs */ @@ -786,7 +785,7 @@ void arm_serialinit(void) { /* Don't create a device for non-configured ports. */ - if (g_uart_devs[i] == 0) + if (g_uart_devs[i] == NULL) { continue; }