* [PATCH]is_power_of_2-myri10ge/myri10ge.c
@ 2007-06-12 5:01 vignesh babu
2007-06-13 20:17 ` [PATCH]is_power_of_2-myri10ge/myri10ge.c Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: vignesh babu @ 2007-06-12 5:01 UTC (permalink / raw)
To: akpm, jgarzik; +Cc: netdev, Kernel Janitors List
Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
---
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index b53b7ad..89da958 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -60,6 +60,7 @@
#include <linux/crc32.h>
#include <linux/moduleparam.h>
#include <linux/io.h>
+#include <linux/log2.h>
#include <net/checksum.h>
#include <asm/byteorder.h>
#include <asm/io.h>
@@ -1797,7 +1798,7 @@ static int myri10ge_open(struct net_device *dev)
*/
big_pow2 = dev->mtu + ETH_HLEN + VLAN_HLEN + MXGEFW_PAD;
if (big_pow2 < MYRI10GE_ALLOC_SIZE / 2) {
- while ((big_pow2 & (big_pow2 - 1)) != 0)
+ while (!is_power_of_2(big_pow2))
big_pow2++;
mgp->big_bytes = dev->mtu + ETH_HLEN + VLAN_HLEN + MXGEFW_PAD;
} else {
--
Vignesh Babu BM
_____________________________________________________________
"Why is it that every time I'm with you, makes me believe in magic?"
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH]is_power_of_2-myri10ge/myri10ge.c
2007-06-12 5:01 [PATCH]is_power_of_2-myri10ge/myri10ge.c vignesh babu
@ 2007-06-13 20:17 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-06-13 20:17 UTC (permalink / raw)
To: vignesh.babu; +Cc: akpm, netdev, Kernel Janitors List
vignesh babu wrote:
> Replacing (n & (n-1)) in the context of power of 2 checks
> with is_power_of_2
>
> Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Patches look OK, but please
* CC relevant driver maintainers, and
* combined all drivers/net/* patches of this nature into a single patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-13 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-12 5:01 [PATCH]is_power_of_2-myri10ge/myri10ge.c vignesh babu
2007-06-13 20:17 ` [PATCH]is_power_of_2-myri10ge/myri10ge.c Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).