From: Robin Murphy Subject: Re: [PATCH 13/26] iommu/dma: Remove __iommu_dma_free Date: Mon, 29 Apr 2019 14:18:02 +0100 Message-ID: <9c53d0e6-3692-e151-c64b-0070a89ca725@arm.com> References: <20190422175942.18788-1-hch@lst.de> <20190422175942.18788-14-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190422175942.18788-14-hch@lst.de> Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org To: Christoph Hellwig Cc: Joerg Roedel , Catalin Marinas , Will Deacon , Tom Lendacky , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org List-Id: iommu@lists.linux-foundation.org On 22/04/2019 18:59, Christoph Hellwig wrote: > We only have a single caller of this function left, so open code it there. Heh, I even caught myself out for a moment thinking this looked redundant with #18 now, but no :) Reviewed-by: Robin Murphy > Signed-off-by: Christoph Hellwig > --- > 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); >