mm, vmalloc: change iterating a vmlist to find_vm_area()
[linux-3.10.git] / arch / unicore32 / mm / ioremap.c
index b7a6055..13068ee 100644 (file)
@@ -235,7 +235,7 @@ EXPORT_SYMBOL(__uc32_ioremap_cached);
 void __uc32_iounmap(volatile void __iomem *io_addr)
 {
        void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
-       struct vm_struct **p, *tmp;
+       struct vm_struct *vm;
 
        /*
         * If this is a section based mapping we need to handle it
@@ -244,17 +244,10 @@ void __uc32_iounmap(volatile void __iomem *io_addr)
         * all the mappings before the area can be reclaimed
         * by someone else.
         */
-       write_lock(&vmlist_lock);
-       for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
-               if ((tmp->flags & VM_IOREMAP) && (tmp->addr == addr)) {
-                       if (tmp->flags & VM_UNICORE_SECTION_MAPPING) {
-                               unmap_area_sections((unsigned long)tmp->addr,
-                                                   tmp->size);
-                       }
-                       break;
-               }
-       }
-       write_unlock(&vmlist_lock);
+       vm = find_vm_area(addr);
+       if (vm && (vm->flags & VM_IOREMAP) &&
+               (vm->flags & VM_UNICORE_SECTION_MAPPING))
+               unmap_area_sections((unsigned long)vm->addr, vm->size);
 
        vunmap(addr);
 }