Skip to contentSkip to conversation

net #6

PATCH In review Andrzej Krzysztofowicz 3 participants 5 messages May 30, 2001 – May 31, 2001 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net #6

The following patch removes unnecessary #ifdefs from eexpress.c

Andrzej

************************** PATCH 6 *******************************

drivers/net/eexpress.c +2 -16
diff -uNr linux-2.4.5-ac4/drivers/net/eexpress.c linux/drivers/net/eexpress.c
@@ -574,9 +574,7 @@
 static void eexp_timeout(struct net_device *dev)
 {
 	struct net_local *lp = (struct net_local *)dev->priv;
-#ifdef CONFIG_SMP
-	unsigned long flags;
-#endif
+	unsigned long __attribute__((unused)) flags;
 	int status;
 	
 	disable_irq(dev->irq);
@@ -586,10 +584,7 @@
 	 *	lets make it work first..
 	 */
 	 
-#ifdef CONFIG_SMP
 	spin_lock_irqsave(&lp->lock, flags);
-#endif
-
 	status = scb_status(dev);
 	unstick_cu(dev);
 	printk(KERN_INFO "%s: transmit timed out, %s?\n", dev->name,
@@ -602,9 +597,7 @@
 		outb(0,dev->base_addr+SIGNAL_CA);
 	}
 	netif_wake_queue(dev);	
-#ifdef CONFIG_SMP
 	spin_unlock_irqrestore(&lp->lock, flags);
-#endif
 }
 
 /*
@@ -614,9 +607,7 @@
 static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
 {
 	struct net_local *lp = (struct net_local *)dev->priv;
-#ifdef CONFIG_SMP
-	unsigned long flags;
-#endif
+	unsigned long __attribute__((unused)) flags;
 
 #if NET_DEBUG > 6
 	printk(KERN_DEBUG "%s: eexp_xmit()\n", dev->name);
@@ -629,10 +620,7 @@
 	 *	lets make it work first..
 	 */
 	 
-#ifdef CONFIG_SMP
 	spin_lock_irqsave(&lp->lock, flags);
-#endif
-  
 	{
 		unsigned short length = (ETH_ZLEN < buf->len) ? buf->len :
 			ETH_ZLEN;
@@ -643,9 +631,7 @@
 	        eexp_hw_tx_pio(dev,data,length);
 	}
 	dev_kfree_skb(buf);
-#ifdef CONFIG_SMP
 	spin_unlock_irqrestore(&lp->lock, flags);
-#endif
 	enable_irq(dev->irq);
 	return 0;
 }
Signature · 4 lines
=======================================================================
  Andrzej M. Krzysztofowicz               [email protected]
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Technical University of Gdansk
#1 lore raw
Quoted 1 line

The following patch removes unnecessary #ifdefs from eexpress.c

They are neccessary

drivers/net/eexpress.c line 636

Quoted 9 lines
drivers/net/eexpress.c +0 -2
@@ -643,9 +631,7 @@
 	        eexp_hw_tx_pio(dev,data,length);
 	}
 	dev_kfree_skb(buf);
-#ifdef CONFIG_SMP
 	spin_unlock_irqrestore(&lp->lock, flags);
-#endif
 	enable_irq(dev->irq);
 	return 0;

They are done this way to get good non SMP performance. Your changes would ruin that.

#2 lore raw
Quoted 4 lines
Quoted 2 lines

The following patch removes unnecessary #ifdefs from eexpress.c

They are neccessary

Yes, you are right.
I was suggested by improper part of spinlock.h ...

Forget this patch.

Quoted 12 lines

drivers/net/eexpress.c line 636

Quoted 9 lines
drivers/net/eexpress.c +0 -2
@@ -643,9 +631,7 @@
 	        eexp_hw_tx_pio(dev,data,length);
 	}
 	dev_kfree_skb(buf);
-#ifdef CONFIG_SMP
 	spin_unlock_irqrestore(&lp->lock, flags);
-#endif
 	enable_irq(dev->irq);
 	return 0;

They are done this way to get good non SMP performance. Your changes would ruin that.

Signature · 4 lines
=======================================================================
  Andrzej M. Krzysztofowicz               [email protected]
  tel.  (0-58) 347 14 61
Wydz.Fizyki Technicznej i Matematyki Stosowanej Politechniki Gdanskiej
#3 lore raw
In reply to Andrzej Krzysztofowicz

Hi!

Quoted 14 lines

They are neccessary

drivers/net/eexpress.c line 636

Quoted 9 lines
drivers/net/eexpress.c +0 -2
@@ -643,9 +631,7 @@
 	        eexp_hw_tx_pio(dev,data,length);
 	}
 	dev_kfree_skb(buf);
-#ifdef CONFIG_SMP
 	spin_unlock_irqrestore(&lp->lock, flags);
-#endif
 	enable_irq(dev->irq);
 	return 0;

They are done this way to get good non SMP performance. Your changes would ruin that.

Maybe macro "spin_lock_irqsave_on_smp()" would be good idea? These ifdefs look ugly. Maybe local to driver, maybe even global.
Pavel

Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]
#4 lore raw
Quoted 5 lines
Quoted 2 lines

They are done this way to get good non SMP performance. Your changes would ruin that.

Maybe macro "spin_lock_irqsave_on_smp()" would be good idea? These ifdefs look ugly. Maybe local to driver, maybe even global.

I had that argument with Linus about globally and ended up with ifdefs. I agree about locally - feel free