summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSouptick Joarder <jrdr.linux@gmail.com>2020-06-02 21:54:17 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-18 10:53:21 +0300
commitaeb4ac7916ce6120e764303b50917c7a2b8b0eba (patch)
treebce4a1d564014df2559335a3cf7d63c95f61debd
parentc5a3b1db6af24b9c9a3ea0b027a1d71c171b545d (diff)
downloadlinux-aeb4ac7916ce6120e764303b50917c7a2b8b0eba.tar.xz
staging: vc04_services: Convert get_user_pages*() --> pin_user_pages*()
In 2019, we introduced pin_user_pages*() and now we are converting get_user_pages*() to the new API as appropriate. [1] & [2] could be referred for more information. [1] Documentation/core-api/pin_user_pages.rst [2] "Explicit pinning of user-space pages": https://lwn.net/Articles/807108/ Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Cc: John Hubbard <jhubbard@nvidia.com> Link: https://lore.kernel.org/r/1591124057-27696-1-git-send-email-jrdr.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 38a13e4618a8..46160139933e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -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;
}