Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752925AbdLSTge (ORCPT ); Tue, 19 Dec 2017 14:36:34 -0500 Received: from mga01.intel.com ([192.55.52.88]:17630 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752531AbdLSTg0 (ORCPT ); Tue, 19 Dec 2017 14:36:26 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,428,1508828400"; d="scan'208";a="4018473" From: Dongwon Kim To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, mateuszx.potrola@intel.com, dongwon.kim@intel.com Subject: [RFC PATCH 04/60] hyper_dmabuf: new index, k for pointing a right n-th page Date: Tue, 19 Dec 2017 11:29:20 -0800 Message-Id: <1513711816-2618-4-git-send-email-dongwon.kim@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513711816-2618-1-git-send-email-dongwon.kim@intel.com> References: <1513711816-2618-1-git-send-email-dongwon.kim@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1829 Lines: 57 Need a new index, k in hyper_dmabuf_extract_pgs function for picking up a correct n-th page in contigous memory space. Signed-off-by: Dongwon Kim --- drivers/xen/hyper_dmabuf/hyper_dmabuf_imp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_imp.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_imp.c index 7cb5c35..3b40ec0 100644 --- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_imp.c +++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_imp.c @@ -39,7 +39,7 @@ static int hyper_dmabuf_get_num_pgs(struct sg_table *sgt) struct hyper_dmabuf_pages_info *hyper_dmabuf_ext_pgs(struct sg_table *sgt) { struct hyper_dmabuf_pages_info *pinfo; - int i, j; + int i, j, k; int length; struct scatterlist *sgl; @@ -57,7 +57,7 @@ struct hyper_dmabuf_pages_info *hyper_dmabuf_ext_pgs(struct sg_table *sgt) pinfo->frst_ofst = sgl->offset; pinfo->pages[0] = sg_page(sgl); length = sgl->length - PAGE_SIZE + sgl->offset; - i=1; + i = 1; while (length > 0) { pinfo->pages[i] = nth_page(sg_page(sgl), i); @@ -71,12 +71,12 @@ struct hyper_dmabuf_pages_info *hyper_dmabuf_ext_pgs(struct sg_table *sgt) pinfo->pages[i++] = sg_page(sgl); length = sgl->length - PAGE_SIZE; pinfo->nents++; + k = 1; while (length > 0) { - pinfo->pages[i] = nth_page(sg_page(sgl), i); + pinfo->pages[i++] = nth_page(sg_page(sgl), k++); length -= PAGE_SIZE; pinfo->nents++; - i++; } } @@ -535,7 +535,8 @@ static int hyper_dmabuf_ops_attach(struct dma_buf* dmabuf, struct device* dev, printk("hyper_dmabuf::%s Error:send dmabuf sync request failed\n", __func__); } - return ret; + /* Ignoring ret for now */ + return 0; } static void hyper_dmabuf_ops_detach(struct dma_buf* dmabuf, struct dma_buf_attachment *attach) -- 2.7.4