Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3440118pxa; Tue, 25 Aug 2020 23:41:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNwnUXHRe8g2ECuwF8pPS41l9hBYv51y9u3xcjWCNDKgvgLZxadqsr33yIgoXQa30WTsWI X-Received: by 2002:a17:906:dc03:: with SMTP id yy3mr14857142ejb.380.1598424102975; Tue, 25 Aug 2020 23:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598424102; cv=none; d=google.com; s=arc-20160816; b=NPMfTNKXcHcmsDSe6XEuAptCEgPTVqfpC42EJBNnzNMpr91BeSfWdZAvFUWOiN9//l afjSE6KXXDw3a3zy0sndgUBkQj5rOzWO4VjQJ3Xgd+z4Xr5V6NDxZJg7ONBG4a7Qw19W h/8WBPjt1jjV8jyNRgYb6uDdhkisjH/RBWf+N4GAAf56IWh1GgYrCgMESmrCQdFevR2Q z5JhBVQt0jIROqz9Bfbb77I3EjKep8gLOVqwS3gmVak1yFZORMDugRUtINUuzrT7yUi6 T8nQ93JR82vJiDPSRfI1zHu1wpZagUpkb0ZIfq4A3fe8DjhQtzfz8S8Of4Wlu3/aCek3 R86Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=dgA8N0ViLqnC/QZEgzrc3l/K0+XnEV3AJx7m2vhhZ9o=; b=J/3cHY3Y+R7oXsGnTyGw1SMxCxn2FO8ageTD/a9KzstnoJsVqt1EIQQTM3oeJGfijG VHhgqXZtLj7kc7wX7tbyqTlnzYW2VeFf2NIELkVKUe4nG67WojB2uD1xd2dAR/oiu3PX JzORok/nAu8J/ILUTi8junP9VywNIBOQ3qqDpMGf28TQDXVOZu/ubS/wMKDCfhPusH3D OiMCJQwcle6HTdf8jqZfnFtDlvBMhCXdS+iz3hmHyM41Lws/E2Dj2FGMz51VMpSpJMxP +OFkYMoTy7ICiqMLRf4C0t45tPDu0NHSFu9XopJkvs/k1ydBIlZjKLuuaBp3G2reg06b ZPXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=siRwixq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb22si1057531ejb.152.2020.08.25.23.41.20; Tue, 25 Aug 2020 23:41:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=siRwixq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbgHZGhi (ORCPT + 99 others); Wed, 26 Aug 2020 02:37:38 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:37889 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726788AbgHZGfn (ORCPT ); Wed, 26 Aug 2020 02:35:43 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200826063535euoutp01de6411fb91a0d72980eb01a78d75b397~uvesOwsfY1717417174euoutp01c for ; Wed, 26 Aug 2020 06:35:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200826063535euoutp01de6411fb91a0d72980eb01a78d75b397~uvesOwsfY1717417174euoutp01c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1598423735; bh=dgA8N0ViLqnC/QZEgzrc3l/K0+XnEV3AJx7m2vhhZ9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=siRwixq0qBG0Qn2SJuB5/YMjcftDmJsRVhKz0TJ2IYzfgC1tUaggXPaNcR6gkzCB+ QiOyOM51FONo+vebrSvxZB9Bax6QQ9NGE8NWi+iZ2BTSQ8bcLzVAIno21Z5Lb34cIH SveSt/yqiHMePpywTOj6jHlwtF91X1hgRUm1jFZA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200826063534eucas1p270a1c2e25b72630202fda78d4f366ae5~uver8bPkT0402704027eucas1p2j; Wed, 26 Aug 2020 06:35:34 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 6F.4D.06318.6B2064F5; Wed, 26 Aug 2020 07:35:34 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200826063534eucas1p2647f5e9679f79f568e184b092f743f8b~uvermfILm0402704027eucas1p2i; Wed, 26 Aug 2020 06:35:34 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200826063534eusmtrp2e49ad1248f6754d2c01d073c550e1795~uverl2G8a0466204662eusmtrp2I; Wed, 26 Aug 2020 06:35:34 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-da-5f4602b6da51 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A1.53.06017.6B2064F5; Wed, 26 Aug 2020 07:35:34 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200826063533eusmtip22cc306bbc45cef23b492bdcd73791658~uveq_oHja0302003020eusmtip2o; Wed, 26 Aug 2020 06:35:33 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Christoph Hellwig , Robin Murphy , Bartlomiej Zolnierkiewicz , linux-arm-kernel@lists.infradead.org, David Airlie , Daniel Vetter , Matthias Brugger , Chun-Kuang Hu , Philipp Zabel , linux-mediatek@lists.infradead.org Subject: [PATCH v9 11/32] drm: mediatek: use common helper for extracting pages array Date: Wed, 26 Aug 2020 08:32:55 +0200 Message-Id: <20200826063316.23486-12-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826063316.23486-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSWUwTURSGvZ3pdECqYyFwgyjauGFkC5KMYXFBzBh9INFEY8JSYCxIC6QF ZHlgU6JlRxJJ3UoVUAqCSMqmIEQohFVABbXIHqqihi2KLLYM6Nt3/vOf+5+cXBzhadiWeHBo BC0JFYj4mDGqbvndbatmnfJ16GzeT6Z3tbHIZ3llbFKZno6Sq+pshOyf/4GRT1TNLFLR4ELO 9Y+wyIqxd2yyr/YuRvYlvwFk6Wsth0y65kRqh1pRsvHnOPvYVqrkfgmgXi4oUKpGruVQFcU3 MapqYZhNfU7VsKjnj+KpjytjCHVroAhQdYMJGJW57EBlVBYDarZipxf3krFrIC0KjqIl9u5+ xkGy5WokfNgoeiDrK5IAcnEZMMIhcRiqdd85BuYRjwHsnHJgeA7AmZWzDM8COKiM2/BPyrVs GTDW60UA3qlPWy/0A/eyOtgGF0Y4Qtm0DDOwGXEdwNZ0E4MJIV4gUFm7iBoapsQF2PmrbS0a JfbCgvKaNeYS7rCtJBVh4qyhqvzVGhvpdU1qJmZ4CBKjHNhRVYgyppOwriB/nU3hF00lh2Er uFrzgMUMJ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e4hRgoNZSYTX6ezpOCHelMTKqtSi/Pii0pzU 4kOMpkBHTWSWEk3OB8Z6Xkm8oamhuYWlobmxubGZhZI4b4fAwRghgfTEktTs1NSC1CKYPiYO TqkGxpVtrhV6Fw4ZSLnlKV2ZvXmX+YtM16gOp56HVjvf/+57zy3KJrZiyTSPnexrv18W8tn5 ZeOTvNUGkyxOXci8Vs1xXW++weQsBsmz0lPCKtZUvd3AuZF9oUHBxXvLDFl61+x9aRS/onH3 k6sMu6WMq/58fHsk+uAtbp8VQR/cZu+/2Ce2Qo+v7aYSS3FGoqEWc1FxIgCa5HSqvQIAAA== X-CMS-MailID: 20200826063534eucas1p2647f5e9679f79f568e184b092f743f8b X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200826063534eucas1p2647f5e9679f79f568e184b092f743f8b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200826063534eucas1p2647f5e9679f79f568e184b092f743f8b References: <20200826063316.23486-1-m.szyprowski@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use common helper for converting a sg_table object into struct page pointer array. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c index 3654ec732029..0583e557ad37 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c @@ -233,9 +233,7 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj) { struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj); struct sg_table *sgt; - struct sg_page_iter iter; unsigned int npages; - unsigned int i = 0; if (mtk_gem->kvaddr) return mtk_gem->kvaddr; @@ -249,11 +247,8 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj) if (!mtk_gem->pages) goto out; - for_each_sg_page(sgt->sgl, &iter, sgt->orig_nents, 0) { - mtk_gem->pages[i++] = sg_page_iter_page(&iter); - if (i > npages) - break; - } + drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages); + mtk_gem->kvaddr = vmap(mtk_gem->pages, npages, VM_MAP, pgprot_writecombine(PAGE_KERNEL)); -- 2.17.1