Skip to content

Commit dafa4e4

Browse files
raiden00plxiaoxiang781216
authored andcommitted
arch/nrf{52|53|91}/serial: fix serial registration when ther is no console on serial
1 parent f0155b9 commit dafa4e4

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

arch/arm/src/nrf52/nrf52_serial.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#ifdef CONFIG_UART0_SERIAL_CONSOLE
8787
# define CONSOLE_DEV g_uart0port /* UART0 is console */
8888
# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
89-
#elif CONFIG_UART1_SERIAL_CONSOLE
89+
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
9090
# define CONSOLE_DEV g_uart1port /* UART1 is console */
9191
# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
9292
#endif
@@ -773,10 +773,9 @@ void arm_serialinit(void)
773773
/* Register the serial console */
774774

775775
uart_register("/dev/console", &CONSOLE_DEV);
776-
#endif
777-
778776
uart_register("/dev/ttyS0", &TTYS0_DEV);
779777
minor = 1;
778+
#endif
780779

781780
/* Register all remaining UARTs */
782781

@@ -786,7 +785,7 @@ void arm_serialinit(void)
786785
{
787786
/* Don't create a device for non-configured ports. */
788787

789-
if (g_uart_devs[i] == 0)
788+
if (g_uart_devs[i] == NULL)
790789
{
791790
continue;
792791
}

arch/arm/src/nrf53/nrf53_serial.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#ifdef CONFIG_UART0_SERIAL_CONSOLE
8787
# define CONSOLE_DEV g_uart0port /* UART0 is console */
8888
# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
89-
#elif CONFIG_UART1_SERIAL_CONSOLE
89+
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
9090
# define CONSOLE_DEV g_uart1port /* UART1 is console */
9191
# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
9292
#endif
@@ -773,10 +773,9 @@ void arm_serialinit(void)
773773
/* Register the serial console */
774774

775775
uart_register("/dev/console", &CONSOLE_DEV);
776-
#endif
777-
778776
uart_register("/dev/ttyS0", &TTYS0_DEV);
779777
minor = 1;
778+
#endif
780779

781780
/* Register all remaining UARTs */
782781

@@ -786,7 +785,7 @@ void arm_serialinit(void)
786785
{
787786
/* Don't create a device for non-configured ports. */
788787

789-
if (g_uart_devs[i] == 0)
788+
if (g_uart_devs[i] == NULL)
790789
{
791790
continue;
792791
}

arch/arm/src/nrf91/nrf91_serial.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#ifdef CONFIG_UART0_SERIAL_CONSOLE
8787
# define CONSOLE_DEV g_uart0port /* UART0 is console */
8888
# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
89-
#elif CONFIG_UART1_SERIAL_CONSOLE
89+
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
9090
# define CONSOLE_DEV g_uart1port /* UART1 is console */
9191
# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
9292
#endif
@@ -773,10 +773,9 @@ void arm_serialinit(void)
773773
/* Register the serial console */
774774

775775
uart_register("/dev/console", &CONSOLE_DEV);
776-
#endif
777-
778776
uart_register("/dev/ttyS0", &TTYS0_DEV);
779777
minor = 1;
778+
#endif
780779

781780
/* Register all remaining UARTs */
782781

@@ -786,7 +785,7 @@ void arm_serialinit(void)
786785
{
787786
/* Don't create a device for non-configured ports. */
788787

789-
if (g_uart_devs[i] == 0)
788+
if (g_uart_devs[i] == NULL)
790789
{
791790
continue;
792791
}

0 commit comments

Comments
 (0)