This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 02dc6fa219 stm32_serial.c: fix compilation of onewire driver mode
02dc6fa219 is described below

commit 02dc6fa219899d4c140ab40042421dd8799ef122
Author: Michał Łyszczek <michal.lyszc...@bofc.pl>
AuthorDate: Tue Mar 12 10:42:42 2024 +0100

    stm32_serial.c: fix compilation of onewire driver mode
    
    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 <michal.lyszc...@bofc.pl>
---
 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 98888ff135..a198a795d2 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;

Reply via email to