* [PATCH] PCMCIA NET: Use roundup_pow_of_two() macro instead of grotesque loop.
@ 2007-11-06 14:41 Robert P. J. Day
0 siblings, 0 replies; only message in thread
From: Robert P. J. Day @ 2007-11-06 14:41 UTC (permalink / raw)
To: netdev; +Cc: Andrew Morton
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
---
i'm just going to assume that loop is rounding up to the next power
of two, right?
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index db6a97d..07eae16 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -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;
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://crashcourse.ca
========================================================================
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-06 14:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-06 14:41 [PATCH] PCMCIA NET: Use roundup_pow_of_two() macro instead of grotesque loop Robert P. J. Day
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox