2009-10-18 22:49:16

by Andreas Fenkart

[permalink] [raw]
Subject: Make totalhigh_pages of consistent type.

Printing the value of totalhigh_pages requires casting, like in
this print message:

arch/x86/mm/init_32.c:
printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
"%dk reserved, %dk data, %dk init, %ldk highmem)\n",
...
(unsigned long)(totalhigh_pages << (PAGE_SHIFT-10)));

The need for casting is due to totalhigh_pages being of different
type, when CONFIG_HIGHMEM is set/unset.

include/linux/highmem.h:
#ifdef CONFIG_HIGHMEM

extern unsigned long totalhigh_pages;

#else /* CONFIG_HIGHMEM */

-#define totalhigh_pages 0
+#define totalhigh_pages 0UL
...

For C files there should be no problem, because 0/0UL are both
valid C and denote the same value. Assembly files are not
affected, since linux/highmem.h can not be included from
assembly.


2009-10-18 22:49:25

by Andreas Fenkart

[permalink] [raw]
Subject: [PATCH 1/1] Make totalhigh_pages of consistent type.

Signed-off-by: Andreas Fenkart <[email protected]>
---
include/linux/highmem.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 211ff44..ab2cc20 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -46,7 +46,7 @@ void kmap_flush_unused(void);

static inline unsigned int nr_free_highpages(void) { return 0; }

-#define totalhigh_pages 0
+#define totalhigh_pages 0UL

#ifndef ARCH_HAS_KMAP
static inline void *kmap(struct page *page)
--
1.6.4.3