2019-08-07 01:35:22

by John Hubbard

[permalink] [raw]
Subject: [PATCH v3 17/41] staging/vc04_services: convert put_page() to put_user_page*()

From: John Hubbard <[email protected]>

For pages that were retained via get_user_pages*(), release those pages
via the new put_user_page*() routines, instead of via put_page() or
release_pages().

This is part a tree-wide conversion, as described in commit fc1d8e7cca2d
("mm: introduce put_user_page*(), placeholder versions").

Acked-by: Greg Kroah-Hartman <[email protected]>

Cc: Eric Anholt <[email protected]>
Cc: Stefan Wahren <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Mihaela Muraru <[email protected]>
Cc: Suniel Mahesh <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Sidong Yang <[email protected]>
Cc: Kishore KP <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: John Hubbard <[email protected]>
---
.../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 ++--------
1 file changed, 2 insertions(+), 8 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 61c69f353cdb..ec92b4c50e95 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
@@ -336,10 +336,7 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo)
}

if (pagelistinfo->pages_need_release) {
- unsigned int i;
-
- for (i = 0; i < pagelistinfo->num_pages; i++)
- put_page(pagelistinfo->pages[i]);
+ put_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
}

dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
@@ -454,10 +451,7 @@ 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]);
- }
+ put_user_pages(pages, actual_pages);
cleanup_pagelistinfo(pagelistinfo);
return NULL;
}
--
2.22.0