]> err.no Git - linux-2.6/commitdiff
[PATCH] sky2: ring distance optimization
authorStephen Hemminger <shemminger@osdl.org>
Fri, 9 Dec 2005 19:34:59 +0000 (11:34 -0800)
committerJeff Garzik <jgarzik@pobox.com>
Mon, 12 Dec 2005 20:27:20 +0000 (15:27 -0500)
Faster way to compute ring distance.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/sky2.c

index eae270d81808f4240458480b8d6957ada8ea2917..2dd46a05fb30d26f13401e0940f6a571ba4b6952 100644 (file)
@@ -1039,7 +1039,7 @@ err_out:
 /* 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 */