You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/09/21 12:31:11 UTC
[nuttx] 02/02: arch/nrf{52|53|91}/serial: fix serial registration when ther is no console on serial
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit dafa4e4413b4bc336171b5f2c6cab642ce9040f6
Author: raiden00pl <ra...@railab.me>
AuthorDate: Wed Sep 20 19:33:13 2023 +0200
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;
}