Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3439146pxa; Tue, 25 Aug 2020 23:39:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEqdmcIShD0AHvo8vdj82GABDgxk//03gdm4pIjWwdT3UelHJVv5OTxJlb7uGAb4ODUEiq X-Received: by 2002:a17:906:1b04:: with SMTP id o4mr15068473ejg.332.1598423943643; Tue, 25 Aug 2020 23:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598423943; cv=none; d=google.com; s=arc-20160816; b=yKkIDSyunUqJTMZu9vI+ZRK5W3VjMEn3dj5WNl1SeUKniMPq8kN/XkFIvyg1dfDj8p a5wftSmkf2O/Dykkn20GxNpe+oEtuEp9qbJJhErfHblQzya/XnTMVvLmF7RvUQ8RIonE HqvX7XPcu4fZs7t3HfMS10Qs3DqKaCjt7skHZ/WNQGNR3O17/AXkNFioyDiWAofEm4Uf hR4GzK6Z0OlUaLqKmEI+eNuUhhEpcN39x+zw2F089riaHrPMjmxHOfwvRVnGC100oGOZ 12lePQ6d+hvj3+r41bz7GO9hSoyFMt0cgbgZen2pmf+vaZHUyvlSBIgEeYPQGlmjertG 0D9Q== 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=zV96V2vYwfqZCBn3pFDPDrE8ppfbK/CRdkHj1ScotiE=; b=DDYWXMKq9YbF4OePc0rlLyyIGA1ojjB8YBIK2jlZTDVbKsMavUMX5SOYuyvQZCPaKN Uu+qtd189wttg8F/HMSxLY6Z1rhMWcYgPH51OAst/aQDbfrn7+nsUIBiwNtB7kjCLB0N CYR2kNF/O6TMqOABoAa0rRANR0yw12QFt3XdE9ATyRR4FJRO3Ze+Kb6bReGpW5W/mZzU KCRMua6vJKEHqWmdahszabbYKCSmeUEI5p7sa5bdV1dguc39FaM8Ny2bXSGcMzI8sbNh jzbXEAKRdB7KdC952lRGDbarMFbN7dX2lVWjtKfPSfK8gUecm3vLlhGSJv1zyx/oKfPf O5WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="H/n4Er4Q"; 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 m23si222313edb.377.2020.08.25.23.38.40; Tue, 25 Aug 2020 23:39:03 -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="H/n4Er4Q"; 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 S1727821AbgHZGhT (ORCPT + 99 others); Wed, 26 Aug 2020 02:37:19 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:37899 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbgHZGfn (ORCPT ); Wed, 26 Aug 2020 02:35:43 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200826063536euoutp01d18c2cf2a241fd9f9d2dfe4517a5850d~uvetm3Yiu1716617166euoutp01k for ; Wed, 26 Aug 2020 06:35:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200826063536euoutp01d18c2cf2a241fd9f9d2dfe4517a5850d~uvetm3Yiu1716617166euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1598423736; bh=zV96V2vYwfqZCBn3pFDPDrE8ppfbK/CRdkHj1ScotiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/n4Er4QPzOzSuBCHYZw4AYdG8dzKqwLbK2C1KNnt8kEf5IkDGqbuauGQXqFYLQ2V VMfRbqh9brPDqXDLT4hVn/UbhQkA27zpzPvVBtWtX/ksqJF1Q99MhZMy1V1mfdmCtz 7PcZYNW/Pcqu9bWFPtJ/+AuDgvOvuYIT4bPmax7g= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200826063536eucas1p25c5d5de87b71359b29111176bb2cee4a~uvetR1RSu0398703987eucas1p2c; Wed, 26 Aug 2020 06:35:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F3.33.06456.7B2064F5; Wed, 26 Aug 2020 07:35:36 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200826063535eucas1p1a98e3295a64f14d475371ac0b003782f~uveswhcCT1942019420eucas1p1p; Wed, 26 Aug 2020 06:35:35 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200826063535eusmtrp137e167fd92381384774e4ac4e5ac322a~uvesv43Nj1091110911eusmtrp1V; Wed, 26 Aug 2020 06:35:35 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-c7-5f4602b7af8f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 42.D0.06314.7B2064F5; Wed, 26 Aug 2020 07:35:35 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200826063534eusmtip21435f3c414f0a9927d8816cfb94d420e~uvesM5GtN0092200922eusmtip2z; Wed, 26 Aug 2020 06:35:34 +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 , Tomi Valkeinen Subject: [PATCH v9 13/32] drm: omapdrm: use common helper for extracting pages array Date: Wed, 26 Aug 2020 08:32:57 +0200 Message-Id: <20200826063316.23486-14-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: H4sIAAAAAAAAA0WSe0hTYRjG+c7Zzs50s+MU/FJRGBSUpElBhwyt0DpEQnQzjNSVB5WcyqaW /tM0FZvOSyapZY4QbN4znctMc6WzzBXeWGpeUDHNaeWlEnLteMz++73P+7zv8/Lx4aionuuM R8XE07IYSbQYs+Fou34b9+mQE6H7M2sQUmV8i5BPi+q4pEWbj5IDq0sYqanqREh1uw+5MjCJ kA1TQ1yyv+UhRta8+cwjO75Nc8m6smHsqICqflQNqJdrag7VvDbBpcazDAj1rPwWNbIxhVIF pgpAvfikwKicxkpAGUzNCLXc4HbGNtjmSDgdHZVIy7x8w2wiB0sLsbgi25uLcxpUAdL5SsDH IXEQjr/PR5TABhcRTwD8MrTGY4sVAFNyVRy2WAYw4/sQ99/IcknqVqMCwLRRC7o9sjhRjzAu jPCGSrMSY9iRSAewWyVgTCihR2Bj+iCHaTgQF6FhXbHJHGIXzGmwAIaFhC/U9uo4bJw7rKp/ hTLMt+qGrFyM1dt4cP6dvRLgVvaHC812rOwA5w2NPJZdYU9B9ualkLgN4KSxhscW2QD2pxYB 1uUDR43rGLMIJfbAuhYvVj4Gm5R3MHa/HTSZ7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Ts1tSC1CKaPiYNTqoExsOiDYNk3/0OXvWLWz4q67dmUrb6B h9/cZ4OJcxyv+7qbGV/T93p37+MymdNfVcg6bfuaa6eX1Vt/ZVyY2iq8fd9EnkUfny7L8a1Q mHBTsNyq+/xmr4LpRi92vQrfnvxcbaFE3vEyuRefedJbJfUj7HfrTi+dcXRuVNCNzyHFAsFJ Ox6qBWkosRRnJBpqMRcVJwIARoD5MKcCAAA= X-CMS-MailID: 20200826063535eucas1p1a98e3295a64f14d475371ac0b003782f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200826063535eucas1p1a98e3295a64f14d475371ac0b003782f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200826063535eucas1p1a98e3295a64f14d475371ac0b003782f 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/omapdrm/omap_gem.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index d0d12d5dd76c..ff0c4b0c3fd0 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -1297,10 +1297,9 @@ struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size, omap_obj->dma_addr = sg_dma_address(sgt->sgl); } else { /* Create pages list from sgt */ - struct sg_page_iter iter; struct page **pages; unsigned int npages; - unsigned int i = 0; + unsigned int ret; npages = DIV_ROUND_UP(size, PAGE_SIZE); pages = kcalloc(npages, sizeof(*pages), GFP_KERNEL); @@ -1311,14 +1310,9 @@ struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size, } omap_obj->pages = pages; - - for_each_sg_page(sgt->sgl, &iter, sgt->orig_nents, 0) { - pages[i++] = sg_page_iter_page(&iter); - if (i > npages) - break; - } - - if (WARN_ON(i != npages)) { + ret = drm_prime_sg_to_page_addr_arrays(sgt, pages, NULL, + npages); + if (WARN_ON(ret)) { omap_gem_free_object(obj); obj = ERR_PTR(-ENOMEM); goto done; -- 2.17.1