Skip to contentSkip to conversation

BLACKFIN: cleanup - use _AC macro to define PAGE_SIZE

PATCH Applied Cyrill Gorcunov 2 participants 6 messages Feb 3, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/4 AVR32: cleanup - use _AC macro to define PAGE_SIZE

---

 page.h |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
include/asm-avr32/page.h +3 -5
Index: linux-2.6.git/include/asm-avr32/page.h
===================================================================
@@ -10,13 +10,11 @@
 
 #ifdef __KERNEL__
 
+#include <linux/const.h>
+
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT	12
-#ifdef __ASSEMBLY__
-#define PAGE_SIZE	(1 << PAGE_SHIFT)
-#else
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#endif
+#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 #define PTE_MASK	PAGE_MASK
 
#2 lore raw

Re: [patch 1/4] AVR32: cleanup - use _AC macro to define PAGE_SIZE

[removed bogus @atmel.co address from Cc]

Quoted 1 line · On Sun, 03 Feb 2008 14:22:18 +0300 Cyrill Gorcunov <[email protected]> wrote:

Applied, thanks.

I found myself having to grep through include/linux to figure out what this _AC macro was really all about, so I added this to the description:

PAGE_SIZE is used both from assembly and C code. We want to have type specifiers when using it from C, but this will make the assembler confused, so we need to make it conditional.

This is exactly what the _AC macro is for, so using it allows us to get rid of a few lines of cpp noise.

My first thought was "Autoconf", and it sent shivers down my spine ;-)

Haavard

#3 lore raw

Re: [patch 1/4] AVR32: cleanup - use _AC macro to define PAGE_SIZE

[Haavard Skinnemoen - Sun, Feb 03, 2008 at 02:25:06PM +0100]

| [removed bogus @atmel.co address from Cc]
| 
| On Sun, 03 Feb 2008 14:22:18 +0300
| Cyrill Gorcunov <[email protected]> wrote:
| 
| > Signed-off-by: Cyrill Gorcunov <[email protected]>
| 
| Applied, thanks.
| 
| I found myself having to grep through include/linux to figure out what
| this _AC macro was really all about, so I added this to the description:
| 
|     PAGE_SIZE is used both from assembly and C code. We want to have type
|     specifiers when using it from C, but this will make the assembler
|     confused, so we need to make it conditional.
|     
|     This is exactly what the _AC macro is for, so using it allows us to
|     get rid of a few lines of cpp noise.
| 
| My first thought was "Autoconf", and it sent shivers down my spine ;-)
| 
| Haavard
| 

Thanks, Haavard. (btw, really good joke about Autoconf ;-)

- Cyrill -

#4 lore raw

PATCH 2/4 BLACKFIN: cleanup - use _AC macro to define PAGE_SIZE

In reply to a message not in the archive

---

 page.h |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
include/asm-blackfin/page.h +3 -5
Index: linux-2.6.git/include/asm-blackfin/page.h
===================================================================
@@ -1,14 +1,12 @@
 #ifndef _BLACKFIN_PAGE_H
 #define _BLACKFIN_PAGE_H
 
+#include <linux/const.h>
+
 /* PAGE_SHIFT determines the page size */
 
 #define PAGE_SHIFT	12
-#ifdef __ASSEMBLY__
-#define PAGE_SIZE	(1 << PAGE_SHIFT)
-#else
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#endif
+#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 
 #ifdef __KERNEL__
#5 lore raw

PATCH 3/4 FRV: cleanup - use _AC macro to define PAGE_SIZE

In reply to a message not in the archive

---

 mem-layout.h |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
include/asm-frv/mem-layout.h +3 -7
Index: linux-2.6.git/include/asm-frv/mem-layout.h
===================================================================
@@ -12,6 +12,8 @@
 #ifndef _ASM_MEM_LAYOUT_H
 #define _ASM_MEM_LAYOUT_H
 
+#include <linux/const.h>
+
 #ifndef __ASSEMBLY__
 #define __UL(X)	((unsigned long) (X))
 #else
@@ -22,13 +24,7 @@
  * PAGE_SHIFT determines the page size
  */
 #define PAGE_SHIFT			14
-
-#ifndef __ASSEMBLY__
-#define PAGE_SIZE			(1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE			(1 << PAGE_SHIFT)
-#endif
-
+#define PAGE_SIZE			(_AC(1, UL) << PAGE_SHIFT)
 #define PAGE_MASK			(~(PAGE_SIZE-1))
 
 /*****************************************************************************/
#6 lore raw

PATCH 4/4 SPARC: cleanup - use _AC macro to define PAGE_SIZE

In reply to a message not in the archive

---

 page.h |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
include/asm-sparc/page.h +4 -7
Index: linux-2.6.git/include/asm-sparc/page.h
===================================================================
@@ -10,18 +10,15 @@
 
 #ifdef __KERNEL__
 
+#include <linux/const.h>
+
 #ifdef CONFIG_SUN4
 #define PAGE_SHIFT   13
 #else
 #define PAGE_SHIFT   12
 #endif
-#ifndef __ASSEMBLY__
-/* I have my suspicions... -DaveM */
-#define PAGE_SIZE    (1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE    (1 << PAGE_SHIFT)
-#endif
-#define PAGE_MASK    (~(PAGE_SIZE-1))
+#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
+#define PAGE_MASK	(~(PAGE_SIZE-1))
 
 #include <asm/btfixup.h>