Patchwork SPARC: Simplify code using is_power_of_2() routine.

login
register
mail settings
Submitter Robert P. J. Day
Date April 24, 2009, 1:58 p.m.
Message ID <alpine.LFD.2.00.0904240957240.17234@localhost.localdomain>
Download mbox | patch
Permalink /patch/26412/
State Accepted
Delegated to: David Miller
Headers show

Comments

Robert P. J. Day - April 24, 2009, 1:58 p.m.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - June 4, 2009, 9:02 a.m.
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
Date: Fri, 24 Apr 2009 09:58:24 -0400 (EDT)

> 
> Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

Applied to sparc-next-2.6, thanks!
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 06c9a7d..ade4eb3 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -19,6 +19,7 @@ 
 #include <linux/fs.h>
 #include <linux/seq_file.h>
 #include <linux/kdebug.h>
+#include <linux/log2.h>

 #include <asm/bitext.h>
 #include <asm/page.h>
@@ -349,7 +350,7 @@  static void srmmu_free_nocache(unsigned long vaddr, int size)
 		    vaddr, srmmu_nocache_end);
 		BUG();
 	}
-	if (size & (size-1)) {
+	if (!is_power_of_2(size)) {
 		printk("Size 0x%x is not a power of 2\n", size);
 		BUG();
 	}