[patch 33/33] Convert non-highmem kmap_atomic() to static inline function

From: Geert Uytterhoeven
Date: Tue May 01 2007 - 16:36:41 EST


Convert kmap_atomic() in the non-highmem case from a macro to a static
inline function, for better type-checking and the ability to pass void
pointers instead of struct page pointers.

Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
include/linux/highmem.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

--- linux-m68k-2.6.21.orig/include/linux/highmem.h
+++ linux-m68k-2.6.21/include/linux/highmem.h
@@ -42,8 +42,14 @@ static inline void *kmap(struct page *pa

#define kunmap(page) do { (void) (page); } while (0)

-#define kmap_atomic(page, idx) \
- ({ pagefault_disable(); page_address(page); })
+#include <asm/kmap_types.h>
+
+static inline void *kmap_atomic(struct page *page, enum km_type idx)
+{
+ pagefault_disable();
+ return page_address(page);
+}
+
#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0)
#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
#define kmap_atomic_to_page(ptr) virt_to_page(ptr)

--
Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/