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.h41
1 files changed, 1 insertions, 40 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index d3999b4e26cc..774fa47b3b5b 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -110,54 +110,15 @@ static inline void kmap_atomic_idx_pop(void)
110#endif 110#endif
111 111
112/* 112/*
113 * NOTE:
114 * kmap_atomic() and kunmap_atomic() with two arguments are deprecated.
115 * We only keep them for backward compatibility, any usage of them
116 * are now warned.
117 */
118
119#define PASTE(a, b) a ## b
120#define PASTE2(a, b) PASTE(a, b)
121
122#define NARG_(_2, _1, n, ...) n
123#define NARG(...) NARG_(__VA_ARGS__, 2, 1, :)
124
125static inline void __deprecated *kmap_atomic_deprecated(struct page *page,
126 enum km_type km)
127{
128 return kmap_atomic(page);
129}
130
131#define kmap_atomic1(...) kmap_atomic(__VA_ARGS__)
132#define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__)
133#define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
134
135static inline void __deprecated __kunmap_atomic_deprecated(void *addr,
136 enum km_type km)
137{
138 __kunmap_atomic(addr);
139}
140
141/*
142 * Prevent people trying to call kunmap_atomic() as if it were kunmap() 113 * Prevent people trying to call kunmap_atomic() as if it were kunmap()
143 * kunmap_atomic() should get the return value of kmap_atomic, not the page. 114 * kunmap_atomic() should get the return value of kmap_atomic, not the page.
144 */ 115 */
145#define kunmap_atomic_deprecated(addr, km) \ 116#define kunmap_atomic(addr) \
146do { \
147 BUILD_BUG_ON(__same_type((addr), struct page *)); \
148 __kunmap_atomic_deprecated(addr, km); \
149} while (0)
150
151#define kunmap_atomic_withcheck(addr) \
152do { \ 117do { \
153 BUILD_BUG_ON(__same_type((addr), struct page *)); \ 118 BUILD_BUG_ON(__same_type((addr), struct page *)); \
154 __kunmap_atomic(addr); \ 119 __kunmap_atomic(addr); \
155} while (0) 120} while (0)
156 121
157#define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__)
158#define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__)
159#define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
160/**** End of C pre-processor tricks for deprecated macros ****/
161 122
162/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 123/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
163#ifndef clear_user_highpage 124#ifndef clear_user_highpage