staging: vc04_services: Convert get_user_pages*() --> pin_user_pages*()
[sfrench/cifs-2.6.git] / drivers / staging / vc04_services / interface / vchiq_arm / vchiq_2835_arm.c
index 38a13e4618a851c83ea1ce48db1e28cbf02b4eb0..46160139933e4a5feb90bd3fb66f4417c1eb888f 100644 (file)
@@ -287,12 +287,8 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo)
                             pagelistinfo->num_pages, pagelistinfo->dma_dir);
        }
 
-       if (pagelistinfo->pages_need_release) {
-               unsigned int i;
-
-               for (i = 0; i < pagelistinfo->num_pages; i++)
-                       put_page(pagelistinfo->pages[i]);
-       }
+       if (pagelistinfo->pages_need_release)
+               unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
 
        dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
                          pagelistinfo->pagelist, pagelistinfo->dma_addr);
@@ -395,7 +391,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
                }
                /* do not try and release vmalloc pages */
        } else {
-               actual_pages = get_user_pages_fast(
+               actual_pages = pin_user_pages_fast(
                                          (unsigned long)buf & PAGE_MASK,
                                          num_pages,
                                          type == PAGELIST_READ,
@@ -407,10 +403,8 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
                                       __func__, actual_pages, num_pages);
 
                        /* This is probably due to the process being killed */
-                       while (actual_pages > 0) {
-                               actual_pages--;
-                               put_page(pages[actual_pages]);
-                       }
+                       if (actual_pages > 0)
+                               unpin_user_pages(pages, actual_pages);
                        cleanup_pagelistinfo(pagelistinfo);
                        return NULL;
                }