patch-2.1.126 linux/drivers/net/ni65.c

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

diff -u --recursive --new-file v2.1.125/linux/drivers/net/ni65.c linux/drivers/net/ni65.c
@@ -351,6 +351,7 @@
 {
 	int i,j;
 	struct priv *p;
+	unsigned long flags;
 
 	for(i=0;i<NUM_CARDS;i++) {
 		if(check_region(ioaddr, cards[i].total_size))
@@ -417,12 +418,20 @@
 				int dma = dmatab[i];
 				if(test_bit(dma,&dma_channels) || request_dma(dma,"ni6510"))
 					continue;
+					
+				flags=claim_dma_lock();
 				disable_dma(dma);
 				set_dma_mode(dma,DMA_MODE_CASCADE);
 				enable_dma(dma);
+				release_dma_lock(flags);
+				
 				ni65_init_lance(p,dev->dev_addr,0,0); /* trigger memory access */
+				
+				flags=claim_dma_lock();
 				disable_dma(dma);
 				free_dma(dma);
+				release_dma_lock(flags);
+				
 				if(readreg(CSR0) & CSR0_IDON)
 					break;
 			}
@@ -718,20 +727,25 @@
 {
 	 int i;
 	 struct priv *p = (struct priv *) dev->priv;
+	 unsigned long flags;
 
 	 p->lock = 0;
 	 p->xmit_queued = 0;
 
+	 flags=claim_dma_lock();
 	 disable_dma(dev->dma); /* I've never worked with dma, but we do it like the packetdriver */
 	 set_dma_mode(dev->dma,DMA_MODE_CASCADE);
 	 enable_dma(dev->dma);
+	 release_dma_lock(flags);
 
 	 outw(inw(PORT+L_RESET),PORT+L_RESET); /* first: reset the card */
 	 if( (i=readreg(CSR0) ) != 0x4)
 	 {
 		 printk(KERN_ERR "%s: can't RESET %s card: %04x\n",dev->name,
 							cards[p->cardno].cardname,(int) i);
+		 flags=claim_dma_lock();
 		 disable_dma(dev->dma);
+		 release_dma_lock(flags);
 		 return 0;
 	 }
 
@@ -782,7 +796,9 @@
 		 return 1; /* ->OK */
 	 }
 	 printk(KERN_ERR "%s: can't init lance, status: %04x\n",dev->name,(int) inw(PORT+L_DATAREG));
+	 flags=claim_dma_lock();
 	 disable_dma(dev->dma);
+	 release_dma_lock(flags);
 	 return 0; /* ->Error */
 }
 
@@ -1167,8 +1183,10 @@
 }
 
 #ifdef MODULE
+static char devicename[9] = { 0, };
+
 static struct device dev_ni65 = {
-	"				",	/* "ni6510": device name inserted by net_init.c */
+	devicename,	/* "ni6510": device name inserted by net_init.c */
 	0, 0, 0, 0,
 	0x360, 9,	 /* I/O address, IRQ */
 	0, 0, 0, NULL, ni65_probe };

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov