diff options
Diffstat (limited to 'include/linux/highmem.h')
| -rw-r--r-- | include/linux/highmem.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index caafd0561aa1..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 | ||
| @@ -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) | 76 | static 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 |
| 86 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) | 98 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) |
