patch-2.3.99-pre7 linux/drivers/net/pcmcia/ibmtr_cs.c

Next file: linux/drivers/net/pcmcia/netwave_cs.c
Previous file: linux/drivers/net/pcmcia/fmvj18x_cs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/net/pcmcia/ibmtr_cs.c linux/drivers/net/pcmcia/ibmtr_cs.c
@@ -49,10 +49,8 @@
     Updated to version 2.2.7 to match the first version of the kernel
     that the modification to ibmtr.c were incorporated into.
     
-	
 ======================================================================*/
 
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sched.h>
@@ -61,6 +59,7 @@
 #include <linux/string.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
+#include <linux/module.h>
 #include <asm/io.h>
 #include <asm/system.h>
 
@@ -74,7 +73,6 @@
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 
-#define PCMCIA_DEBUG 10
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
 MODULE_PARM(pc_debug, "i");
@@ -226,10 +224,6 @@
 
     dev->init = &ibmtr_probe;
 
-#if 0
-    dev->tbusy = 1; 
-#endif
-
     /* Register with Card Services */
     link->next = dev_list;
     dev_list = link;
@@ -266,8 +260,6 @@
     struct ibmtr_dev_t *info = link->priv;
     dev_link_t **linkp;
     struct net_device *dev; 
-    long flags;
-
 
     DEBUG(0, "ibmtr_detach(0x%p)\n", link);
 
@@ -278,19 +270,11 @@
         return;
 
     dev = info->dev;
-    
-    save_flags(flags);
-    cli();
     {
 	struct tok_info *ti = (struct tok_info *)dev->priv;
-	if (ti->tr_timer.next) del_timer(&(ti->tr_timer));
+	del_timer(&(ti->tr_timer));
     }
-    if (link->state & DEV_RELEASE_PENDING) {
-        del_timer(&link->release);
-        link->state &= ~DEV_RELEASE_PENDING;
-    }
-    restore_flags(flags);
-
+    del_timer(&link->release);
     if (link->state & DEV_CONFIG) {
         ibmtr_release((u_long)link);
         if (link->state & DEV_STALE_CONFIG) {
@@ -378,8 +362,9 @@
     req.Base = mmiobase;
     req.Size = 0x2000;
     req.AccessSpeed = 250;
-    link->win = (window_handle_t) link->handle;
+    link->win = (window_handle_t)link->handle;
     CS_CHECK(RequestWindow, &link->win, &req);
+
     mem.CardOffset = req.Base;
     mem.Page = 0;
     CS_CHECK(MapMemPage, link->win, &mem);
@@ -409,10 +394,6 @@
         Adapters Technical Reference"  SC30-3585 for this info.  */
     ibmtr_hw_setup(dev);
 
-#if 0
-    dev->tbusy = 0;
-#endif
-
     i = register_trdev(dev);
     
     if (i != 0) {
@@ -452,7 +433,6 @@
     dev_link_t *link = (dev_link_t *)arg;
     ibmtr_dev_t *info = link->priv;
     struct net_device *dev = info->dev;
-    struct tok_info *ti=(struct tok_info *) dev->priv;
 
     DEBUG(0, "ibmtr_release(0x%p)\n", link);
 
@@ -463,8 +443,6 @@
         return;
     }
 
-    ti->open_status=CLOSED;
-
     CardServices(ReleaseConfiguration, link->handle);
     CardServices(ReleaseIO, link->handle, &link->io);
     CardServices(ReleaseIRQ, link->handle, &link->irq);
@@ -475,7 +453,7 @@
 	CardServices(ReleaseWindow, info->sram_win_handle);
     }
 
-    link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);
+    link->state &= ~DEV_CONFIG;
 
 } /* ibmtr_release */
 
@@ -501,12 +479,8 @@
     case CS_EVENT_CARD_REMOVAL:
         link->state &= ~DEV_PRESENT;
         if (link->state & DEV_CONFIG) {
-#if 0
-            dev->tbusy = 1; dev->start = 0;
-#endif
-            link->release.expires = jiffies + HZ/20;
-            link->state |= DEV_RELEASE_PENDING;
-            add_timer(&link->release);
+	    netif_device_detach(dev);
+	    mod_timer(&link->release, jiffies + HZ/20);
         }
         break;
     case CS_EVENT_CARD_INSERTION:
@@ -518,11 +492,8 @@
         /* Fall through... */
     case CS_EVENT_RESET_PHYSICAL:
         if (link->state & DEV_CONFIG) {
-#if 0
-            if (link->open) {
-                dev->tbusy = 1; dev->start = 0;
-            }
-#endif
+            if (link->open)
+		netif_device_detach(dev);
             CardServices(ReleaseConfiguration, link->handle);
         }
         break;
@@ -534,9 +505,7 @@
             CardServices(RequestConfiguration, link->handle, &link->conf);
             if (link->open) {
 		(dev->init)(dev);
-#if 0
-                dev->tbusy = 0; dev->start = 1;
-#endif
+		netif_device_attach(dev);
             }
         }
         break;

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