Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1246990iol; Fri, 10 Jun 2022 03:35:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVlqB5RvZWLi/GE5wjyrf792kvSGx14BcNa0LhmnTyCReDRbl3rx4t8SoSgWrX/AhoaiIG X-Received: by 2002:a05:6a00:2405:b0:520:6b82:646b with SMTP id z5-20020a056a00240500b005206b82646bmr1640973pfh.24.1654857329152; Fri, 10 Jun 2022 03:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654857329; cv=none; d=google.com; s=arc-20160816; b=L1JQr8q9VX1Pf/nuMmCJSw3yPqoUQ0d3bNhAour8/5faWaQW5ncbggQSQQyfM7Z8JP mnG2k6Zj+Q7khpUBBeLdiVhCGKIHF3MeWMH5g/tCJWJo3c8lQtyZfPIO6AWVi+7Lu6ZV VBC4XCnmBWIm1hfKxiaQAzHLnkyKl8Fwd8XJH/x6H5rSwHne0KWmIccSDz4d0ITyONdO ZhD85RbAy2SlbMKdST5wsuqmsiYCLnkTibtFranaY5UokmXgVNWlaVmhu7jIhDeWRDfK pYIimC5deDX8utGPa28Luz+VV/dpkZx606t1qFqh1WXIVPf4oVheguVbnJuApwXAK8QK ZcBQ== 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:dkim-filter; bh=HZy3PdUSoh84jD78k5L1zP8v+9AYPA6C/fEw3gH+MnY=; b=VlHturEwq+7G2l8j3ehiesVPVSOGZXWN3XhU5W8I8YSmR5Q0FJoEZzLPdTsJQZ/4yn 2Z45A2KdZar1P46K+cfVdWeFhnQIrgjlNWc5GRQQOI1c3203potkk3UMJuVLP1W24J3R q+6K1rmYnheAfuBqx+DeU5G7BRtmwnPvaCWpGZxEc2JSfDWc+UwlGaG4cq4hBXpAltPE EYDEZzllwH55cZ746w8fenAT17vID2GUJta0a6w93XBdIVW6zbkCbyhN4vuOEzaR0gi0 rsLICIpsaGHTP3cOIkgHQVgKYAn5+TT3St0kLFcf9h13IzNfZwau9pfqwSpdJu9gNNqB t5lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b="YzGSQ1/Y"; 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 y14-20020a63ad4e000000b003fb23692294si39032525pgo.218.2022.06.10.03.35.14; Fri, 10 Jun 2022 03:35:29 -0700 (PDT) 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=mail header.b="YzGSQ1/Y"; 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 S1348798AbiFJJTD (ORCPT + 99 others); Fri, 10 Jun 2022 05:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344194AbiFJJQO (ORCPT ); Fri, 10 Jun 2022 05:16:14 -0400 Received: from mail.baikalelectronics.com (mail.baikalelectronics.com [87.245.175.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0FE8250692; Fri, 10 Jun 2022 02:15:31 -0700 (PDT) Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id E505816A8; Fri, 10 Jun 2022 12:16:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com E505816A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1654852570; bh=HZy3PdUSoh84jD78k5L1zP8v+9AYPA6C/fEw3gH+MnY=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=YzGSQ1/YUViw/G3XFydThK2sMnT5cVSZ2M86ua08gzXIgayFhAKNScxnVskI3srXX 0PvOQ4Viv+Ct2g0JwScb9xPDqjgKtbOqqV1W0l7sOeJTIryoWxMoRStzxYIADCUl6h C6BnwoKuw7DrJukhAMM5MWXJCvBNidTO5pOOyBzY= Received: from localhost (192.168.53.207) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 Jun 2022 12:15:18 +0300 From: Serge Semin To: Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Frank Li , Manivannan Sadhasivam CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , , , Subject: [PATCH v3 20/24] dmaengine: dw-edma: Drop DT-region allocation Date: Fri, 10 Jun 2022 12:14:55 +0300 Message-ID: <20220610091459.17612-21-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220610091459.17612-1-Sergey.Semin@baikalelectronics.ru> References: <20220610091459.17612-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --- 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 7ba3b60c960c..98a94a66fb82 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -744,7 +744,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; @@ -760,12 +759,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) { @@ -813,17 +806,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.35.1