sim: hw: localize init callback

Message ID 20210502034023.29841-1-vapier@gentoo.org
State New
Headers show
Series
  • sim: hw: localize init callback
Related show

Commit Message

Weimin Pan via Gdb-patches May 2, 2021, 3:40 a.m.
Now that we don't need to hardcode the module init list in a single
place, move the hw init logic out to the sim-hw file.
---
 sim/common/sim-hw.c     | 6 +++++-
 sim/common/sim-hw.h     | 6 ------
 sim/common/sim-module.c | 7 -------
 3 files changed, 5 insertions(+), 14 deletions(-)

-- 
2.31.1

Patch

diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index 11d3abdbbfb0..984817f25fd0 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -288,8 +288,12 @@  hw_option_handler (struct sim_state *sd, sim_cpu *cpu, int opt,
 static MODULE_INIT_FN sim_hw_init;
 static MODULE_UNINSTALL_FN sim_hw_uninstall;
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+SIM_RC sim_install_hw (struct sim_state *sd);
+
+/* Establish this object.  */
 SIM_RC
-sim_hw_install (struct sim_state *sd)
+sim_install_hw (struct sim_state *sd)
 {
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
   sim_add_option_table (sd, NULL, hw_options);
diff --git a/sim/common/sim-hw.h b/sim/common/sim-hw.h
index 95b98560fccd..8bba6e61464d 100644
--- a/sim/common/sim-hw.h
+++ b/sim/common/sim-hw.h
@@ -21,12 +21,6 @@  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #define SIM_HW_H
 
 
-/* Establish this object */
-
-SIM_RC sim_hw_install
-(struct sim_state *sd);
-
-
 /* Parse a hardware definition */
 
 struct hw *sim_hw_parse
diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c
index 2557697fff2b..3bb7db0df769 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -25,10 +25,6 @@  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-options.h"
 #include "sim-assert.h"
 
-#if WITH_HW
-#include "sim-hw.h"
-#endif
-
 #include "libiberty.h"
 
 #include <stdlib.h>
@@ -52,9 +48,6 @@  static MODULE_INSTALL_FN * const early_modules[] = {
 #if WITH_SCACHE
   scache_install,
 #endif
-#if WITH_HW
-  sim_hw_install,
-#endif
 };
 static int early_modules_len = ARRAY_SIZE (early_modules);