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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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.

Signed-off-by: Shaul Karl <[email protected]>

---

drivers/net/ne.c        |    8 ++++++--
drivers/net/smc-ultra.c |   10 ++++++----
2 files changed, 12 insertions(+), 6 deletions(-)

--- linux-source-2.6.17/drivers/net/ne.c.orig   2006-08-29 14:55:59.000000000 +0300
+++ linux-source-2.6.17/drivers/net/ne.c        2006-08-29 18:27:13.000000000 +0300
@@ -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 */

--- linux-source-2.6.17/drivers/net/smc-ultra.c.orig    2006-08-29 15:03:33.000000000 +0300
+++ linux-source-2.6.17/drivers/net/smc-ultra.c 2006-08-29 18:29:53.000000000 +0300
@@ -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 */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux