From patchwork Tue Dec 8 09:04:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 339714 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp3618995ejs; Tue, 8 Dec 2020 01:07:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyy3XH5SNpH3A6ZvemAzgSWI+Nf61yvaC59eVRGkTk5xuYghqOppYn925jaKqugKhPn5RtF X-Received: by 2002:a17:906:a43:: with SMTP id x3mr21689866ejf.197.1607418453598; Tue, 08 Dec 2020 01:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607418453; cv=none; d=google.com; s=arc-20160816; b=D+iSTkCNGhD0Lyjpi52kS4SYs5jiapCAAnbqIkV3IeZw9Vg/1uAxCUwL2i2nYwjDR1 KGViMfQJaLsksUldDrIHaCEzfpgY2030yf9MjrP61ec75179Di1cEoqoIrFn+d7WtOj5 ZjKHS2laYJoWW4zXE0DBXK89zDYL4F5cCjs7ulshiIy9AtbP+fEnX74Zpw6nG+IcSVQW j/AFqj+xw4k0vf50hykMc6bmBrZG+HPUXDCTY2p05nWLSeib0sHRPQaQZdrHbHbnIe1q QgTRpNz2vz4lOf9kEosjbFgZA1ubSLD0ISASas+LD9284dDjM6D21Cv0rZ3t8eue8Xk0 pTdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GcxwvtwaXqOgpXBurlcj+/JKCfjnKyirXPuoynaLPoY=; b=o7uBWGlrv7grX6YEMmzSGMfZPx9sqB2ujhUX/6mIl7RFjS451gqb1WiuJ2uvCM2ElB l+gSip0VkAr4xOnt0YPTI4aPM8CoMiZFv/5FBbf9IYgz1wUfOJhyXexC2RTIZWdsqwI2 W40k+A2EsMgWJVTZbYUId1/44v4Fi+ZDMudcE0DbhLHkPGhE8/ENkQqzMhvv5LChArii JMw+GFZxu3HXGVOJkVtVPeW+KAhQNXp3S23HqsOd7a/9TThSxJARGUdPRlkApYHmgCwP tUfWRCiZl0LWxlFLgVnxCrzrPAxw4TvL/76yIe3ADpbXA1dPWzXXar7bDuuprOQGsTXN IEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=apRsOq7b; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si9973884edz.265.2020.12.08.01.07.33; Tue, 08 Dec 2020 01:07:33 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-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=@ti.com header.s=ti-com-17Q1 header.b=apRsOq7b; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728841AbgLHJGD (ORCPT + 6 others); Tue, 8 Dec 2020 04:06:03 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:34510 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728810AbgLHJGD (ORCPT ); Tue, 8 Dec 2020 04:06:03 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0B894N4j002895; Tue, 8 Dec 2020 03:04:23 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1607418263; bh=GcxwvtwaXqOgpXBurlcj+/JKCfjnKyirXPuoynaLPoY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=apRsOq7bqa8HwcsGXFIVMkYhG12Z6bvoS+Kn0hQxWBOFgx5GUauZdC5hW2E3C0lMU kt12Q+KWnWQJ//bZSMT4Jn75pHgDZmiiMczV7SzYwJkCkRCzbQnY9ZQCt43B7UZg5U S0BgCz80Y/W5FmhS/okyEra9YoxFvicxx4DyXdwA= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0B894Nts095659 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 8 Dec 2020 03:04:23 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 8 Dec 2020 03:04:22 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 8 Dec 2020 03:04:22 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0B893dcF120112; Tue, 8 Dec 2020 03:04:19 -0600 From: Peter Ujfalusi To: , , , CC: , , , , , , , Subject: [PATCH v3 10/20] dmaengine: dmatest: Use dmaengine_get_dma_device Date: Tue, 8 Dec 2020 11:04:30 +0200 Message-ID: <20201208090440.31792-11-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201208090440.31792-1-peter.ujfalusi@ti.com> References: <20201208090440.31792-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org By using the dmaengine_get_dma_device() to get the device for dma_api use, the dmatest can support per channel coherency if it is supported by the DMA controller. Signed-off-by: Peter Ujfalusi --- drivers/dma/dmatest.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index a3a172173e34..f696246f57fd 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -573,6 +573,7 @@ static int dmatest_func(void *data) struct dmatest_params *params; struct dma_chan *chan; struct dma_device *dev; + struct device *dma_dev; unsigned int error_count; unsigned int failed_tests = 0; unsigned int total_tests = 0; @@ -606,6 +607,8 @@ static int dmatest_func(void *data) params = &info->params; chan = thread->chan; dev = chan->device; + dma_dev = dmaengine_get_dma_device(chan); + src = &thread->src; dst = &thread->dst; if (thread->type == DMA_MEMCPY) { @@ -730,7 +733,7 @@ static int dmatest_func(void *data) filltime = ktime_add(filltime, diff); } - um = dmaengine_get_unmap_data(dev->dev, src->cnt + dst->cnt, + um = dmaengine_get_unmap_data(dma_dev, src->cnt + dst->cnt, GFP_KERNEL); if (!um) { failed_tests++; @@ -745,10 +748,10 @@ static int dmatest_func(void *data) struct page *pg = virt_to_page(buf); unsigned long pg_off = offset_in_page(buf); - um->addr[i] = dma_map_page(dev->dev, pg, pg_off, + um->addr[i] = dma_map_page(dma_dev, pg, pg_off, um->len, DMA_TO_DEVICE); srcs[i] = um->addr[i] + src->off; - ret = dma_mapping_error(dev->dev, um->addr[i]); + ret = dma_mapping_error(dma_dev, um->addr[i]); if (ret) { result("src mapping error", total_tests, src->off, dst->off, len, ret); @@ -763,9 +766,9 @@ static int dmatest_func(void *data) struct page *pg = virt_to_page(buf); unsigned long pg_off = offset_in_page(buf); - dsts[i] = dma_map_page(dev->dev, pg, pg_off, um->len, + dsts[i] = dma_map_page(dma_dev, pg, pg_off, um->len, DMA_BIDIRECTIONAL); - ret = dma_mapping_error(dev->dev, dsts[i]); + ret = dma_mapping_error(dma_dev, dsts[i]); if (ret) { result("dst mapping error", total_tests, src->off, dst->off, len, ret);