Commit aeb4ac79 authored by Souptick Joarder's avatar Souptick Joarder Committed by Greg Kroah-Hartman

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: default avatarSouptick 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.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c5a3b1db
...@@ -287,12 +287,8 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo) ...@@ -287,12 +287,8 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo)
pagelistinfo->num_pages, pagelistinfo->dma_dir); pagelistinfo->num_pages, pagelistinfo->dma_dir);
} }
if (pagelistinfo->pages_need_release) { if (pagelistinfo->pages_need_release)
unsigned int i; unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
for (i = 0; i < pagelistinfo->num_pages; i++)
put_page(pagelistinfo->pages[i]);
}
dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size, dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
pagelistinfo->pagelist, pagelistinfo->dma_addr); pagelistinfo->pagelist, pagelistinfo->dma_addr);
...@@ -395,7 +391,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) ...@@ -395,7 +391,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
} }
/* do not try and release vmalloc pages */ /* do not try and release vmalloc pages */
} else { } else {
actual_pages = get_user_pages_fast( actual_pages = pin_user_pages_fast(
(unsigned long)buf & PAGE_MASK, (unsigned long)buf & PAGE_MASK,
num_pages, num_pages,
type == PAGELIST_READ, type == PAGELIST_READ,
...@@ -407,10 +403,8 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) ...@@ -407,10 +403,8 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
__func__, actual_pages, num_pages); __func__, actual_pages, num_pages);
/* This is probably due to the process being killed */ /* This is probably due to the process being killed */
while (actual_pages > 0) { if (actual_pages > 0)
actual_pages--; unpin_user_pages(pages, actual_pages);
put_page(pages[actual_pages]);
}
cleanup_pagelistinfo(pagelistinfo); cleanup_pagelistinfo(pagelistinfo);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment