[PATCH] Olympic - Janitor Remove save_flags/cli/restore_flags

Mike Phillips (mikep@linuxtr.net)
Sat, 16 Feb 2002 09:26:56 -0600 (CST)


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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/