aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2011-11-25 09:08:45 -0500
committerCong Wang <xiyou.wangcong@gmail.com>2012-03-20 09:48:13 -0400
commit980c19e3f8ca1d5d43cce588059ea78cac27062a (patch)
tree35e9bea10a21ba78ba6fa58650c4ee6d18877f41 /include
parentc16fa4f2ad19908a47c63d8fa436a1178438c7e7 (diff)
highmem: mark k[un]map_atomic() with two arguments as deprecated
For backward compatibility, we still keep the deprecated form, and will warn the users if they still use the deprecated one, like this: drivers/block/drbd/drbd_bitmap.c: In function ‘bm_page_io_async’: drivers/block/drbd/drbd_bitmap.c:973:3: warning: ‘kmap_atomic_deprecated’ is deprecated (declared at /home/wangcong/linux-2.6/include/linux/highmem.h:124) drivers/block/drbd/drbd_bitmap.c:977:3: warning: ‘kunmap_atomic_deprecated’ is deprecated (declared at /home/wangcong/linux-2.6/include/linux/highmem.h:144) Thanks to Nick Bowler for the cpp trick! Cc: Cesar Eduardo Barros <cesarb@cesarb.net> Cc: Nick Bowler <nbowler@elliptictech.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Cong Wang <amwang@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/highmem.h52
1 files changed, 46 insertions, 6 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 3a93f73a8acc..11617a835cf2 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -109,20 +109,60 @@ static inline void kmap_atomic_idx_pop(void)
109#endif 109#endif
110 110
111/* 111/*
112 * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. 112 * NOTE:
113 * kmap_atomic() and kunmap_atomic() with two arguments are deprecated.
114 * We only keep them for backward compatibility, any usage of them
115 * are now warned.
113 */ 116 */
114#define kmap_atomic(page, args...) __kmap_atomic(page) 117
118#define PASTE(a, b) a ## b
119#define PASTE2(a, b) PASTE(a, b)
120
121#define NARG_(_2, _1, n, ...) n
122#define NARG(...) NARG_(__VA_ARGS__, 2, 1, :)
123
124static inline void *kmap_atomic(struct page *page)
125{
126 return __kmap_atomic(page);
127}
128
129static inline void __deprecated *kmap_atomic_deprecated(struct page *page,
130 enum km_type km)
131{
132 return __kmap_atomic(page);
133}
134
135#define kmap_atomic1(...) kmap_atomic(__VA_ARGS__)
136#define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__)
137#define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
138
139static inline void __deprecated __kunmap_atomic_deprecated(void *addr,
140 enum km_type km)
141{
142 __kunmap_atomic(addr);
143}
115 144
116/* 145/*
117 * Prevent people trying to call kunmap_atomic() as if it were kunmap() 146 * Prevent people trying to call kunmap_atomic() as if it were kunmap()
118 * kunmap_atomic() should get the return value of kmap_atomic, not the page. 147 * kunmap_atomic() should get the return value of kmap_atomic, not the page.
119 */ 148 */
120#define kunmap_atomic(addr, args...) \ 149#define kunmap_atomic_deprecated(addr, km) \
121do { \ 150do { \
122 BUILD_BUG_ON(__same_type((addr), struct page *)); \ 151 BUILD_BUG_ON(__same_type((addr), struct page *)); \
123 __kunmap_atomic(addr); \ 152 __kunmap_atomic_deprecated(addr, km); \
124} while (0) 153} while (0)
125 154
155#define kunmap_atomic_withcheck(addr) \
156do { \
157 BUILD_BUG_ON(__same_type((addr), struct page *)); \
158 __kunmap_atomic(addr); \
159} while (0)
160
161#define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__)
162#define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__)
163#define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
164/**** End of C pre-processor tricks for deprecated macros ****/
165
126/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 166/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
127#ifndef clear_user_highpage 167#ifndef clear_user_highpage
128static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 168static inline void clear_user_highpage(struct page *page, unsigned long vaddr)