patch-2.1.126 linux/drivers/block/xd.c

Next file: linux/drivers/cdrom/cdu31a.c
Previous file: linux/drivers/block/loop.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.125/linux/drivers/block/xd.c linux/drivers/block/xd.c
@@ -533,6 +533,8 @@
 /* xd_setup_dma: set up the DMA controller for a data transfer */
 static u_char xd_setup_dma (u_char mode,u_char *buffer,u_int count)
 {
+	unsigned long f;
+	
 	if (nodma)
 		return (PIO_MODE);
 	if (((u_int) buffer & 0xFFFF0000) != (((u_int) buffer + count) & 0xFFFF0000)) {
@@ -541,11 +543,15 @@
 #endif /* DEBUG_OTHER */
 		return (PIO_MODE);
 	}
+	
+	f=claim_dma_lock();
 	disable_dma(xd_dma);
 	clear_dma_ff(xd_dma);
 	set_dma_mode(xd_dma,mode);
 	set_dma_addr(xd_dma,(u_int) buffer);
 	set_dma_count(xd_dma,count);
+	
+	release_dma_lock(f);
 
 	return (DMA_MODE);			/* use DMA and INT */
 }
@@ -597,13 +603,22 @@
 
 static inline u_int xd_wait_for_IRQ (void)
 {
+	unsigned long flags;
 	xd_watchdog_int.expires = jiffies + 8 * HZ;
 	add_timer(&xd_watchdog_int);
+	
+	flags=claim_dma_lock();
 	enable_dma(xd_dma);
+	release_dma_lock(flags);
+	
 	sleep_on(&xd_wait_int);
 	del_timer(&xd_watchdog_int);
 	xdc_busy = 0;
+	
+	flags=claim_dma_lock();
 	disable_dma(xd_dma);
+	release_dma_lock(flags);
+	
 	if (xd_error) {
 		printk("xd: missed IRQ - command aborted\n");
 		xd_error = 0;

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