[PATCH] config: Fix IO driver table initialization

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 16 16:06:27 UTC 2021


Check all IO driver table configuration options which are used to initialize
_IO_Driver_address_table[].  Checks for the following settings were missing:

* CONFIGURE_BSP_PREREQUISITE_DRIVERS

* CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS

* CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER

* CONFIGURE_APPLICATION_EXTRA_DRIVERS

Update #3875.
---
 cpukit/include/rtems/confdefs/iodrivers.h | 63 +++++++++++------------
 1 file changed, 31 insertions(+), 32 deletions(-)

diff --git a/cpukit/include/rtems/confdefs/iodrivers.h b/cpukit/include/rtems/confdefs/iodrivers.h
index 8c102197eb..1f77948676 100644
--- a/cpukit/include/rtems/confdefs/iodrivers.h
+++ b/cpukit/include/rtems/confdefs/iodrivers.h
@@ -43,16 +43,30 @@
 
 #ifdef CONFIGURE_INIT
 
-#if defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) \
-  || defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) \
-  || CONFIGURE_MAXIMUM_DRIVERS > 0
+#include <rtems/confdefs/bsp.h>
+
+#if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
+  defined(CONFIGURE_BSP_PREREQUISITE_DRIVERS)
+#define _CONFIGURE_BSP_PREREQUISITE_DRIVERS CONFIGURE_BSP_PREREQUISITE_DRIVERS
+#endif
+
+#if defined(_CONFIGURE_BSP_PREREQUISITE_DRIVERS) || \
+  defined(CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
+#define _CONFIGURE_HAS_IO_DRIVERS
+#endif
+
+#if defined(_CONFIGURE_HAS_IO_DRIVERS) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
+  CONFIGURE_MAXIMUM_DRIVERS > 0
 
 #include <rtems/ioimpl.h>
 #include <rtems/sysinit.h>
@@ -110,9 +124,8 @@ extern "C" {
 
 rtems_driver_address_table
 _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
-  #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
-    defined(CONFIGURE_BSP_PREREQUISITE_DRIVERS)
-    CONFIGURE_BSP_PREREQUISITE_DRIVERS,
+  #ifdef _CONFIGURE_BSP_PREREQUISITE_DRIVERS
+    _CONFIGURE_BSP_PREREQUISITE_DRIVERS,
   #endif
   #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
     CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
@@ -144,15 +157,8 @@ _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
   #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
     CONFIGURE_APPLICATION_EXTRA_DRIVERS,
   #endif
-  #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) \
-    || ( !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) \
-      && !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) )
+  #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
+    !defined(_CONFIGURE_HAS_IO_DRIVERS)
     NULL_DRIVER_TABLE_ENTRY
   #endif
 };
@@ -179,16 +185,9 @@ RTEMS_SYSINIT_ITEM(
 }
 #endif
 
-#endif /* CONFIGURE_APPLICATION_EXTRA_DRIVERS
-  || CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
-  || CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
-  || CONFIGURE_MAXIMUM_DRIVERS */
+#endif /* _CONFIGURE_HAS_IO_DRIVERS) ||
+  CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER ||
+  CONFIGURE_MAXIMUM_DRIVERS */
 
 
 /*
-- 
2.26.2



More information about the devel mailing list