diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c index 14b563bb8ff1..ee17418388eb 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_main.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c @@ -4218,8 +4218,8 @@ static void __exit mlx4_cleanup(void) destroy_workqueue(mlx4_wq); } -module_init(mlx4_init); -module_exit(mlx4_cleanup); +module_init_order(mlx4_init, SI_ORDER_FIRST); +module_exit_order(mlx4_cleanup, SI_ORDER_FIRST); static int mlx4_evhand(module_t mod, int event, void *arg) diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_main.c b/sys/dev/mlx4/mlx4_en/mlx4_en_main.c index 3f57a038ec53..fe3adfe9c162 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_main.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_main.c @@ -304,8 +304,8 @@ static void __exit mlx4_en_cleanup(void) mlx4_unregister_interface(&mlx4_en_interface); } -module_init(mlx4_en_init); -module_exit(mlx4_en_cleanup); +module_init_order(mlx4_en_init, SI_ORDER_SIXTH); +module_exit_order(mlx4_en_cleanup, SI_ORDER_SIXTH); static int mlx4en_evhand(module_t mod, int event, void *arg) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index c62b62c5e457..5ccec7e6e53b 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -3319,8 +3319,8 @@ static void __exit mlx4_ib_cleanup(void) destroy_workqueue(wq); } -module_init_order(mlx4_ib_init, SI_ORDER_THIRD); -module_exit(mlx4_ib_cleanup); +module_init_order(mlx4_ib_init, SI_ORDER_SEVENTH); +module_exit_order(mlx4_ib_cleanup, SI_ORDER_SEVENTH); static int mlx4ib_evhand(module_t mod, int event, void *arg) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 284dd92f71b6..d864a44198d0 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -2026,5 +2026,5 @@ static void __exit cleanup(void) pci_unregister_driver(&mlx5_core_driver); } -module_init(init); -module_exit(cleanup); +module_init_order(init, SI_ORDER_FIRST); +module_exit_order(cleanup, SI_ORDER_FIRST); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 3cb7e31ee08c..b5237267907e 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -4723,8 +4723,8 @@ mlx5e_show_version(void __unused *arg) } SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); -module_init_order(mlx5e_init, SI_ORDER_THIRD); -module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD); +module_init_order(mlx5e_init, SI_ORDER_SIXTH); +module_exit_order(mlx5e_cleanup, SI_ORDER_SIXTH); #if (__FreeBSD_version >= 1100000) MODULE_DEPEND(mlx5en, linuxkpi, 1, 1, 1); diff --git a/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c b/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c index b68643c97f12..6cd165c434f9 100644 --- a/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c +++ b/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c @@ -139,5 +139,5 @@ static void __exit mlx5_fpga_tools_exit(void) mlx5_fpga_tools_char_deinit(); } -module_init(mlx5_fpga_tools_init); -module_exit(mlx5_fpga_tools_exit); +module_init_order(mlx5_fpga_tools_init, SI_ORDER_SECOND); +module_exit_order(mlx5_fpga_tools_exit, SI_ORDER_SECOND); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index d175078db594..76c5a333a3f8 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3399,5 +3399,5 @@ mlx5_ib_show_version(void __unused *arg) } SYSINIT(mlx5_ib_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5_ib_show_version, NULL); -module_init_order(mlx5_ib_init, SI_ORDER_THIRD); -module_exit_order(mlx5_ib_cleanup, SI_ORDER_THIRD); +module_init_order(mlx5_ib_init, SI_ORDER_SEVENTH); +module_exit_order(mlx5_ib_cleanup, SI_ORDER_SEVENTH); diff --git a/sys/dev/mthca/mthca_main.c b/sys/dev/mthca/mthca_main.c index d91d05d8507a..543b0fed4a03 100644 --- a/sys/dev/mthca/mthca_main.c +++ b/sys/dev/mthca/mthca_main.c @@ -1271,8 +1271,8 @@ static void __exit mthca_cleanup(void) mthca_catas_cleanup(); } -module_init_order(mthca_init, SI_ORDER_THIRD); -module_exit(mthca_cleanup); +module_init_order(mthca_init, SI_ORDER_SEVENTH); +module_exit_order(mthca_cleanup, SI_ORDER_SEVENTH); MODULE_VERSION(mthca, 1); MODULE_DEPEND(mthca, ibcore, 1, 1, 1); diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c index 753d3ca00e46..28c52c0cb2f2 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cm.c +++ b/sys/ofed/drivers/infiniband/core/ib_cm.c @@ -4180,5 +4180,5 @@ static void __exit ib_cm_cleanup(void) } module_init_order(ib_cm_init, SI_ORDER_SECOND); -module_exit_order(ib_cm_cleanup, SI_ORDER_FIRST); +module_exit_order(ib_cm_cleanup, SI_ORDER_SECOND); diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 0df1996a5f4a..1cfc770c792b 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -4619,5 +4619,5 @@ static void __exit cma_cleanup(void) destroy_workqueue(cma_wq); } -module_init(cma_init); -module_exit(cma_cleanup); +module_init_order(cma_init, SI_ORDER_FOURTH); +module_exit_order(cma_cleanup, SI_ORDER_FOURTH); diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c index be49ddb1a6ee..4d83b7e7936b 100644 --- a/sys/ofed/drivers/infiniband/core/ib_device.c +++ b/sys/ofed/drivers/infiniband/core/ib_device.c @@ -1060,8 +1060,25 @@ static void __exit ib_core_cleanup(void) destroy_workqueue(ib_wq); } -module_init(ib_core_init); -module_exit(ib_core_cleanup); +/* + * Typical loading and unloading order values and their use: + * + * SI_ORDER_FIRST (default for module_init): + * Core modules (PCI, infiniband) + * SI_ORDER_SECOND (default for module_exit): + * Infiniband core modules (CM) + * SI_ORDER_THIRD: + * SI_ORDER_FOURTH: + * Infiniband core modules (CMA) + * SI_ORDER_FIFTH: + * Infiniband user-space modules (UCM,UCMA,UMAD,UVERBS,IPOIB) + * SI_ORDER_SIXTH: + * Network HW driver modules + * SI_ORDER_SEVENTH: + * Infiniband HW driver modules + */ +module_init_order(ib_core_init, SI_ORDER_FIRST); +module_exit_order(ib_core_cleanup, SI_ORDER_FIRST); MODULE_VERSION(ibcore, 1); MODULE_DEPEND(ibcore, linuxkpi, 1, 1, 1); diff --git a/sys/ofed/drivers/infiniband/core/ib_iwcm.c b/sys/ofed/drivers/infiniband/core/ib_iwcm.c index a684eb3b566b..a2abfec40668 100644 --- a/sys/ofed/drivers/infiniband/core/ib_iwcm.c +++ b/sys/ofed/drivers/infiniband/core/ib_iwcm.c @@ -1052,5 +1052,5 @@ static void __exit iw_cm_cleanup(void) destroy_workqueue(iwcm_wq); } -module_init(iw_cm_init); -module_exit(iw_cm_cleanup); +module_init_order(iw_cm_init, SI_ORDER_FIRST); +module_exit_order(iw_cm_cleanup, SI_ORDER_FIRST); diff --git a/sys/ofed/drivers/infiniband/core/ib_ucm.c b/sys/ofed/drivers/infiniband/core/ib_ucm.c index 1f8a2c9a895e..e18f023118d1 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucm.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucm.c @@ -1371,5 +1371,5 @@ static void __exit ib_ucm_cleanup(void) idr_destroy(&ctx_id_table); } -module_init_order(ib_ucm_init, SI_ORDER_THIRD); -module_exit(ib_ucm_cleanup); +module_init_order(ib_ucm_init, SI_ORDER_FIFTH); +module_exit_order(ib_ucm_cleanup, SI_ORDER_FIFTH); diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c index b25e859e4084..5ea2845c0fe5 100644 --- a/sys/ofed/drivers/infiniband/core/ib_ucma.c +++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c @@ -1782,5 +1782,5 @@ static void __exit ucma_cleanup(void) idr_destroy(&multicast_idr); } -module_init(ucma_init); -module_exit(ucma_cleanup); +module_init_order(ucma_init, SI_ORDER_FIFTH); +module_exit_order(ucma_cleanup, SI_ORDER_FIFTH); diff --git a/sys/ofed/drivers/infiniband/core/ib_user_mad.c b/sys/ofed/drivers/infiniband/core/ib_user_mad.c index 03414d5547f0..db95b8dc3d50 100644 --- a/sys/ofed/drivers/infiniband/core/ib_user_mad.c +++ b/sys/ofed/drivers/infiniband/core/ib_user_mad.c @@ -1405,5 +1405,5 @@ static void __exit ib_umad_cleanup(void) unregister_chrdev_region(overflow_maj, IB_UMAD_MAX_PORTS * 2); } -module_init_order(ib_umad_init, SI_ORDER_THIRD); -module_exit(ib_umad_cleanup); +module_init_order(ib_umad_init, SI_ORDER_FIFTH); +module_exit_order(ib_umad_cleanup, SI_ORDER_FIFTH); diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index 74498ddb31d9..8aab2ac3ff8d 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -1431,5 +1431,5 @@ static void __exit ib_uverbs_cleanup(void) idr_destroy(&ib_uverbs_srq_idr); } -module_init_order(ib_uverbs_init, SI_ORDER_THIRD); -module_exit(ib_uverbs_cleanup); +module_init_order(ib_uverbs_init, SI_ORDER_FIFTH); +module_exit_order(ib_uverbs_cleanup, SI_ORDER_FIFTH); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index 87e6bec31b6c..575938cb8cf0 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1753,8 +1753,8 @@ ipoib_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, } } -module_init(ipoib_init_module); -module_exit(ipoib_cleanup_module); +module_init_order(ipoib_init_module, SI_ORDER_FIFTH); +module_exit_order(ipoib_cleanup_module, SI_ORDER_FIFTH); static int ipoib_evhand(module_t mod, int event, void *arg) diff --git a/sys/ofed/drivers/infiniband/util/madeye.c b/sys/ofed/drivers/infiniband/util/madeye.c index f82aa0c1e115..f7af2781501f 100644 --- a/sys/ofed/drivers/infiniband/util/madeye.c +++ b/sys/ofed/drivers/infiniband/util/madeye.c @@ -594,5 +594,5 @@ static void __exit ib_madeye_cleanup(void) ib_unregister_client(&madeye_client); } -module_init(ib_madeye_init); -module_exit(ib_madeye_cleanup); +module_init_order(ib_madeye_init, SI_ORDER_THIRD); +module_exit_order(ib_madeye_cleanup, SI_ORDER_THIRD);