mmap locking API: use coccinelle to convert mmap_sem rwsem call sites
[linux-2.6-microblaze.git] / arch / powerpc / mm / book3s64 / subpage_prot.c
index 25a0c04..e814d34 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/hugetlb.h>
 #include <linux/syscalls.h>
 
-#include <asm/pgtable.h>
+#include <linux/pgtable.h>
 #include <linux/uaccess.h>
 
 /*
@@ -94,7 +94,7 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len)
        size_t nw;
        unsigned long next, limit;
 
-       down_write(&mm->mmap_sem);
+       mmap_write_lock(mm);
 
        spt = mm_ctx_subpage_prot(&mm->context);
        if (!spt)
@@ -129,7 +129,7 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len)
        }
 
 err_out:
-       up_write(&mm->mmap_sem);
+       mmap_write_unlock(mm);
 }
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -219,7 +219,7 @@ SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
        if (!access_ok(map, (len >> PAGE_SHIFT) * sizeof(u32)))
                return -EFAULT;
 
-       down_write(&mm->mmap_sem);
+       mmap_write_lock(mm);
 
        spt = mm_ctx_subpage_prot(&mm->context);
        if (!spt) {
@@ -269,11 +269,11 @@ SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
                if (addr + (nw << PAGE_SHIFT) > next)
                        nw = (next - addr) >> PAGE_SHIFT;
 
-               up_write(&mm->mmap_sem);
+               mmap_write_unlock(mm);
                if (__copy_from_user(spp, map, nw * sizeof(u32)))
                        return -EFAULT;
                map += nw;
-               down_write(&mm->mmap_sem);
+               mmap_write_lock(mm);
 
                /* now flush any existing HPTEs for the range */
                hpte_flush_range(mm, addr, nw);
@@ -282,6 +282,6 @@ SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
                spt->maxaddr = limit;
        err = 0;
  out:
-       up_write(&mm->mmap_sem);
+       mmap_write_unlock(mm);
        return err;
 }