From patchwork Sun Aug 4 22:48:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: john.hubbard@gmail.com X-Patchwork-Id: 11075393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9536813A4 for ; Sun, 4 Aug 2019 22:52:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81E66287B4 for ; Sun, 4 Aug 2019 22:52:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 749152882A; Sun, 4 Aug 2019 22:52:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 10EC0287B4 for ; Sun, 4 Aug 2019 22:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0WYtvdta6WWhVba75pMxNNz6mfHYjJHc7aNZ9PNUl8g=; b=iU2bSy/C9GjXS7 B2de4i/QQG+OIaUY/kE8ZpW8fLChGS8c6nF3VBTvu2Fye+HJ4Woqi/Dw5815zsOEpK4ejq2qdpnO3 miEqX9akoKp3AWbTXcefWSmnlSm6bQp8WhA/xnl9/nsHJgqL1qyGamb4t1VZJqYqsvPMlQCxEBHzX 5PF+uL1J9PhGBwuvWZzplCidYfj6BhfpvtHBugvIl893k5HHNR9RFjHpJ7wswGtYfgt5pd+X2WOY2 aXYwEEARqL6+zt2bvmXVb2CyThCzBN/vOOqAUX0sKVs0uEyv3RAS7mY4623rYBhsTGsbgb8fgrgR3 vFXZ2sHx4z2jisx2NwHw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1huPMk-0000s8-7o; Sun, 04 Aug 2019 22:52:38 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1huPJk-00055B-IK; Sun, 04 Aug 2019 22:49:35 +0000 Received: by mail-pg1-x543.google.com with SMTP id w3so1454993pgt.13; Sun, 04 Aug 2019 15:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=51+On65LrNSvXr2lp5EjmvkWwZiof+VzaE7I05DxrV4=; b=QsDIsK9f5PFinVSypvUnfmtXaz3kPWnYRiMB+PRzxsxoVwE1/PGQPLzli5akhJljj8 QOVfD3ESRzP4SmFLgRw8ezjrLknuphEkET2wTeMPtNXVFRvcIEp8+hl2krxX0FhUKmfA FRVi5e/1Sd4ss6uRAZ/WTu2/Fdxsq5+uVpAz9kYcpHza4AYNfJ0v5Fv4Qq1jCOLlPy1H nf4XWPgdgkGPokpib4Th3GTGYdM/mIIHrXhq16b9yHFMzXKgGdn6k4irDUbg4quFTiHg KhiWe4DxW1uTVha/j+uVAZq73ruzBvFGvmOtPz78/ybeCNmcmkWr/Nh3pU4xyYgYNctD P1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=51+On65LrNSvXr2lp5EjmvkWwZiof+VzaE7I05DxrV4=; b=XrrFIG0AquRW9Gy612FhW1xJ676neh4FC2Dr7ysVY0ihRMjI5T4NT13g9f/ntFX5dY yIq1oTrpMgsZD3v4P339/bCu10Jj7mzJTG0u2N2W0ofk2JZrxRr44pIeWiNElKkc+cPc 1sa2akbJ7hl4Y/+2mcf4qlqL93/Z2bHva0xeKS1wwXgftYbXDS+gvSGuV//wqug+Gk65 rtWgFnqZ7Zchi7eypXs3ppX4IenxCzwbJGBxcOwTbOIHtxOueeo4KqtSi6eOfCZ/auIw AK+Yuv2qBisT4uv9Xzt5G0HCKbFPbqMgWoLPzPzP+U7Bn2oe4BuGRg0ZhTNbPIbcRePf EYtw== X-Gm-Message-State: APjAAAWNFtCI1IDOcNIhGkaXA1nH0ZL97ZibxxLjLohmIJ2SGdgWc29T yPOeuAc6EDI7xycYPmrAULA= X-Google-Smtp-Source: APXvYqwvBDogXJUfkkciG6MhUnx/OJ8ZeMIFfpBlRE5wKf4uSOTmFfk+/5+dEgtOxTw0423kYep5pg== X-Received: by 2002:a17:90a:384d:: with SMTP id l13mr15518641pjf.86.1564958971827; Sun, 04 Aug 2019 15:49:31 -0700 (PDT) Received: from blueforge.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id r6sm35946836pjb.22.2019.08.04.15.49.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 15:49:31 -0700 (PDT) From: john.hubbard@gmail.com X-Google-Original-From: jhubbard@nvidia.com To: Andrew Morton Subject: [PATCH v2 08/34] media/ivtv: convert put_page() to put_user_page*() Date: Sun, 4 Aug 2019 15:48:49 -0700 Message-Id: <20190804224915.28669-9-jhubbard@nvidia.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190804224915.28669-1-jhubbard@nvidia.com> References: <20190804224915.28669-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190804_154933_562234_D416DF59 X-CRM114-Status: GOOD ( 12.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Jan Kara , kvm@vger.kernel.org, Dave Hansen , Dave Chinner , dri-devel@lists.freedesktop.org, linux-mm@kvack.org, sparclinux@vger.kernel.org, Ira Weiny , ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, rds-devel@oss.oracle.com, linux-rdma@vger.kernel.org, x86@kernel.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Jason Gunthorpe , xen-devel@lists.xenproject.org, devel@lists.orangefs.org, linux-media@vger.kernel.org, John Hubbard , intel-gfx@lists.freedesktop.org, linux-block@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , linux-rpi-kernel@lists.infradead.org, Dan Williams , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-nfs@vger.kernel.org, Andy Walls , netdev@vger.kernel.org, LKML , linux-xfs@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fsdevel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: John Hubbard 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: Andy Walls Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: John Hubbard --- drivers/media/pci/ivtv/ivtv-udma.c | 14 ++++---------- drivers/media/pci/ivtv/ivtv-yuv.c | 11 +++-------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-udma.c b/drivers/media/pci/ivtv/ivtv-udma.c index 5f8883031c9c..7c7f33c2412b 100644 --- a/drivers/media/pci/ivtv/ivtv-udma.c +++ b/drivers/media/pci/ivtv/ivtv-udma.c @@ -92,7 +92,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, { struct ivtv_dma_page_info user_dma; struct ivtv_user_dma *dma = &itv->udma; - int i, err; + int err; IVTV_DEBUG_DMA("ivtv_udma_setup, dst: 0x%08x\n", (unsigned int)ivtv_dest_addr); @@ -119,8 +119,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n", err, user_dma.page_count); if (err >= 0) { - for (i = 0; i < err; i++) - put_page(dma->map[i]); + put_user_pages(dma->map, err); return -EINVAL; } return err; @@ -130,9 +129,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, /* Fill SG List with new values */ if (ivtv_udma_fill_sg_list(dma, &user_dma, 0) < 0) { - for (i = 0; i < dma->page_count; i++) { - put_page(dma->map[i]); - } + put_user_pages(dma->map, dma->page_count); dma->page_count = 0; return -ENOMEM; } @@ -153,7 +150,6 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, void ivtv_udma_unmap(struct ivtv *itv) { struct ivtv_user_dma *dma = &itv->udma; - int i; IVTV_DEBUG_INFO("ivtv_unmap_user_dma\n"); @@ -170,9 +166,7 @@ void ivtv_udma_unmap(struct ivtv *itv) ivtv_udma_sync_for_cpu(itv); /* Release User Pages */ - for (i = 0; i < dma->page_count; i++) { - put_page(dma->map[i]); - } + put_user_pages(dma->map, dma->page_count); dma->page_count = 0; } diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c index cd2fe2d444c0..2c61a11d391d 100644 --- a/drivers/media/pci/ivtv/ivtv-yuv.c +++ b/drivers/media/pci/ivtv/ivtv-yuv.c @@ -30,7 +30,6 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, struct yuv_playback_info *yi = &itv->yuv_info; u8 frame = yi->draw_frame; struct yuv_frame_info *f = &yi->new_frame_info[frame]; - int i; int y_pages, uv_pages; unsigned long y_buffer_offset, uv_buffer_offset; int y_decode_height, uv_decode_height, y_size; @@ -81,8 +80,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, uv_pages, uv_dma.page_count); if (uv_pages >= 0) { - for (i = 0; i < uv_pages; i++) - put_page(dma->map[y_pages + i]); + put_user_pages(&dma->map[y_pages], uv_pages); rc = -EFAULT; } else { rc = uv_pages; @@ -93,8 +91,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, y_pages, y_dma.page_count); } if (y_pages >= 0) { - for (i = 0; i < y_pages; i++) - put_page(dma->map[i]); + put_user_pages(dma->map, y_pages); /* * Inherit the -EFAULT from rc's * initialization, but allow it to be @@ -112,9 +109,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, /* Fill & map SG List */ if (ivtv_udma_fill_sg_list (dma, &uv_dma, ivtv_udma_fill_sg_list (dma, &y_dma, 0)) < 0) { IVTV_DEBUG_WARN("could not allocate bounce buffers for highmem userspace buffers\n"); - for (i = 0; i < dma->page_count; i++) { - put_page(dma->map[i]); - } + put_user_pages(dma->map, dma->page_count); dma->page_count = 0; return -ENOMEM; }