[PATCH] sky2: ring distance optimization
Faster way to compute ring distance.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index eae270d..2dd46a0 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1039,7 +1039,7 @@
/* Modular subtraction in ring */
static inline int tx_dist(unsigned tail, unsigned head)
{
- return (head >= tail ? head : head + TX_RING_SIZE) - tail;
+ return (head - tail) % TX_RING_SIZE;
}
/* Number of list elements available for next tx */