Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

csky: use generic ioremap

Use the generic ioremap_prot and iounmap helpers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Guo Ren <guoren@kernel.org>

+8 -50
+1
arch/csky/Kconfig
··· 17 17 select IRQ_DOMAIN 18 18 select HANDLE_DOMAIN_IRQ 19 19 select DW_APB_TIMER_OF 20 + select GENERIC_IOREMAP 20 21 select GENERIC_LIB_ASHLDI3 21 22 select GENERIC_LIB_ASHRDI3 22 23 select GENERIC_LIB_LSHRDI3
+3 -5
arch/csky/include/asm/io.h
··· 36 36 /* 37 37 * I/O memory mapping functions. 38 38 */ 39 - extern void __iomem *__ioremap(phys_addr_t addr, size_t size, pgprot_t prot); 40 - extern void iounmap(void *addr); 41 - 42 - #define ioremap(addr, size) __ioremap((addr), (size), pgprot_noncached(PAGE_KERNEL)) 43 - #define ioremap_wc(addr, size) __ioremap((addr), (size), pgprot_writecombine(PAGE_KERNEL)) 39 + #define ioremap_wc(addr, size) \ 40 + ioremap_prot((addr), (size), \ 41 + (_PAGE_IOREMAP & ~_CACHE_MASK) | _CACHE_UNCACHED) 44 42 45 43 #include <asm-generic/io.h> 46 44
+4
arch/csky/include/asm/pgtable.h
··· 86 86 #define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ 87 87 _CACHE_CACHED) 88 88 89 + #define _PAGE_IOREMAP \ 90 + (_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL | \ 91 + _CACHE_UNCACHED | _PAGE_SO) 92 + 89 93 #define __P000 PAGE_NONE 90 94 #define __P001 PAGE_READONLY 91 95 #define __P010 PAGE_COPY
-45
arch/csky/mm/ioremap.c
··· 3 3 4 4 #include <linux/export.h> 5 5 #include <linux/mm.h> 6 - #include <linux/vmalloc.h> 7 6 #include <linux/io.h> 8 - 9 - #include <asm/pgtable.h> 10 - 11 - static void __iomem *__ioremap_caller(phys_addr_t addr, size_t size, 12 - pgprot_t prot, void *caller) 13 - { 14 - phys_addr_t last_addr; 15 - unsigned long offset, vaddr; 16 - struct vm_struct *area; 17 - 18 - last_addr = addr + size - 1; 19 - if (!size || last_addr < addr) 20 - return NULL; 21 - 22 - offset = addr & (~PAGE_MASK); 23 - addr &= PAGE_MASK; 24 - size = PAGE_ALIGN(size + offset); 25 - 26 - area = get_vm_area_caller(size, VM_IOREMAP, caller); 27 - if (!area) 28 - return NULL; 29 - 30 - vaddr = (unsigned long)area->addr; 31 - 32 - if (ioremap_page_range(vaddr, vaddr + size, addr, prot)) { 33 - free_vm_area(area); 34 - return NULL; 35 - } 36 - 37 - return (void __iomem *)(vaddr + offset); 38 - } 39 - 40 - void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot) 41 - { 42 - return __ioremap_caller(phys_addr, size, prot, 43 - __builtin_return_address(0)); 44 - } 45 - EXPORT_SYMBOL(__ioremap); 46 - 47 - void iounmap(void __iomem *addr) 48 - { 49 - vunmap((void *)((unsigned long)addr & PAGE_MASK)); 50 - } 51 - EXPORT_SYMBOL(iounmap); 52 7 53 8 pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, 54 9 unsigned long size, pgprot_t vma_prot)