From patchwork Tue Nov 17 10:56:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 324563 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4066570ils; Tue, 17 Nov 2020 02:57:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyX6Pw7Jdp8SPjSZhdeGFaAjHmPqHEYL+4DTUob9EBsQfxyuOvermHm+3dRXC+GSFspdaOq X-Received: by 2002:a17:906:1a0c:: with SMTP id i12mr18434267ejf.176.1605610633685; Tue, 17 Nov 2020 02:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605610633; cv=none; d=google.com; s=arc-20160816; b=hF5fUiKuHj/ObPL/hZ/ZTiCSIxIQmziVjx/3f7OKJlCSMZkYk4fDRzm3WgxhuGwx/M zR/8fqVp0EEYy5VRrq+6Bo6mPTYP4otaxYdbzRbQGTqbw6TwIBbjoER2+jjlbMCf4ysQ MpkKMFzGf942baOy2I5ulf7xsx5zg7EuY8meQItC1qrPdSJosZt5yLwrjfQSUKj6R+H6 nZtXiPIPTF8Rimho/kekVA+d4syo1uxLI49qEgOg9x/UdK03GzpNK7GdBws0UjElke7D q+1mKYsLQlc7js0I592mL1oELvyb55DeGhmiZPDBGSLaNdsPFVXBPL6KEbw42pHAu+t2 jG5Q== 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=q+tRKWCKxYY0BhibatCapCIkahvTAfJVmThwYRoSFr/EWea8zxIZjRMFpnb/3kK0J/ JmHhjJ7ZRC14yIB7qxbJoKy2ByNvU+UgcR4yo/6M0B/sB9eEp0fgKzHJwF/xgg3bIR7D Ir5QjPQxm6dwjduY+KCt9L6NVy6SP0ACsV+YEJ3UytfydH2nMV3v3NuQPN0FNJux1LWR 9eenBw6mFCFCmFRRIONdHKh1Vw1VXwdx/QI4UUjZ+EcXJbOvDx8YrhyZlTukW1o7Re6T 9oN0KO96Gz4Jqs4XrQTKZe1SKoq3OKG/doLmXCR8ofufPuBGuoYL88qet7e43J5ieqsh qHYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TAcq2xYG; 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 dm25si12962825edb.238.2020.11.17.02.57.13; Tue, 17 Nov 2020 02:57:13 -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=TAcq2xYG; 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 S1728160AbgKQK4n (ORCPT + 6 others); Tue, 17 Nov 2020 05:56:43 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:59676 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728143AbgKQK4m (ORCPT ); Tue, 17 Nov 2020 05:56:42 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0AHAubbf019703; Tue, 17 Nov 2020 04:56:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605610597; bh=GcxwvtwaXqOgpXBurlcj+/JKCfjnKyirXPuoynaLPoY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TAcq2xYGthmxVcAL6NttUJ5xWlNx77AiYGz0+ZjOyMZ4jCgdu3xivWwBhG8kQ9tUG wiad2hI3bM3ZYCv1QghkW5lXWz+o+5tz+htRq+NJsFT2IxfITXZbgb4a4PW3xDqxfg 1epq3PkZfZumUXsyuIoEtwFsFrS1X+CsiWhtbu9A= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AHAubVA085702 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 17 Nov 2020 04:56:37 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 17 Nov 2020 04:56:37 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) 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, 17 Nov 2020 04:56:37 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AHAu6tt087311; Tue, 17 Nov 2020 04:56:34 -0600 From: Peter Ujfalusi To: , , , CC: , , , , , , , Subject: [PATCH v2 09/19] dmaengine: dmatest: Use dmaengine_get_dma_device Date: Tue, 17 Nov 2020 12:56:46 +0200 Message-ID: <20201117105656.5236-10-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117105656.5236-1-peter.ujfalusi@ti.com> References: <20201117105656.5236-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);