Skip to contentSkip to conversation

drivers/net/{ne,smc-ultra}.c: Avoid compilation warnings by registering init and exit functions

PATCH New [email protected] 1 participant 1 message Aug 31, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/{ne,smc-ultra}.c: Avoid compilation warnings by registering init and exit functions

This patch is against 2.6.17-11.
1) Meant to get rid of the following compilation warnings

         WARNING: drivers/net/ne.o - Section mismatch: reference to .init.text: from .text between 'init_module' (at offset 0xeb) and 'ne_close'
         WARNING: drivers/net/smc-ultra.o - Section mismatch: reference to .init.data:ultra_portlist from .text between 'init_module' (at offset 0xa4) and 'ultra_close_card'

2) Isn't the registration of a module's __init and __exit functions while making them static much encouraged in 2.6? I followed the Linux Device Drivers book.

---

drivers/net/ne.c | 8 ++++++--
drivers/net/smc-ultra.c | 10 ++++++----

2 files changed, 12 insertions(+), 6 deletions(-)
drivers/net/ne.c 2006-08-29 18:27:13.000000000 +0300 renamed from drivers/net/ne.c.orig 2006-08-29 14:55:59.000000000 +0300 +6 -2
@@ -829,7 +829,7 @@ that the ne2k probe is the last 8390 bas
 is at boot) and so the probe will get confused by any other 8390 cards.
 ISA device autoprobes on a running machine are not recommended anyway. */
 
-int init_module(void)
+static int __init init_ne_module(void)
 {
        int this_dev, found = 0;
 
@@ -867,7 +867,7 @@ static void cleanup_card(struct net_devi
        release_region(dev->base_addr, NE_IO_EXTENT);
 }
 
-void cleanup_module(void)
+static void __exit cleanup_ne_module(void)
 {
        int this_dev;
 
@@ -880,4 +880,8 @@ void cleanup_module(void)
                }
        }
 }
+
+module_init(init_ne_module);
+module_exit(cleanup_ne_module);
+
 #endif /* MODULE */
drivers/net/smc-ultra.c 2006-08-29 18:29:53.000000000 +0300 renamed from drivers/net/smc-ultra.c.orig 2006-08-29 15:03:33.000000000 +0300 +6 -4
@@ -553,8 +553,7 @@ MODULE_LICENSE("GPL");
 
 /* This is set up so that only a single autoprobe takes place per call.
 ISA device autoprobes on a running machine are not recommended. */
-int
-init_module(void)
+static int __init init_smcUltra_module(void)
 {
        struct net_device *dev;
        int this_dev, found = 0;
@@ -594,8 +593,7 @@ static void cleanup_card(struct net_devi
        iounmap(ei_status.mem);
 }
 
-void
-cleanup_module(void)
+static void __exit cleanup_smcUltra_module(void)
 {
        int this_dev;
 
@@ -608,4 +606,8 @@ cleanup_module(void)
                }
        }
 }
+
+module_init(init_smcUltra_module);
+module_exit(cleanup_smcUltra_module);
+
 #endif /* MODULE */