]> err.no Git - linux-2.6/commitdiff
pcmcia net: use roundup_pow_of_two() macro instead of grotesque loop
authorRobert P. J. Day <rpjday@crashcourse.ca>
Fri, 14 Dec 2007 00:02:55 +0000 (16:02 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:07:19 +0000 (15:07 -0800)
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/pcmcia/pcnet_cs.c

index 51bbd582f16c2ef40b0d508127d5bb39eb8ea39d..9ba56aa26a1b2326f8a684b1c68166297e781185 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/delay.h>
 #include <linux/ethtool.h>
 #include <linux/netdevice.h>
+#include <linux/log2.h>
 #include "../8390.h"
 
 #include <pcmcia/cs_types.h>
@@ -1484,8 +1485,7 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
        window_size = 32 * 1024;
 
     /* Make sure it's a power of two.  */
-    while ((window_size & (window_size - 1)) != 0)
-       window_size += window_size & ~(window_size - 1);
+    window_size = roundup_pow_of_two(window_size);
 
     /* Allocate a memory window */
     req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;