From 02dc6fa219899d4c140ab40042421dd8799ef122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= Date: Tue, 12 Mar 2024 10:42:42 +0100 Subject: [PATCH] stm32_serial.c: fix compilation of onewire driver mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Onewire driver wants to use "struct up_dev_s *priv", which is extracted from "struct uart_dev_s" and "struct inode". But inode and uart dev are only declared when TERMIOS or BSDCOMPAT is also enabled. Without these driver fails to compile with missing declaration errors. Adding some additional "#if defined()" to these declarations fix the issue and driver compiles and works properly (tested with ds18b20 temp sensor). Signed-off-by: Michał Łyszczek --- arch/arm/src/stm32/stm32_serial.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index 98888ff1353..a198a795d23 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -2227,11 +2227,14 @@ static int up_interrupt(int irq, void *context, void *arg) static int up_ioctl(struct file *filep, int cmd, unsigned long arg) { #if defined(CONFIG_SERIAL_TERMIOS) || defined(CONFIG_SERIAL_TIOCSERGSTRUCT) \ - || defined(CONFIG_STM32_SERIALBRK_BSDCOMPAT) + || defined(CONFIG_STM32_SERIALBRK_BSDCOMPAT) \ + || defined(CONFIG_STM32_USART_SINGLEWIRE) struct inode *inode = filep->f_inode; struct uart_dev_s *dev = inode->i_private; #endif -#if defined(CONFIG_SERIAL_TERMIOS) || defined(CONFIG_STM32_SERIALBRK_BSDCOMPAT) +#if defined(CONFIG_SERIAL_TERMIOS) \ + || defined(CONFIG_STM32_SERIALBRK_BSDCOMPAT) \ + || defined(CONFIG_STM32_USART_SINGLEWIRE) struct up_dev_s *priv = (struct up_dev_s *)dev->priv; #endif int ret = OK;