All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ][PATCH]is_power_of_2-drm/drm_bufs.c
@ 2007-06-07 10:09 vignesh babu
  0 siblings, 0 replies; only message in thread
From: vignesh babu @ 2007-06-07 10:09 UTC (permalink / raw)
  To: kernel-janitors



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/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index c113458..f6c35a3 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -34,6 +34,7 @@
  */
 
 #include <linux/vmalloc.h>
+#include <linux/log2.h>
 #include "drmP.h"
 
 unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource)
@@ -1653,7 +1654,7 @@ int drm_order(unsigned long size)
 
 	for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ;
 
-	if (size & (size - 1))
+	if (!is_power_of_2(size))
 		++order;
 
 	return order;

-- 
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-07 10:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 10:09 [KJ][PATCH]is_power_of_2-drm/drm_bufs.c vignesh babu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.