mm/gup: change GUP fast to use flags rather than a write 'bool'
[linux-2.6-microblaze.git] / arch / sh / mm / gup.c
index 3e27f6d..277c882 100644 (file)
@@ -204,7 +204,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
  * get_user_pages_fast() - pin user pages in memory
  * @start:     starting user address
  * @nr_pages:  number of pages from start to pin
- * @write:     whether pages will be written to
+ * @gup_flags: flags modifying pin behaviour
  * @pages:     array that receives pointers to the pages pinned.
  *             Should be at least nr_pages long.
  *
@@ -216,8 +216,8 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
  * requested. If nr_pages is 0 or negative, returns 0. If no pages
  * were pinned, returns -errno.
  */
-int get_user_pages_fast(unsigned long start, int nr_pages, int write,
-                       struct page **pages)
+int get_user_pages_fast(unsigned long start, int nr_pages,
+                       unsigned int gup_flags, struct page **pages)
 {
        struct mm_struct *mm = current->mm;
        unsigned long addr, len, end;
@@ -241,7 +241,8 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
                next = pgd_addr_end(addr, end);
                if (pgd_none(pgd))
                        goto slow;
-               if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
+               if (!gup_pud_range(pgd, addr, next, gup_flags & FOLL_WRITE,
+                                  pages, &nr))
                        goto slow;
        } while (pgdp++, addr = next, addr != end);
        local_irq_enable();
@@ -261,7 +262,7 @@ slow_irqon:
 
                ret = get_user_pages_unlocked(start,
                        (end - start) >> PAGE_SHIFT, pages,
-                       write ? FOLL_WRITE : 0);
+                       gup_flags);
 
                /* Have to be a bit careful with return values */
                if (nr > 0) {