[PATCH 16/40] drvmgr: Remove bsp_driver_level_hook()

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Apr 19 13:26:41 UTC 2018


Use RTEMS_SYSINIT_ITEM() instead.

Update #2408.
---
 c/src/lib/libbsp/shared/bspdriverlevelhook.c       | 16 -------------
 .../lib/libbsp/sparc/leon2/startup/bsppredriver.c  | 13 +----------
 .../lib/libbsp/sparc/leon3/startup/bsppredriver.c  | 27 ++++++++--------------
 cpukit/include/drvmgr/drvmgr.h                     |  6 -----
 cpukit/libdrvmgr/drvmgr.c                          |  9 --------
 5 files changed, 10 insertions(+), 61 deletions(-)
 delete mode 100644 c/src/lib/libbsp/shared/bspdriverlevelhook.c

diff --git a/c/src/lib/libbsp/shared/bspdriverlevelhook.c b/c/src/lib/libbsp/shared/bspdriverlevelhook.c
deleted file mode 100644
index e506ea73be..0000000000
--- a/c/src/lib/libbsp/shared/bspdriverlevelhook.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- *  This is a dummy bsp_driver_level_hook routine.
- *
- *  COPYRIGHT (c) 2015.
- *  Cobham Gaisler.
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#include <drvmgr/drvmgr.h>
-
-void bsp_driver_level_hook( int level )
-{
-}
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c b/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c
index 218ed80774..b11ad4cb59 100644
--- a/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c
+++ b/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c
@@ -65,18 +65,7 @@ struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) =
     DRVMGR_RES_EMPTY
   },
 };
-
-/*
- *  bsp_driver_level_hook
- *
- *  BSP driver level hook. Called just after drivers have reached initialization
- *  level 'level' (1,2,3,4). See exinit.c for meaning of the every level.
- */
-void bsp_driver_level_hook( int level )
-{
-}
-
-#endif
+#endif /* RTEMS_DRVMGR_STARTUP */
 
 /*
  *  bsp_predriver_hook
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c b/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c
index 84edb73091..ba35624d33 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c
@@ -18,6 +18,8 @@
 
 #include <drvmgr/drvmgr.h>
 
+#include <rtems/sysinit.h>
+
 static void leon3_interrupt_common_init( void )
 {
   /* Initialize shared interrupt handling, must be done after IRQ
@@ -43,23 +45,12 @@ void bsp_predriver_hook( void )
 
 #ifdef RTEMS_DRVMGR_STARTUP
 /*
- *  bsp_driver_level_hook
- *
- *  BSP driver level hook. Called just after drivers have reached initialization
- *  level 'level' (1,2,3,4). See exinit.c for meaning of the every level.
- *
- *  Initializes the BSP Interrupt layer
- *  After Level 1 we can trust that interrupt controller and system
- *  clock timer drivers now have been initialized.
+ * Initialize shared interrupt handling, must be done after IRQ controller has
+ * been found and initialized.
  */
-void bsp_driver_level_hook( int level )
-{
-  /* Initialize shared interrupt handling, must be done after IRQ
-   * controller has been found and initialized.
-   */
-  if (level != 1)
-  	return;
-
-  leon3_interrupt_common_init();
-}
+RTEMS_SYSINIT_ITEM(
+  leon3_interrupt_common_init,
+  RTEMS_SYSINIT_DRVMGR_LEVEL_1,
+  RTEMS_SYSINIT_ORDER_LAST
+);
 #endif
diff --git a/cpukit/include/drvmgr/drvmgr.h b/cpukit/include/drvmgr/drvmgr.h
index cb8f4a5f5a..afb9432e5d 100644
--- a/cpukit/include/drvmgr/drvmgr.h
+++ b/cpukit/include/drvmgr/drvmgr.h
@@ -350,12 +350,6 @@ extern void _DRV_Manager_initialization(void);
  */
 extern void _DRV_Manager_init_level(int level);
 
-/*! This function must be defined by the BSP when the driver manager is enabled
- * and initialized during BSP initialization. The function is called after a
- * init level is reached the first time by the driver manager.
- */
-extern void bsp_driver_level_hook(int level);
-
 /*! Init driver manager all in one go, will call _DRV_Manager_initialization(),
  *  then _DRV_Manager_init_level([1..DRVMGR_LEVEL_MAX]).
  *  Typically called from Init task when user wants to initilize driver
diff --git a/cpukit/libdrvmgr/drvmgr.c b/cpukit/libdrvmgr/drvmgr.c
index 70bb9337ce..43148fd76a 100644
--- a/cpukit/libdrvmgr/drvmgr.c
+++ b/cpukit/libdrvmgr/drvmgr.c
@@ -66,13 +66,6 @@ static int do_dev_init(
 
 /* DRIVER MANAGER */
 
-void bsp_driver_level_hook(int level) __attribute__((weak));
-
-/* default hook does nothing, BSP may override. */
-void bsp_driver_level_hook(int level)
-{
-}
-
 void _DRV_Manager_init_level(int level)
 {
 	struct drvmgr *mgr = &drvmgr;
@@ -85,8 +78,6 @@ void _DRV_Manager_init_level(int level)
 
 	/* Initialize buses and devices into this new level */
 	drvmgr_init_update();
-
-	bsp_driver_level_hook(level);
 }
 
 /* Initialize Data structures of the driver manager and call driver
-- 
2.12.3




More information about the devel mailing list