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

m68k: rename __iounmap and mark it static

m68k uses __iounmap as the name for an internal helper that is only
used for some CPU types. Mark it static, give it a better name
and move it around a bit to avoid a forward declaration.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

+50 -51
-1
arch/m68k/include/asm/kmap.h
··· 20 20 int cacheflag); 21 21 #define iounmap iounmap 22 22 extern void iounmap(void __iomem *addr); 23 - extern void __iounmap(void *addr, unsigned long size); 24 23 25 24 #define ioremap ioremap 26 25 static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
+50 -50
arch/m68k/mm/kmap.c
··· 54 54 55 55 static struct vm_struct *iolist; 56 56 57 + /* 58 + * __free_io_area unmaps nearly everything, so be careful 59 + * Currently it doesn't free pointer/page tables anymore but this 60 + * wasn't used anyway and might be added later. 61 + */ 62 + static void __free_io_area(void *addr, unsigned long size) 63 + { 64 + unsigned long virtaddr = (unsigned long)addr; 65 + pgd_t *pgd_dir; 66 + pmd_t *pmd_dir; 67 + pte_t *pte_dir; 68 + 69 + while ((long)size > 0) { 70 + pgd_dir = pgd_offset_k(virtaddr); 71 + if (pgd_bad(*pgd_dir)) { 72 + printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir)); 73 + pgd_clear(pgd_dir); 74 + return; 75 + } 76 + pmd_dir = pmd_offset(pgd_dir, virtaddr); 77 + 78 + if (CPU_IS_020_OR_030) { 79 + int pmd_off = (virtaddr/PTRTREESIZE) & 15; 80 + int pmd_type = pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK; 81 + 82 + if (pmd_type == _PAGE_PRESENT) { 83 + pmd_dir->pmd[pmd_off] = 0; 84 + virtaddr += PTRTREESIZE; 85 + size -= PTRTREESIZE; 86 + continue; 87 + } else if (pmd_type == 0) 88 + continue; 89 + } 90 + 91 + if (pmd_bad(*pmd_dir)) { 92 + printk("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir)); 93 + pmd_clear(pmd_dir); 94 + return; 95 + } 96 + pte_dir = pte_offset_kernel(pmd_dir, virtaddr); 97 + 98 + pte_val(*pte_dir) = 0; 99 + virtaddr += PAGE_SIZE; 100 + size -= PAGE_SIZE; 101 + } 102 + 103 + flush_tlb_all(); 104 + } 105 + 57 106 static struct vm_struct *get_io_area(unsigned long size) 58 107 { 59 108 unsigned long addr; ··· 139 90 if (tmp->addr == addr) { 140 91 *p = tmp->next; 141 92 /* remove gap added in get_io_area() */ 142 - __iounmap(tmp->addr, tmp->size - IO_SIZE); 93 + __free_io_area(tmp->addr, tmp->size - IO_SIZE); 143 94 kfree(tmp); 144 95 return; 145 96 } ··· 297 248 #endif 298 249 } 299 250 EXPORT_SYMBOL(iounmap); 300 - 301 - /* 302 - * __iounmap unmaps nearly everything, so be careful 303 - * Currently it doesn't free pointer/page tables anymore but this 304 - * wasn't used anyway and might be added later. 305 - */ 306 - void __iounmap(void *addr, unsigned long size) 307 - { 308 - unsigned long virtaddr = (unsigned long)addr; 309 - pgd_t *pgd_dir; 310 - pmd_t *pmd_dir; 311 - pte_t *pte_dir; 312 - 313 - while ((long)size > 0) { 314 - pgd_dir = pgd_offset_k(virtaddr); 315 - if (pgd_bad(*pgd_dir)) { 316 - printk("iounmap: bad pgd(%08lx)\n", pgd_val(*pgd_dir)); 317 - pgd_clear(pgd_dir); 318 - return; 319 - } 320 - pmd_dir = pmd_offset(pgd_dir, virtaddr); 321 - 322 - if (CPU_IS_020_OR_030) { 323 - int pmd_off = (virtaddr/PTRTREESIZE) & 15; 324 - int pmd_type = pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK; 325 - 326 - if (pmd_type == _PAGE_PRESENT) { 327 - pmd_dir->pmd[pmd_off] = 0; 328 - virtaddr += PTRTREESIZE; 329 - size -= PTRTREESIZE; 330 - continue; 331 - } else if (pmd_type == 0) 332 - continue; 333 - } 334 - 335 - if (pmd_bad(*pmd_dir)) { 336 - printk("iounmap: bad pmd (%08lx)\n", pmd_val(*pmd_dir)); 337 - pmd_clear(pmd_dir); 338 - return; 339 - } 340 - pte_dir = pte_offset_kernel(pmd_dir, virtaddr); 341 - 342 - pte_val(*pte_dir) = 0; 343 - virtaddr += PAGE_SIZE; 344 - size -= PAGE_SIZE; 345 - } 346 - 347 - flush_tlb_all(); 348 - } 349 251 350 252 /* 351 253 * Set new cache mode for some kernel address space.