aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/highmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/highmem.h')
-rw-r--r--include/linux/highmem.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 74152c08ad07..e3060ef85b6d 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -2,6 +2,7 @@
2#define _LINUX_HIGHMEM_H 2#define _LINUX_HIGHMEM_H
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/kernel.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/uaccess.h> 7#include <linux/uaccess.h>
7 8
@@ -27,7 +28,7 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
27 28
28#include <asm/kmap_types.h> 29#include <asm/kmap_types.h>
29 30
30#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT) 31#ifdef CONFIG_DEBUG_HIGHMEM
31 32
32void debug_kmap_atomic(enum km_type type); 33void debug_kmap_atomic(enum km_type type);
33 34
@@ -72,7 +73,11 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
72} 73}
73#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx) 74#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx)
74 75
75#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0) 76static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx)
77{
78 pagefault_enable();
79}
80
76#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 81#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
77#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 82#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
78 83
@@ -81,6 +86,13 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
81 86
82#endif /* CONFIG_HIGHMEM */ 87#endif /* CONFIG_HIGHMEM */
83 88
89/* Prevent people trying to call kunmap_atomic() as if it were kunmap() */
90/* kunmap_atomic() should get the return value of kmap_atomic, not the page. */
91#define kunmap_atomic(addr, idx) do { \
92 BUILD_BUG_ON(__same_type((addr), struct page *)); \
93 kunmap_atomic_notypecheck((addr), (idx)); \
94 } while (0)
95
84/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 96/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
85#ifndef clear_user_highpage 97#ifndef clear_user_highpage
86static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 98static inline void clear_user_highpage(struct page *page, unsigned long vaddr)