From 882962599e526a84ed3ea1242c5bba649a88aaea Mon Sep 17 00:00:00 2001 From: Heesub Shin Date: Wed, 26 Apr 2017 21:13:08 +0900 Subject: [PATCH] s5j/serial: fix compilation errors when UARTs are disabled When CONFIG_S5J_UARTx is not set, compiler complains as following: CC: chip/s5j_serial.c chip/s5j_serial.c: In function 'up_setup': chip/s5j_serial.c:1016:12: error: 'g_uart0priv' undeclared (first use in this function) priv = &g_uart0priv; ^ chip/s5j_serial.c:1016:12: note: each undeclared identifier is reported only once for each function it appears in chip/s5j_serial.c:1019:12: error: 'g_uart1priv' undeclared (first use in this function) priv = &g_uart1priv; ^ chip/s5j_serial.c:1022:12: error: 'g_uart2priv' undeclared (first use in this function) priv = &g_uart2priv; ^ chip/s5j_serial.c:1025:12: error: 'g_uart3priv' undeclared (first use in this function) priv = &g_uart3priv; ^ Makefile:175: recipe for target 's5j_serial.o' failed make[1]: *** [s5j_serial.o] Error 1 This commit fixes this. Change-Id: Ifd56c89547071e1a96765e32cea984ac7234d181 Signed-off-by: Heesub Shin --- os/arch/arm/src/s5j/s5j_serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/os/arch/arm/src/s5j/s5j_serial.c b/os/arch/arm/src/s5j/s5j_serial.c index 2fa39cb..733debe 100644 --- a/os/arch/arm/src/s5j/s5j_serial.c +++ b/os/arch/arm/src/s5j/s5j_serial.c @@ -1012,22 +1012,32 @@ static int up_setup(struct uart_dev_s *dev) /* Initialize UART */ switch (priv->eCh) { +#ifdef CONFIG_S5J_UART0 case UART0: priv = &g_uart0priv; break; +#endif +#ifdef CONFIG_S5J_UART1 case UART1: priv = &g_uart1priv; break; +#endif +#ifdef CONFIG_S5J_UART2 case UART2: priv = &g_uart2priv; break; +#endif +#ifdef CONFIG_S5J_UART3 case UART3: priv = &g_uart3priv; break; +#endif +#ifdef CONFIG_S5J_UARTDBG case UARTDBG: default: priv = &g_uartdbgpriv; break; +#endif } /* wait until every characters from earlier stage bootloader get out */ -- 2.7.4