[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 15/41] rapidio: convert put_page() to put_user_page*()



From: John Hubbard <jhubbard@xxxxxxxxxx>

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").

Cc: Matt Porter <mporter@xxxxxxxxxxxxxxxxxxx>
Cc: Alexandre Bounine <alex.bou9@xxxxxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Cc: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Cc: Ioan Nicu <ioan.nicu.ext@xxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
---
 drivers/rapidio/devices/rio_mport_cdev.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/rapidio/devices/rio_mport_cdev.c 
b/drivers/rapidio/devices/rio_mport_cdev.c
index 8155f59ece38..0e8ea0e5a89e 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -572,14 +572,12 @@ static void dma_req_free(struct kref *ref)
        struct mport_dma_req *req = container_of(ref, struct mport_dma_req,
                        refcount);
        struct mport_cdev_priv *priv = req->priv;
-       unsigned int i;
 
        dma_unmap_sg(req->dmach->device->dev,
                     req->sgt.sgl, req->sgt.nents, req->dir);
        sg_free_table(&req->sgt);
        if (req->page_list) {
-               for (i = 0; i < req->nr_pages; i++)
-                       put_page(req->page_list[i]);
+               put_user_pages(req->page_list, req->nr_pages);
                kfree(req->page_list);
        }
 
@@ -815,7 +813,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
        struct mport_dma_req *req;
        struct mport_dev *md = priv->md;
        struct dma_chan *chan;
-       int i, ret;
+       int ret;
        int nents;
 
        if (xfer->length == 0)
@@ -946,8 +944,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
 
 err_pg:
        if (!req->page_list) {
-               for (i = 0; i < nr_pages; i++)
-                       put_page(page_list[i]);
+               put_user_pages(page_list, nr_pages);
                kfree(page_list);
        }
 err_req:
-- 
2.22.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.