patch-2.3.43 linux/drivers/net/bmac.c

Next file: linux/drivers/net/de4x5.c
Previous file: linux/drivers/net/acenic.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/drivers/net/bmac.c linux/drivers/net/bmac.c
@@ -16,6 +16,7 @@
 #include <linux/string.h>
 #include <linux/timer.h>
 #include <linux/proc_fs.h>
+#include <linux/init.h>
 #include <asm/prom.h>
 #include <asm/dbdma.h>
 #include <asm/io.h>
@@ -1256,7 +1257,7 @@
 	return 1;
 }
 
-int bmac_probe(void)
+static int __init bmac_probe (void)
 {
 	int j, rev;
 	struct bmac_data *bp;
@@ -1265,6 +1266,11 @@
 	static struct device_node *all_bmacs = NULL, *next_bmac;
 	struct net_device *dev = NULL;
 
+#ifdef MODULE
+	if(bmac_devs != NULL)
+		return -EBUSY;
+#endif
+
 	if (all_bmacs == NULL) {
 		all_bmacs = find_devices("bmac");
 		is_bmac_plus = 0;
@@ -1593,23 +1599,14 @@
 	return len;
 }
 
-#ifdef MODULE
 
 MODULE_AUTHOR("Randy Gobbel/Paul Mackerras");
 MODULE_DESCRIPTION("PowerMac BMAC ethernet driver.");
 
-int init_module(void)
-{
-    int res;
-   
-    if(bmac_devs != NULL)
-        return -EBUSY;
-    res = bmac_probe();
-    return res;
-}
 
-void cleanup_module(void)
+static void __exit bmac_cleanup (void)
 {
+#ifdef MODULE
     struct bmac_data *bp;
 
     if (bmac_devs == 0)
@@ -1628,6 +1625,8 @@
 #endif
     kfree(bmac_devs);
     bmac_devs = NULL;
+#endif
 }
 
-#endif
+module_init(bmac_probe);
+module_exit(bmac_cleanup);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)