patch-1.3.17 linux/drivers/net/ibmtr.c

Next file: linux/drivers/net/ne.c
Previous file: linux/drivers/net/hp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.16/linux/drivers/net/ibmtr.c linux/drivers/net/ibmtr.c
@@ -30,6 +30,11 @@
       active adapter is identified.
 */
 	
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #define NO_AUTODETECT 1
 #undef NO_AUTODETECT
 #undef ENABLE_PAGING
@@ -483,6 +488,11 @@
       dev->start=1;
       /*  NEED to see smem size *AND* reset high 512 bytes if
           needed */
+
+#ifdef MODULE
+	MOD_INC_USE_COUNT;
+#endif
+
       return 0;
    }
 	else 
@@ -505,6 +515,10 @@
 
 	if(close_adapter->ret_code)
 		DPRINTK("close adapter failed: %02X\n",close_adapter->ret_code);
+
+#ifdef MODULE
+	MOD_DEC_USE_COUNT;
+#endif
 	
 	return 0;
 }
@@ -1181,3 +1195,33 @@
   toki=(struct tok_info *) dev->priv;
   return (struct enet_statistics *) &toki->tr_stats;
 }
+
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_ibmtr = {
+	"        " /*"ibmtr"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, tok_probe };
+
+int io = 0;
+
+int init_module(void)
+{
+	dev_ibmtr.base_addr = io;
+	dev_ibmtr.irq       = 0;
+	if (register_netdev(&dev_ibmtr) != 0) {
+		printk("ibmtr: register_netdev() returned non-zero.\n");
+		return -EIO;
+	}
+	return 0;
+}
+
+void
+cleanup_module(void)
+{
+	if (MOD_IN_USE)
+		printk("ibmtr: device busy, remove delayed\n");
+	else
+	{
+		unregister_netdev(&dev_ibmtr);
+	}
+}
+#endif /* MODULE */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this