Commit a8e23a29 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Linus Torvalds

mm,x86: fix kmap_atomic_push vs ioremap_32.c

It appears i386 uses kmap_atomic infrastructure regardless of
CONFIG_HIGHMEM which results in a compile error when highmem is disabled.

Cure this by providing the needed few bits for both CONFIG_HIGHMEM and
CONFIG_X86_32.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Reported-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 12ba8d1e
...@@ -37,27 +37,6 @@ extern unsigned long totalhigh_pages; ...@@ -37,27 +37,6 @@ extern unsigned long totalhigh_pages;
void kmap_flush_unused(void); void kmap_flush_unused(void);
DECLARE_PER_CPU(int, __kmap_atomic_idx);
static inline int kmap_atomic_idx_push(void)
{
int idx = __get_cpu_var(__kmap_atomic_idx)++;
#ifdef CONFIG_DEBUG_HIGHMEM
WARN_ON_ONCE(in_irq() && !irqs_disabled());
BUG_ON(idx > KM_TYPE_NR);
#endif
return idx;
}
static inline int kmap_atomic_idx_pop(void)
{
int idx = --__get_cpu_var(__kmap_atomic_idx);
#ifdef CONFIG_DEBUG_HIGHMEM
BUG_ON(idx < 0);
#endif
return idx;
}
#else /* CONFIG_HIGHMEM */ #else /* CONFIG_HIGHMEM */
static inline unsigned int nr_free_highpages(void) { return 0; } static inline unsigned int nr_free_highpages(void) { return 0; }
...@@ -95,6 +74,31 @@ static inline void __kunmap_atomic(void *addr) ...@@ -95,6 +74,31 @@ static inline void __kunmap_atomic(void *addr)
#endif /* CONFIG_HIGHMEM */ #endif /* CONFIG_HIGHMEM */
#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
DECLARE_PER_CPU(int, __kmap_atomic_idx);
static inline int kmap_atomic_idx_push(void)
{
int idx = __get_cpu_var(__kmap_atomic_idx)++;
#ifdef CONFIG_DEBUG_HIGHMEM
WARN_ON_ONCE(in_irq() && !irqs_disabled());
BUG_ON(idx > KM_TYPE_NR);
#endif
return idx;
}
static inline int kmap_atomic_idx_pop(void)
{
int idx = --__get_cpu_var(__kmap_atomic_idx);
#ifdef CONFIG_DEBUG_HIGHMEM
BUG_ON(idx < 0);
#endif
return idx;
}
#endif
/* /*
* Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work.
*/ */
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
#include <linux/kgdb.h> #include <linux/kgdb.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
DEFINE_PER_CPU(int, __kmap_atomic_idx);
#endif
/* /*
* Virtual_count is not a pure "count". * Virtual_count is not a pure "count".
* 0 means that it is not mapped, and has not been mapped * 0 means that it is not mapped, and has not been mapped
...@@ -43,7 +48,6 @@ unsigned long totalhigh_pages __read_mostly; ...@@ -43,7 +48,6 @@ unsigned long totalhigh_pages __read_mostly;
EXPORT_SYMBOL(totalhigh_pages); EXPORT_SYMBOL(totalhigh_pages);
DEFINE_PER_CPU(int, __kmap_atomic_idx);
EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx); EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx);
unsigned int nr_free_highpages (void) unsigned int nr_free_highpages (void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment