EHCI: replace mult/div with bit-mask operation
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 28 Sep 2012 20:01:40 +0000 (16:01 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Oct 2012 15:57:43 +0000 (08:57 -0700)
This patch (as1610) replaces multiplication and divison operations in
ehci-hcd's isochronous scheduling code with a bit-mask operation,
taking advantage of the fact that isochronous periods are always
powers of 2.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-sched.c

index b764cab2ab9ac65d78b88d6dc83ea986c4dde2c8..e08e65d8e0047a407136f35c4f281fd075af0a28 100644 (file)
@@ -1416,7 +1416,7 @@ iso_stream_schedule (
 
                /* Behind the scheduling threshold?  Assume URB_ISO_ASAP. */
                if (unlikely(start < next))
-                       start += period * DIV_ROUND_UP(next - start, period);
+                       start += (next - start + period - 1) & (- period);
 
                start += base;
        }