Skip to content

Commit

Permalink
x86: unify kmap_atomic_pfn() and iomap_atomic_prot_pfn(), fix
Browse files Browse the repository at this point in the history
Impact: build fix

Move kmap_atomic_prot_pfn() to iomap_32.c. It is used on all 32-bit
kernels, while highmem_32.c is only built on highmem kernels.

( Note: the debug_kmap_atomic_prot() check is removed for now, that
  problem is handled via another patch. )

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
LKML-Reference: <20090311143317.GA22244@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Mar 13, 2009
1 parent 12074fa commit dd63fdc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
20 changes: 2 additions & 18 deletions arch/x86/mm/highmem_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,8 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
pagefault_enable();
}

void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
{
enum fixed_addresses idx;
unsigned long vaddr;

pagefault_disable();

debug_kmap_atomic_prot(type);

idx = type + KM_TYPE_NR * smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
arch_flush_lazy_mmu_mode();

return (void*) vaddr;
}

/* This is the same as kmap_atomic() but can map memory that doesn't
/*
* This is the same as kmap_atomic() but can map memory that doesn't
* have a struct page associated with it.
*/
void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
Expand Down
18 changes: 17 additions & 1 deletion arch/x86/mm/iomap_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,23 @@ int is_io_mapping_possible(resource_size_t base, unsigned long size)
}
EXPORT_SYMBOL_GPL(is_io_mapping_possible);

/* Map 'pfn' using fixed map 'type' and protections 'prot'
void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
{
enum fixed_addresses idx;
unsigned long vaddr;

pagefault_disable();

idx = type + KM_TYPE_NR * smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
set_pte(kmap_pte - idx, pfn_pte(pfn, prot));
arch_flush_lazy_mmu_mode();

return (void *)vaddr;
}

/*
* Map 'pfn' using fixed map 'type' and protections 'prot'
*/
void *
iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
Expand Down

0 comments on commit dd63fdc

Please sign in to comment.