patch-2.2.4 linux/drivers/net/ibmtr.c
Next file: linux/drivers/net/ibmtr.h
Previous file: linux/drivers/net/cs89x0.c
Back to the patch index
Back to the overall index
- Lines: 80
- Date:
Tue Mar 16 14:21:51 1999
- Orig file:
v2.2.3/linux/drivers/net/ibmtr.c
- Orig date:
Mon Jan 25 17:44:34 1999
diff -u --recursive --new-file v2.2.3/linux/drivers/net/ibmtr.c linux/drivers/net/ibmtr.c
@@ -70,6 +70,9 @@
* Changes by Joel Sloan (jjs@c-me.com) :
* + disable verbose debug messages by default - to enable verbose
* debugging, edit the IBMTR_DEBUG_MESSAGES define below
+ *
+ * Changes by Tim Hockin (thockin@isunix.it.ilstu.edu) :
+ * + added spinlocks for SMP sanity (10 March 1999)
*/
/* change the define of IBMTR_DEBUG_MESSAGES to a nonzero value
@@ -144,6 +147,7 @@
#include <net/checksum.h>
#include <asm/io.h>
+#include <asm/spinlock.h>
#include <asm/system.h>
#include <asm/bitops.h>
@@ -754,6 +758,9 @@
{
struct tok_info *ti=(struct tok_info *)dev->priv;
+ /* init the spinlock */
+ ti->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
+
if (ti->open_status==CLOSED) tok_init_card(dev);
if (ti->open_status==IN_PROGRESS) sleep_on(&ti->wait_for_reset);
@@ -806,6 +813,7 @@
DPRINTK("Int from tok_driver, dev : %p\n",dev);
#endif
ti = (struct tok_info *) dev->priv;
+ spin_lock(&(ti->lock));
/* Disable interrupts till processing is finished */
dev->interrupt=1;
@@ -832,6 +840,7 @@
if (status == 0xFF)
{
DPRINTK("PCMCIA card removed.\n");
+ spin_unlock(&(ti->lock));
dev->interrupt = 0;
return;
}
@@ -840,6 +849,7 @@
if ( readb (ti->mmio + ACA_OFFSET + ACA_RW + ISRP_EVEN) == 0xFF)
{
DPRINTK("PCMCIA card removed.\n");
+ spin_unlock(&(ti->lock));
dev->interrupt = 0;
return;
}
@@ -1167,6 +1177,7 @@
DPRINTK("Unexpected interrupt from tr adapter\n");
}
+ spin_unlock(&(ti->lock));
}
static void initial_tok_int(struct device *dev)
@@ -1598,12 +1609,19 @@
if (test_and_set_bit(0,(void *)&dev->tbusy)!=0)
DPRINTK("Transmitter access conflict\n");
else {
+ int flags;
+
+ /* lock against other CPUs */
+ spin_lock_irqsave(&(ti->lock), flags);
+
/* Save skb; we'll need it when the adapter asks for the data */
ti->current_skb=skb;
writeb(XMIT_UI_FRAME, ti->srb + offsetof(struct srb_xmit, command));
writew(ti->exsap_station_id, ti->srb
+offsetof(struct srb_xmit, station_id));
writeb(CMD_IN_SRB, (ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD));
+ spin_unlock_irqrestore(&(ti->lock), flags);
+
dev->trans_start=jiffies;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)