[PATCH 2.5 22/25] 8390-cleanup for stnic

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

 



stnic.c:
- kill init_etherdev(), use ei_alloc_dev()
- kill ethdev_init()
- add missing module_exit function
untested.


--- 1.5/drivers/net/stnic.c	Thu Nov 21 23:06:12 2002
+++ edited/stnic.c	Sun Jun 29 23:45:15 2003
@@ -101,26 +101,19 @@
 int __init stnic_probe(void)
 {
   struct net_device *dev;
-  int i;
+  int i, err;
 
   /* If we are not running on a SolutionEngine, give up now */
   if (! MACH_SE)
     return -ENODEV;
 
   /* New style probing API */
-  dev = init_etherdev (NULL, 0);
+  dev = ei_alloc_dev();
   if (!dev)
   	return -ENOMEM;
   SET_MODULE_OWNER(dev);
   stnic_dev = dev;
 
-  /* Allocate dev->priv and fill in 8390 specific dev fields. */
-  if (ethdev_init (dev))
-    {
-      printk (KERN_EMERG "Unable to get memory for dev->priv.\n");
-      return -ENOMEM;
-    }
-
 #ifdef CONFIG_SH_STANDARD_BIOS 
   sh_bios_get_node_addr (stnic_eadr);
 #endif
@@ -135,13 +128,11 @@
 
   /* Snarf the interrupt now.  There's no point in waiting since we cannot
      share and the board will usually be enabled. */
-  i = request_irq (dev->irq, ei_interrupt, 0, dev->name, dev);
-  if (i)  {
+  err = request_irq (dev->irq, ei_interrupt, 0, dev->name, dev);
+  if (err) {
       printk (KERN_EMERG " unable to get IRQ %d.\n", dev->irq);
-      unregister_netdev(dev);
-      kfree(dev->priv);
       kfree(dev);
-      return i;
+      return err;
     }
 
   ei_status.name = dev->name;
@@ -162,19 +153,33 @@
 
   stnic_init (dev);
 
+  err = register_netdev(dev);
+  if (err) {
+	  kfree(dev);
+	  return err;
+  }
+
   printk (KERN_INFO "NS ST-NIC 83902A\n");
 
   return 0;
 }
 
+static void __exit stnic_exit(void)
+{
+	if (!stnic_dev)
+		return;
+
+	unregister_netdev(stnic_dev);
+	kfree(stnic_dev);
+}
+
 static int
 stnic_open (struct net_device *dev)
 {
 #if 0
   printk (KERN_DEBUG "stnic open\n");
 #endif
-  ei_open (dev);
-  return 0;
+  return ei_open (dev);
 }
 
 static int
@@ -315,5 +320,5 @@
 }
 
 module_init(stnic_probe);
-/* No cleanup routine. */
+module_exit(stnic_extit);
 MODULE_LICENSE("GPL");


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux