Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp236962rwb; Wed, 14 Dec 2022 16:40:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXusiEulxzVYoROiOH44KHRXBjEAMt5khAuosWddaE7Sk9DYKAvRciVDswZ1j4wqzi+NP6wO X-Received: by 2002:a17:906:1b4a:b0:7c4:fa17:7204 with SMTP id p10-20020a1709061b4a00b007c4fa177204mr2634468ejg.7.1671064826529; Wed, 14 Dec 2022 16:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671064826; cv=none; d=google.com; s=arc-20160816; b=hZpRquXpsQb7ZBI/Txwk8d+aDPHjr0BD7oCvtXrSckho+loMFW/smjDScTvzdPEDsR F8uAirKLBr6ahLO2mw39VFNp4XYWdG3Kky+dstd56OB7oJjvBj9aTGoJhOH5dZpR5xDd 80GnZFIFW4hWw8URCbdyrAXSBcffO0DWNa0sP+oH7NLp8hD025M/exXtNuyQ1wLWtRwD HjPiqLd4EfSGQ4gQihDPP+MzgXnkmkJfOVr/tkeYL93Z5/gRCuHFpHYTzcKla0nuCCwO q7e6RX7SGMrP1uujJbRtFL9KyjuOyl1dpby134Xu3rKm+t45Kmr621iPDIM0PPjMbdAp BHFw== 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=pXLKngyLmWaJzkgY6C8kxZXfu2HNIglie6UuuU/58+w=; b=dimNuAH59riLrmZBi5mnlU2K1JG5hWvIZBC/bi6km/DPyfm8K1+GaziP6uyQUQcSve 5WTnRorFmncBMo7KY/oIG/zmgUeGafpG94IS/g9u4kt/HZEX5h1vVkJdrPXIF1XpZtN3 Nu05RyGLJsO3vtfKLaD4VGZ/ZnsiplCahl8348cp1g1XVpMsIsUT+RR9R5xj4ZOYhEys ENxexQgR+UNvQqoOiUIPiarzuYSqpp5EuEhorpnVW+rbevT9MEdjgVpOdEBvvdMV3Ra8 MyH1ZRup5P82F3ZEk+LOtBlDWe22e8DtqeztV79Kq2YjQVacWwYh26lzptnX+BbrsTDL 9pdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=cBNuAHtW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc10-20020a170907074a00b007ae186b15f9si5254222ejb.597.2022.12.14.16.40.08; Wed, 14 Dec 2022 16:40:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=cBNuAHtW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbiLNXzF (ORCPT + 69 others); Wed, 14 Dec 2022 18:55:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbiLNXx0 (ORCPT ); Wed, 14 Dec 2022 18:53:26 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 026BF511CF; Wed, 14 Dec 2022 15:53:23 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 97DB7E0ECE; Thu, 15 Dec 2022 02:53:22 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=pXLKngyLmWaJzkgY6C8kxZXfu2HNIglie6UuuU/58+w=; b=cBNuAHtWpwPo yO8mQSUf/T1KuAGr0k3zrlcWDVgH7C9bNoUlqrCdPbVcISsiVGf0zmx8fMfv5VHN lcwXefWyVV2D0BAFuJoyFq3pBjHgWJYVjQNjWVnjyhr3VYgdQRPQAfnkWcL2P/mG HXqCX9ZZ5i/g8UBkaSDN12EOFgzzpMg= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 8A965E0E6B; Thu, 15 Dec 2022 02:53:22 +0300 (MSK) Received: from localhost (10.8.30.6) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 15 Dec 2022 02:53:22 +0300 From: Serge Semin To: Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Cai Huoqing , Robin Murphy , Jingoo Han , Frank Li , Manivannan Sadhasivam CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , caihuoqing , Yoshihiro Shimoda , , , Subject: [PATCH v7 20/25] dmaengine: dw-edma: Drop DT-region allocation Date: Thu, 15 Dec 2022 02:53:00 +0300 Message-ID: <20221214235305.31744-21-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> References: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.8.30.6] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no point in allocating an additional memory for the data target regions passed then to the client drivers. Just use the already available structures defined in the dw_edma_chip instance. Note these regions are unused in normal circumstances since they are specific to the case of eDMA being embedded into the DW PCIe End-point and having it's CSRs accessible over a End-point' BAR. This case is only known to be implemented as a part of the Synopsys PCIe EndPoint IP prototype kit. Signed-off-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Manivannan Sadhasivam Acked-by: Vinod Koul --- drivers/dma/dw-edma/dw-edma-core.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 58808bec4148..040a88cfe070 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -738,7 +738,6 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan) static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc) { struct dw_edma_chip *chip = dw->chip; - struct dw_edma_region *dt_region; struct device *dev = chip->dev; struct dw_edma_chan *chan; struct dw_edma_irq *irq; @@ -754,12 +753,6 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc) for (i = 0; i < ch_cnt; i++) { chan = &dw->chan[i]; - dt_region = devm_kzalloc(dev, sizeof(*dt_region), GFP_KERNEL); - if (!dt_region) - return -ENOMEM; - - chan->vc.chan.private = dt_region; - chan->dw = dw; if (i < dw->wr_ch_cnt) { @@ -807,17 +800,11 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc) chan->msi.data); chan->vc.desc_free = vchan_free_desc; - vchan_init(&chan->vc, dma); + chan->vc.chan.private = chan->dir == EDMA_DIR_WRITE ? + &dw->chip->dt_region_wr[chan->id] : + &dw->chip->dt_region_rd[chan->id]; - if (chan->dir == EDMA_DIR_WRITE) { - dt_region->paddr = chip->dt_region_wr[chan->id].paddr; - dt_region->vaddr = chip->dt_region_wr[chan->id].vaddr; - dt_region->sz = chip->dt_region_wr[chan->id].sz; - } else { - dt_region->paddr = chip->dt_region_rd[chan->id].paddr; - dt_region->vaddr = chip->dt_region_rd[chan->id].vaddr; - dt_region->sz = chip->dt_region_rd[chan->id].sz; - } + vchan_init(&chan->vc, dma); dw_edma_v0_core_device_config(chan); } -- 2.38.1