From patchwork Wed Sep 30 08:55:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11808497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 007796CA for ; Wed, 30 Sep 2020 08:59:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86B5A20659 for ; Wed, 30 Sep 2020 08:59:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0IcjPiVk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dFDx5ZNM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86B5A20659 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/CncBv3jJDBGbU5LfFypZ6UB8O8dt2YQODHKXd1Kybw=; b=0IcjPiVk7Ryx8d09b9kqxmgPa ebJISzaIcah4n+U06oDZmKdUKX5AnF7NHt+I5RTv1ensmQPyBAsh6VNIBFuY2aR6rg8Pc3km17UfV XAzswWB0EK3LwCtC1ZYPY//Vv6RUsMNWVXBRCR38qfMbDXbkWY2qrPPwxfwioAJsMWQ8MNHX4i8uS Q1S3MUQKYxCHYSmMTkK3hGS3rJ9Cf4PdGGp+hpFphHdCa3X+SNLgWbYlTR5jz9Hl+++ZlzZ27oXwQ KnvnqtnH/o/mX+gJ4Q1JOtY+AHsv/LMJV/5oq728v2sCZo6x8R5T8xGSxE+6cSRgZzmig7LNmBvV9 OoRyzm7Kg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNXv1-000337-7b; Wed, 30 Sep 2020 08:56:59 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNXu0-0002h3-OR for linux-arm-kernel@merlin.infradead.org; Wed, 30 Sep 2020 08:55:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=uoDyUocMuxzXBw/J3MbtQm99bSltpvYBdHObApmUBIs=; b=dFDx5ZNML+cWYXkIEd6M5bUEy8 Ar5BHcfB6+dtOGD1wBQRyRAmE2iye02HQKfsdJJfgTOpYowgxuLIxmfM81z2HFg7z31W3toGzdsFw f/BScPfOqNIVdPt5GaLNORtSWW8k+e6xjfk7NoGOVGHyw3OqpC7jKOOf6ESTy4K0cgvWv/GPSbe8e ZMvexOaWThxdFvgc6sKB4h5+gyp7VLAC7+6NM6awEfX5YZ65ld9mVVIg6hqMD3+Pp3PhLZgH4A75W FTw9f8kDlC7dT408D7eY1r+Tw23zX0oMM9g3+slkfbQxiXQpBl5oCf7h3iXw/PQk6zieqGG4wEESw +heP/yKQ==; Received: from [2001:4bb8:180:7b62:c70:4a89:bc61:4] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNXtz-0003sE-2r; Wed, 30 Sep 2020 08:55:55 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org Subject: [PATCH 2/9] dma-contiguous: remove dma_declare_contiguous Date: Wed, 30 Sep 2020 10:55:41 +0200 Message-Id: <20200930085548.920261-3-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200930085548.920261-1-hch@lst.de> References: <20200930085548.920261-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Sekhar Nori , Russell King , linux-kernel@vger.kernel.org, Robin Murphy , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org dma_declare_contiguous is a trivial wrapper around dma_contiguous_reserve_area and just has a single caller. Signed-off-by: Christoph Hellwig --- arch/arm/mach-davinci/devices-da8xx.c | 16 +++++++++----- include/linux/dma-contiguous.h | 32 --------------------------- 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index feb206bdf6e172..2e2853582b459e 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -884,6 +884,7 @@ early_param("rproc_mem", early_rproc_mem); void __init da8xx_rproc_reserve_cma(void) { + struct cma *cma; int ret; if (!rproc_base || !rproc_size) { @@ -897,13 +898,16 @@ void __init da8xx_rproc_reserve_cma(void) pr_info("%s: reserving 0x%lx @ 0x%lx...\n", __func__, rproc_size, (unsigned long)rproc_base); - ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0); - if (ret) - pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret); - else - rproc_mem_inited = true; + ret = dma_contiguous_reserve_area(rproc_size, rproc_base, 0, &cma, + true); + if (ret) { + pr_err("%s: dma_contiguous_reserve_area failed %d\n", + __func__, ret); + return; + } + dev_set_cma_area(&da8xx_dsp.dev, cma); + rproc_mem_inited = true; } - #else void __init da8xx_rproc_reserve_cma(void) diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h index fe55e004f1f433..62fd55d0723546 100644 --- a/include/linux/dma-contiguous.h +++ b/include/linux/dma-contiguous.h @@ -83,31 +83,6 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, phys_addr_t limit, struct cma **res_cma, bool fixed); -/** - * dma_declare_contiguous() - reserve area for contiguous memory handling - * for particular device - * @dev: Pointer to device structure. - * @size: Size of the reserved memory. - * @base: Start address of the reserved memory (optional, 0 for any). - * @limit: End address of the reserved memory (optional, 0 for any). - * - * This function reserves memory for specified device. It should be - * called by board specific code when early allocator (memblock or bootmem) - * is still activate. - */ - -static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size, - phys_addr_t base, phys_addr_t limit) -{ - struct cma *cma; - int ret; - ret = dma_contiguous_reserve_area(size, base, limit, &cma, true); - if (ret == 0) - dev_set_cma_area(dev, cma); - - return ret; -} - struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, unsigned int order, bool no_warn); bool dma_release_from_contiguous(struct device *dev, struct page *pages, @@ -135,13 +110,6 @@ static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base return -ENOSYS; } -static inline -int dma_declare_contiguous(struct device *dev, phys_addr_t size, - phys_addr_t base, phys_addr_t limit) -{ - return -ENOSYS; -} - static inline struct page *dma_alloc_from_contiguous(struct device *dev, size_t count, unsigned int order, bool no_warn)