mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
ARM: simplify __iounmap() when dealing with section based mapping
Firstly, there is no need to have a double pointer here as we're only walking the vmlist and not modifying it. Secondly, for the same reason, we don't need a write lock but only a read lock here, since the lock only protects the coherency of the list nothing else. Lastly, the reason for holding a lock is not what the comment says, so let's remove that misleading piece of information. Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
This commit is contained in:
parent
0536bdf33f
commit
6ee723a657
1 changed files with 9 additions and 11 deletions
|
@ -314,26 +314,24 @@ void __iounmap(volatile void __iomem *io_addr)
|
||||||
{
|
{
|
||||||
void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
|
void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
|
||||||
#ifndef CONFIG_SMP
|
#ifndef CONFIG_SMP
|
||||||
struct vm_struct **p, *tmp;
|
struct vm_struct *vm;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a section based mapping we need to handle it
|
* If this is a section based mapping we need to handle it
|
||||||
* specially as the VM subsystem does not know how to handle
|
* specially as the VM subsystem does not know how to handle
|
||||||
* such a beast. We need the lock here b/c we need to clear
|
* such a beast.
|
||||||
* all the mappings before the area can be reclaimed
|
|
||||||
* by someone else.
|
|
||||||
*/
|
*/
|
||||||
write_lock(&vmlist_lock);
|
read_lock(&vmlist_lock);
|
||||||
for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
|
for (vm = vmlist; vm; vm = vm->next) {
|
||||||
if ((tmp->flags & VM_IOREMAP) && (tmp->addr == addr)) {
|
if ((vm->flags & VM_IOREMAP) && (vm->addr == addr)) {
|
||||||
if (tmp->flags & VM_ARM_SECTION_MAPPING) {
|
if (vm->flags & VM_ARM_SECTION_MAPPING) {
|
||||||
unmap_area_sections((unsigned long)tmp->addr,
|
unmap_area_sections((unsigned long)vm->addr,
|
||||||
tmp->size);
|
vm->size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write_unlock(&vmlist_lock);
|
read_unlock(&vmlist_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vunmap(addr);
|
vunmap(addr);
|
||||||
|
|
Loading…
Reference in a new issue