public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Olympic - Janitor Remove save_flags/cli/restore_flags
@ 2002-02-16 15:26 Mike Phillips
  2002-02-20 20:16 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Phillips @ 2002-02-16 15:26 UTC (permalink / raw)
  To: Jeff Garzik, Linux Kernel Mailing List


Another janitor patch for olympic to replace the save_flags/cli/restore
flags sequence with spin_locks.

Thanks
Mike Phillips
Linux Token Ring Project
http://www.linuxtr.net

diff -urN -X~/dontdiff linux-2.4.17-vanilla/drivers/net/tokenring/olympic.c linux-2.4.17-production/net/tokenring/olympic.c
--- linux-2.4.17-vanilla/drivers/net/tokengring/olympic.c	Sat Feb  9 11:45:22 2002
+++ linux-2.4.17-production/drivers/net/tokenring/olympic.c	Sat Feb 16 08:26:26 2002
@@ -433,8 +433,6 @@
 	do {
 		int i;
 
-		save_flags(flags);
-		cli();
 		for(i=0;i<SRB_COMMAND_SIZE;i+=4)
 			writel(0,init_srb+i);
 		if(SRB_COMMAND_SIZE & 2)
@@ -465,10 +463,12 @@
 			memcpy(dev->dev_addr,olympic_priv->olympic_laa,dev->addr_len) ;  
 		} 	
 		writeb(1,init_srb+30);
-	
+
+		spin_lock_irqsave(&olympic_priv->olympic_lock,flags);	
 		olympic_priv->srb_queued=1;
 
 		writel(LISR_SRB_CMD,olympic_mmio+LISR_SUM);
+		spin_unlock_irqrestore(&olympic_priv->olympic_lock,flags);
 
 		t = jiffies ; 
 	
@@ -496,7 +496,6 @@
 		remove_wait_queue(&olympic_priv->srb_wait,&wait) ; 
 		set_current_state(TASK_RUNNING) ; 
 
-		restore_flags(flags);
 #if OLYMPIC_DEBUG
 		printk("init_srb(%p): ",init_srb);
 		for(i=0;i<20;i++)
@@ -1058,12 +1057,11 @@
 	writeb(0,srb+1);
 	writeb(OLYMPIC_CLEAR_RET_CODE,srb+2);
 
-	save_flags(flags);
-	cli();	
-
+	spin_lock_irqsave(&olympic_priv->olympic_lock,flags);
 	olympic_priv->srb_queued=1;
 
 	writel(LISR_SRB_CMD,olympic_mmio+LISR_SUM);
+	spin_unlock_irqrestore(&olympic_priv->olympic_lock,flags);
 	
 	t = jiffies ; 
 
@@ -1088,7 +1086,6 @@
 	remove_wait_queue(&olympic_priv->srb_wait,&wait) ; 
 	set_current_state(TASK_RUNNING) ; 
 
-	restore_flags(flags) ; 
 	olympic_priv->rx_status_last_received++;
 	olympic_priv->rx_status_last_received&=OLYMPIC_RX_RING_SIZE-1;
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Olympic - Janitor Remove save_flags/cli/restore_flags
  2002-02-16 15:26 [PATCH] Olympic - Janitor Remove save_flags/cli/restore_flags Mike Phillips
@ 2002-02-20 20:16 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2002-02-20 20:16 UTC (permalink / raw)
  To: Mike Phillips; +Cc: Linux Kernel Mailing List

applied to 2.4 and 2.5
-- 
Jeff Garzik      | "Why is it that attractive girls like you
Building 1024    |  always seem to have a boyfriend?"
MandrakeSoft     | "Because I'm a nympho that owns a brewery?"
                 |             - BBC TV show "Coupling"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-20 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-16 15:26 [PATCH] Olympic - Janitor Remove save_flags/cli/restore_flags Mike Phillips
2002-02-20 20:16 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox