diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 16:40:26 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 16:40:26 (GMT) |
commit | 9f3938346a5c1fa504647670edb5fea5756cfb00 (patch) | |
tree | 7cf6d24d6b076c8db8571494984924cac03703a2 /include/linux | |
parent | 69a7aebcf019ab3ff5764525ad6858fbe23bb86d (diff) | |
parent | 317b6e128247f75976b0fc2b9fd8d2c20ef13b3a (diff) | |
download | linux-fsl-qoriq-9f3938346a5c1fa504647670edb5fea5756cfb00.tar.xz |
Merge branch 'kmap_atomic' of git://github.com/congwang/linux
Pull kmap_atomic cleanup from Cong Wang.
It's been in -next for a long time, and it gets rid of the (no longer
used) second argument to k[un]map_atomic().
Fix up a few trivial conflicts in various drivers, and do an "evil
merge" to catch some new uses that have come in since Cong's tree.
* 'kmap_atomic' of git://github.com/congwang/linux: (59 commits)
feature-removal-schedule.txt: schedule the deprecated form of kmap_atomic() for removal
highmem: kill all __kmap_atomic() [swarren@nvidia.com: highmem: Fix ARM build break due to __kmap_atomic rename]
drbd: remove the second argument of k[un]map_atomic()
zcache: remove the second argument of k[un]map_atomic()
gma500: remove the second argument of k[un]map_atomic()
dm: remove the second argument of k[un]map_atomic()
tomoyo: remove the second argument of k[un]map_atomic()
sunrpc: remove the second argument of k[un]map_atomic()
rds: remove the second argument of k[un]map_atomic()
net: remove the second argument of k[un]map_atomic()
mm: remove the second argument of k[un]map_atomic()
lib: remove the second argument of k[un]map_atomic()
power: remove the second argument of k[un]map_atomic()
kdb: remove the second argument of k[un]map_atomic()
udf: remove the second argument of k[un]map_atomic()
ubifs: remove the second argument of k[un]map_atomic()
squashfs: remove the second argument of k[un]map_atomic()
reiserfs: remove the second argument of k[un]map_atomic()
ocfs2: remove the second argument of k[un]map_atomic()
ntfs: remove the second argument of k[un]map_atomic()
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bio.h | 8 | ||||
-rw-r--r-- | include/linux/highmem.h | 79 |
2 files changed, 61 insertions, 26 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 129a9c0..de5422a 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -101,10 +101,10 @@ static inline int bio_has_allocated_vec(struct bio *bio) * I/O completely on that queue (see ide-dma for example) */ #define __bio_kmap_atomic(bio, idx, kmtype) \ - (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \ + (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ bio_iovec_idx((bio), (idx))->bv_offset) -#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) +#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) /* * merge helpers etc @@ -317,7 +317,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) * balancing is a lot nicer this way */ local_irq_save(*flags); - addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ); + addr = (unsigned long) kmap_atomic(bvec->bv_page); BUG_ON(addr & ~PAGE_MASK); @@ -328,7 +328,7 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) { unsigned long ptr = (unsigned long) buffer & PAGE_MASK; - kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); + kunmap_atomic((void *) ptr); local_irq_restore(*flags); } diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 3a93f73..6549ed7 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -55,12 +55,12 @@ static inline void kunmap(struct page *page) { } -static inline void *__kmap_atomic(struct page *page) +static inline void *kmap_atomic(struct page *page) { pagefault_disable(); return page_address(page); } -#define kmap_atomic_prot(page, prot) __kmap_atomic(page) +#define kmap_atomic_prot(page, prot) kmap_atomic(page) static inline void __kunmap_atomic(void *addr) { @@ -109,27 +109,62 @@ static inline void kmap_atomic_idx_pop(void) #endif /* - * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. + * NOTE: + * kmap_atomic() and kunmap_atomic() with two arguments are deprecated. + * We only keep them for backward compatibility, any usage of them + * are now warned. */ -#define kmap_atomic(page, args...) __kmap_atomic(page) + +#define PASTE(a, b) a ## b +#define PASTE2(a, b) PASTE(a, b) + +#define NARG_(_2, _1, n, ...) n +#define NARG(...) NARG_(__VA_ARGS__, 2, 1, :) + +static inline void __deprecated *kmap_atomic_deprecated(struct page *page, + enum km_type km) +{ + return kmap_atomic(page); +} + +#define kmap_atomic1(...) kmap_atomic(__VA_ARGS__) +#define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__) +#define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__)) + +static inline void __deprecated __kunmap_atomic_deprecated(void *addr, + enum km_type km) +{ + __kunmap_atomic(addr); +} /* * Prevent people trying to call kunmap_atomic() as if it were kunmap() * kunmap_atomic() should get the return value of kmap_atomic, not the page. */ -#define kunmap_atomic(addr, args...) \ -do { \ - BUILD_BUG_ON(__same_type((addr), struct page *)); \ - __kunmap_atomic(addr); \ +#define kunmap_atomic_deprecated(addr, km) \ +do { \ + BUILD_BUG_ON(__same_type((addr), struct page *)); \ + __kunmap_atomic_deprecated(addr, km); \ } while (0) +#define kunmap_atomic_withcheck(addr) \ +do { \ + BUILD_BUG_ON(__same_type((addr), struct page *)); \ + __kunmap_atomic(addr); \ +} while (0) + +#define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__) +#define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__) +#define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__)) +/**** End of C pre-processor tricks for deprecated macros ****/ + /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ #ifndef clear_user_highpage static inline void clear_user_highpage(struct page *page, unsigned long vaddr) { - void *addr = kmap_atomic(page, KM_USER0); + void *addr = kmap_atomic(page); clear_user_page(addr, vaddr, page); - kunmap_atomic(addr, KM_USER0); + kunmap_atomic(addr); } #endif @@ -180,16 +215,16 @@ alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma, static inline void clear_highpage(struct page *page) { - void *kaddr = kmap_atomic(page, KM_USER0); + void *kaddr = kmap_atomic(page); clear_page(kaddr); - kunmap_atomic(kaddr, KM_USER0); + kunmap_atomic(kaddr); } static inline void zero_user_segments(struct page *page, unsigned start1, unsigned end1, unsigned start2, unsigned end2) { - void *kaddr = kmap_atomic(page, KM_USER0); + void *kaddr = kmap_atomic(page); BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); @@ -199,7 +234,7 @@ static inline void zero_user_segments(struct page *page, if (end2 > start2) memset(kaddr + start2, 0, end2 - start2); - kunmap_atomic(kaddr, KM_USER0); + kunmap_atomic(kaddr); flush_dcache_page(page); } @@ -228,11 +263,11 @@ static inline void copy_user_highpage(struct page *to, struct page *from, { char *vfrom, *vto; - vfrom = kmap_atomic(from, KM_USER0); - vto = kmap_atomic(to, KM_USER1); + vfrom = kmap_atomic(from); + vto = kmap_atomic(to); copy_user_page(vto, vfrom, vaddr, to); - kunmap_atomic(vto, KM_USER1); - kunmap_atomic(vfrom, KM_USER0); + kunmap_atomic(vto); + kunmap_atomic(vfrom); } #endif @@ -241,11 +276,11 @@ static inline void copy_highpage(struct page *to, struct page *from) { char *vfrom, *vto; - vfrom = kmap_atomic(from, KM_USER0); - vto = kmap_atomic(to, KM_USER1); + vfrom = kmap_atomic(from); + vto = kmap_atomic(to); copy_page(vto, vfrom); - kunmap_atomic(vto, KM_USER1); - kunmap_atomic(vfrom, KM_USER0); + kunmap_atomic(vto); + kunmap_atomic(vfrom); } #endif /* _LINUX_HIGHMEM_H */ |