From patchwork Mon Apr 22 17:59:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10911333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BF7713B5 for ; Mon, 22 Apr 2019 18:03:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EBA328786 for ; Mon, 22 Apr 2019 18:03:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70CAA28789; Mon, 22 Apr 2019 18:03:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C41128786 for ; Mon, 22 Apr 2019 18:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=9wJZh0MlvvR/f7CmrIfw8N3iIe1tLL1wGzcDznwXrRk=; b=CAHO2A5iI6C3LM BKgYf8tZ7zUVxZ47CGRPLt3XJMejLH+2zaWtZ3RskLBJrXPXWHwRc8Nuyo4o70MPpA9FSJBdQOd4T hhRNb9DISqpTWW37Q6i8PPAs1vh35hYcmg4LX4qmiB0NiW2w4z0R+rhnqmxOldPkTsjYyDoIsvp4Q +lAj0GK6Nus62XF4CggThw6jodFieXf3+11K/h+2ydvlDUcoT6GIpo3s1VLWjfTYFi8Uxozcj3kGD HRVApXcytHezT24u47qm84hQ6WAyiqvOQpXJQ+3VkFDQ2pSfUT43urDk/TpscMxb620eABDJv9ZR0 jGdlWECXwYfmS4oxNcag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIdHU-0004lm-5u; Mon, 22 Apr 2019 18:03:04 +0000 Received: from 213-225-37-80.nat.highway.a1.net ([213.225.37.80] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIdFC-00024T-JH; Mon, 22 Apr 2019 18:00:42 +0000 From: Christoph Hellwig To: Robin Murphy Subject: [PATCH 13/26] iommu/dma: Remove __iommu_dma_free Date: Mon, 22 Apr 2019 19:59:29 +0200 Message-Id: <20190422175942.18788-14-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190422175942.18788-1-hch@lst.de> References: <20190422175942.18788-1-hch@lst.de> MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Lendacky , Catalin Marinas , Joerg Roedel , Will Deacon , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We only have a single caller of this function left, so open code it there. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index b8e46e89a60a..4632b9d301a1 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -534,24 +534,6 @@ static struct page **__iommu_dma_get_pages(void *cpu_addr) return area->pages; } -/** - * iommu_dma_free - Free a buffer allocated by iommu_dma_alloc_remap() - * @dev: Device which owns this buffer - * @pages: Array of buffer pages as returned by __iommu_dma_alloc_remap() - * @size: Size of buffer in bytes - * @handle: DMA address of buffer - * - * Frees both the pages associated with the buffer, and the array - * describing them - */ -static void __iommu_dma_free(struct device *dev, struct page **pages, - size_t size, dma_addr_t *handle) -{ - __iommu_dma_unmap(dev, *handle, size); - __iommu_dma_free_pages(pages, PAGE_ALIGN(size) >> PAGE_SHIFT); - *handle = DMA_MAPPING_ERROR; -} - /** * iommu_dma_alloc_remap - Allocate and map a buffer contiguous in IOVA space * @dev: Device to allocate memory for. Must be a real device @@ -1034,7 +1016,8 @@ static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr, if (WARN_ON(!pages)) return; - __iommu_dma_free(dev, pages, iosize, &handle); + __iommu_dma_unmap(dev, handle, iosize); + __iommu_dma_free_pages(pages, size >> PAGE_SHIFT); dma_common_free_remap(cpu_addr, size, VM_USERMAP); } else { __iommu_dma_unmap(dev, handle, iosize);