]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: remove unnecessary module_init/exit functions
authorEthan Nelson-Moore <enelsonmoore@gmail.com>
Sat, 31 Jan 2026 00:42:56 +0000 (16:42 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Feb 2026 01:25:23 +0000 (17:25 -0800)
Many network drivers have unnecessary empty module_init and module_exit
functions. Remove them (including some that just print a message). Note
that if a module_init function exists, a module_exit function must also
exist; otherwise, the module cannot be unloaded.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20260131004327.18112-1-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/arcnet/com20020.c
drivers/net/can/sja1000/sja1000.c
drivers/net/ethernet/8390/8390.c
drivers/net/ethernet/8390/8390p.c
drivers/net/ethernet/mellanox/mlxsw/pci.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/net_failover.c
drivers/net/wireless/ath/ath9k/common.c
drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
drivers/net/wireless/rsi/rsi_91x_main.c

index a0053e3992a364ef3e1d3c4328b4baf8956d248d..b8526805ffac8f1cf77d845169ff396bfcb3fd67 100644 (file)
@@ -401,19 +401,3 @@ EXPORT_SYMBOL(com20020_netdev_ops);
 
 MODULE_DESCRIPTION("ARCnet COM20020 chipset core driver");
 MODULE_LICENSE("GPL");
-
-#ifdef MODULE
-
-static int __init com20020_module_init(void)
-{
-       if (BUGLVL(D_NORMAL))
-               pr_info("%s\n", "COM20020 chipset support (by David Woodhouse et al.)");
-       return 0;
-}
-
-static void __exit com20020_module_exit(void)
-{
-}
-module_init(com20020_module_init);
-module_exit(com20020_module_exit);
-#endif                         /* MODULE */
index 67fccc15ed20435db9cde9f30e3ba7377d99979a..3cdb583ee3e50161beb0fe04ca6db2e0ff140161 100644 (file)
@@ -705,19 +705,3 @@ void unregister_sja1000dev(struct net_device *dev)
        unregister_candev(dev);
 }
 EXPORT_SYMBOL_GPL(unregister_sja1000dev);
-
-static __init int sja1000_init(void)
-{
-       printk(KERN_INFO "%s CAN netdevice driver\n", DRV_NAME);
-
-       return 0;
-}
-
-module_init(sja1000_init);
-
-static __exit void sja1000_exit(void)
-{
-       printk(KERN_INFO "%s: driver removed\n", DRV_NAME);
-}
-
-module_exit(sja1000_exit);
index c5636245f1cad225bbd1a638a0bea855db566235..8e4354568f043246a131342d4ecc46103f1e47e0 100644 (file)
@@ -86,19 +86,5 @@ void NS8390_init(struct net_device *dev, int startp)
 }
 EXPORT_SYMBOL(NS8390_init);
 
-#if defined(MODULE)
-
-static int __init ns8390_module_init(void)
-{
-       return 0;
-}
-
-static void __exit ns8390_module_exit(void)
-{
-}
-
-module_init(ns8390_module_init);
-module_exit(ns8390_module_exit);
-#endif /* MODULE */
 MODULE_DESCRIPTION("National Semiconductor 8390 core driver");
 MODULE_LICENSE("GPL");
index 6d429b11e9c6aa5ce0a1ea3a6c3925a3672dd2bc..a0bfc8e34f7932117b4e1f5b7e5089b0c8c6d1ca 100644 (file)
@@ -91,16 +91,5 @@ void NS8390p_init(struct net_device *dev, int startp)
 }
 EXPORT_SYMBOL(NS8390p_init);
 
-static int __init NS8390p_init_module(void)
-{
-       return 0;
-}
-
-static void __exit NS8390p_cleanup_module(void)
-{
-}
-
-module_init(NS8390p_init_module);
-module_exit(NS8390p_cleanup_module);
 MODULE_DESCRIPTION("National Semiconductor 8390 core for ISA driver");
 MODULE_LICENSE("GPL");
index 8769cba2c7460f67ee45d544b777292318a62fe1..7da9ef254b7265c68f5447a882039f8789dedc12 100644 (file)
@@ -2542,18 +2542,6 @@ void mlxsw_pci_driver_unregister(struct pci_driver *pci_driver)
 }
 EXPORT_SYMBOL(mlxsw_pci_driver_unregister);
 
-static int __init mlxsw_pci_module_init(void)
-{
-       return 0;
-}
-
-static void __exit mlxsw_pci_module_exit(void)
-{
-}
-
-module_init(mlxsw_pci_module_init);
-module_exit(mlxsw_pci_module_exit);
-
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>");
 MODULE_DESCRIPTION("Mellanox switch PCI interface driver");
index 2263029d1a20e614b0d08da400285f36af913c3d..3b88e465d08f46130ce3762c5128943b4468f364 100644 (file)
@@ -742,26 +742,6 @@ EXPORT_SYMBOL(hdlcdrv_unregister);
 
 /* --------------------------------------------------------------------- */
 
-static int __init hdlcdrv_init_driver(void)
-{
-       printk(KERN_INFO "hdlcdrv: (C) 1996-2000 Thomas Sailer HB9JNX/AE4WA\n");
-       printk(KERN_INFO "hdlcdrv: version 0.8\n");
-       return 0;
-}
-
-/* --------------------------------------------------------------------- */
-
-static void __exit hdlcdrv_cleanup_driver(void)
-{
-       printk(KERN_INFO "hdlcdrv: cleanup\n");
-}
-
-/* --------------------------------------------------------------------- */
-
 MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
 MODULE_DESCRIPTION("Packet Radio network interface HDLC encoder/decoder");
 MODULE_LICENSE("GPL");
-module_init(hdlcdrv_init_driver);
-module_exit(hdlcdrv_cleanup_driver);
-
-/* --------------------------------------------------------------------- */
index 5b50d9186f121d7cb85d7f4b70b88000a04905e1..d0361aaf25efb5e336880cdd96d93b5e76447953 100644 (file)
@@ -819,18 +819,5 @@ void net_failover_destroy(struct failover *failover)
 }
 EXPORT_SYMBOL_GPL(net_failover_destroy);
 
-static __init int
-net_failover_init(void)
-{
-       return 0;
-}
-module_init(net_failover_init);
-
-static __exit
-void net_failover_exit(void)
-{
-}
-module_exit(net_failover_exit);
-
 MODULE_DESCRIPTION("Failover driver for Paravirtual drivers");
 MODULE_LICENSE("GPL v2");
index ffcf2276eb92e5f6d38eff13adc56c9ccfbba56b..f55b3afb377796639e21328d644025dcb4323f9b 100644 (file)
@@ -403,15 +403,3 @@ void ath9k_cmn_init_crypto(struct ath_hw *ah)
                ath_hw_keyreset(common, (u16) i);
 }
 EXPORT_SYMBOL(ath9k_cmn_init_crypto);
-
-static int __init ath9k_cmn_init(void)
-{
-       return 0;
-}
-module_init(ath9k_cmn_init);
-
-static void __exit ath9k_cmn_exit(void)
-{
-       return;
-}
-module_exit(ath9k_cmn_exit);
index 4641999f3fe9d065caa711b92292eae73b46db40..e88d92d3ae7ae33ae94cd7366e675034b39656fc 100644 (file)
@@ -519,16 +519,3 @@ MODULE_AUTHOR("Realtek WlanFAE     <wlanfae@realtek.com>");
 MODULE_AUTHOR("Larry Finger    <Larry.FInger@lwfinger.net>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core");
-
-static int __init rtl_btcoexist_module_init(void)
-{
-       return 0;
-}
-
-static void __exit rtl_btcoexist_module_exit(void)
-{
-       return;
-}
-
-module_init(rtl_btcoexist_module_init);
-module_exit(rtl_btcoexist_module_exit);
index 2112d8d277a9965d9b189682a48ed91f189bc8eb..a9bb37d5d581f5ef630fbe5e6245de2370ac41a2 100644 (file)
@@ -425,35 +425,6 @@ void rsi_91x_deinit(struct rsi_hw *adapter)
 }
 EXPORT_SYMBOL_GPL(rsi_91x_deinit);
 
-/**
- * rsi_91x_hal_module_init() - This function is invoked when the module is
- *                            loaded into the kernel.
- *                            It registers the client driver.
- * @void: Void.
- *
- * Return: 0 on success, -1 on failure.
- */
-static int rsi_91x_hal_module_init(void)
-{
-       rsi_dbg(INIT_ZONE, "%s: Module init called\n", __func__);
-       return 0;
-}
-
-/**
- * rsi_91x_hal_module_exit() - This function is called at the time of
- *                            removing/unloading the module.
- *                            It unregisters the client driver.
- * @void: Void.
- *
- * Return: None.
- */
-static void rsi_91x_hal_module_exit(void)
-{
-       rsi_dbg(INIT_ZONE, "%s: Module exit called\n", __func__);
-}
-
-module_init(rsi_91x_hal_module_init);
-module_exit(rsi_91x_hal_module_exit);
 MODULE_AUTHOR("Redpine Signals Inc");
 MODULE_DESCRIPTION("Station driver for RSI 91x devices");
 MODULE_VERSION("0.1");