aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/highmem.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-11-15 01:33:11 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2010-11-15 01:33:11 -0500
commit1bb95834bbcdc969e477a9284cf96c17a4c2616f (patch)
tree9cf66b22a611bb6bc78778c05dac72263bb45a23 /include/linux/highmem.h
parent85345517fe6d4de27b0d6ca19fef9d28ac947c4a (diff)
parenta41c73e04673b47730df682446f0d52f95e32a5b (diff)
Merge remote branch 'airlied/drm-fixes' into drm-intel-fixes
Diffstat (limited to 'include/linux/highmem.h')
-rw-r--r--include/linux/highmem.h52
1 files changed, 31 insertions, 21 deletions
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 8a85ec109a3a..b676c585574e 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -5,6 +5,7 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <linux/hardirq.h>
8 9
9#include <asm/cacheflush.h> 10#include <asm/cacheflush.h>
10 11
@@ -37,27 +38,6 @@ extern unsigned long totalhigh_pages;
37 38
38void kmap_flush_unused(void); 39void kmap_flush_unused(void);
39 40
40DECLARE_PER_CPU(int, __kmap_atomic_idx);
41
42static inline int kmap_atomic_idx_push(void)
43{
44 int idx = __get_cpu_var(__kmap_atomic_idx)++;
45#ifdef CONFIG_DEBUG_HIGHMEM
46 WARN_ON_ONCE(in_irq() && !irqs_disabled());
47 BUG_ON(idx > KM_TYPE_NR);
48#endif
49 return idx;
50}
51
52static inline int kmap_atomic_idx_pop(void)
53{
54 int idx = --__get_cpu_var(__kmap_atomic_idx);
55#ifdef CONFIG_DEBUG_HIGHMEM
56 BUG_ON(idx < 0);
57#endif
58 return idx;
59}
60
61#else /* CONFIG_HIGHMEM */ 41#else /* CONFIG_HIGHMEM */
62 42
63static inline unsigned int nr_free_highpages(void) { return 0; } 43static inline unsigned int nr_free_highpages(void) { return 0; }
@@ -95,6 +75,36 @@ static inline void __kunmap_atomic(void *addr)
95 75
96#endif /* CONFIG_HIGHMEM */ 76#endif /* CONFIG_HIGHMEM */
97 77
78#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
79
80DECLARE_PER_CPU(int, __kmap_atomic_idx);
81
82static inline int kmap_atomic_idx_push(void)
83{
84 int idx = __get_cpu_var(__kmap_atomic_idx)++;
85#ifdef CONFIG_DEBUG_HIGHMEM
86 WARN_ON_ONCE(in_irq() && !irqs_disabled());
87 BUG_ON(idx > KM_TYPE_NR);
88#endif
89 return idx;
90}
91
92static inline int kmap_atomic_idx(void)
93{
94 return __get_cpu_var(__kmap_atomic_idx) - 1;
95}
96
97static inline int kmap_atomic_idx_pop(void)
98{
99 int idx = --__get_cpu_var(__kmap_atomic_idx);
100#ifdef CONFIG_DEBUG_HIGHMEM
101 BUG_ON(idx < 0);
102#endif
103 return idx;
104}
105
106#endif
107
98/* 108/*
99 * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. 109 * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work.
100 */ 110 */