[lkml]   [2007]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH] Cast page_to_pfn to unsigned long in CONFIG_SPARSEMEM
* Dave Hansen ( wrote:
> The only thing I might suggest doing differently is actually using the
> page_to_pfn() definition itself:
> memory_model.h:#define page_to_pfn __page_to_pfn
> The full inline function version should do this already, and we
> shouldn't have any real direct __page_to_pfn() users anyway.

Like this then..

Cast page_to_pfn to unsigned long in CONFIG_SPARSEMEM

Make sure the type returned by page_to_pfn is always unsigned long. If we
don't cast it explicitly, it can be int on i386, but long on x86_64. This is
especially inelegant for printks.

Signed-off-by: Mathieu Desnoyers <>
CC: Dave Hansen <>
include/asm-generic/memory_model.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6-lttng/include/asm-generic/memory_model.h
--- linux-2.6-lttng.orig/include/asm-generic/memory_model.h 2007-11-19 15:06:40.000000000 -0500
+++ linux-2.6-lttng/include/asm-generic/memory_model.h 2007-11-19 15:18:57.000000000 -0500
@@ -76,7 +76,7 @@ struct page;
extern struct page *pfn_to_page(unsigned long pfn);
extern unsigned long page_to_pfn(struct page *page);
-#define page_to_pfn __page_to_pfn
+#define page_to_pfn ((unsigned long)__page_to_pfn)
#define pfn_to_page __pfn_to_page

Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-11-19 21:23    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean