Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4707868yba; Mon, 20 May 2019 02:16:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEZofYitjwhtzZuksb+wdsa8TTb1dWbAnRvCbAx9zw0p97cbtdkCJodgETLjLR+73wrSD4 X-Received: by 2002:a63:d615:: with SMTP id q21mr73448261pgg.401.1558343784349; Mon, 20 May 2019 02:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558343784; cv=none; d=google.com; s=arc-20160816; b=SimxB/4+WPhYRZCOHFMKZGlqr4mZnI4C2TD7r6xyLAdDFBrc6hGj2FtD3KKZ93irrG Y4cy+2VnfSY4FP46L22c/L3IO1lm7eL7ryPtYkDaNBF+u7lAJ6+VzJA+xloxvPpZpIl3 8RN1zNgfOFQgFMsaDkIPI4jWOnMriH4AuMOlPHztZT95WDcZrKQ/biahaCQcDiLSozUr jYchfKzInmdTz2PGVHmYhHL6g2lBG4uJz2Ix5tAfF2jKktAl2tt09s/K2N1Qvdchf3MG 04wOc0PMIX1Vv9z5CSYS0n+7DMP+3u9Kf6q8avlshm5G3CQFqbfa/4KNgkEtZhsYqoKw 7gNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=X/lbNoKXhKb9aKtxZyFYuZtuYqVbUfAbRDafxA8+tdY=; b=cZi9QpF+Ihvb01AICTWKzLgY2Sjm/VFO7QgNSRD3bzSsTmCKXTeqZKUYAfyP8kt4eP Vz2/hxLmjMrboXFQFEP1SCDP2MIcEF2V9bYVyUm/iZ+y9+fqfsTXUaVeXz/x5b2iEr4z EswrCjysGOIZl9hPXJc6bdlNKPkauYmoi5hJ9UUQ7DbU8syDqKdalci245sg25WN9404 OTXXSpbSYTJo7399UXSEkk8l7R728PrMlmvm6tPYxOunpG3oWEr4SWB27/U/yqkF3zuV YvlSd2SBJ+0xa+M+GOqgwoUXoYM314hVNomsiu7c0Cvr9sq+ACQywBPbDM6BRkXe4IGR Uriw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AoRJtxHb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si10855640pgv.400.2019.05.20.02.16.09; Mon, 20 May 2019 02:16:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AoRJtxHb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730922AbfETHbI (ORCPT + 99 others); Mon, 20 May 2019 03:31:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43792 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730878AbfETHbF (ORCPT ); Mon, 20 May 2019 03:31:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=X/lbNoKXhKb9aKtxZyFYuZtuYqVbUfAbRDafxA8+tdY=; b=AoRJtxHb+KxzXGww6MjIu0Hoyi oBO1MspMfO6An4HuLMi6+DU4Pyr44Jr5TABZMVS34pgs/3Cj0BbuTRoRyoidPxd6wqEy2y6PWyYNG ArnZSNjjxX0Q+jPItvShOX7Y84JrCjJOYBxBmP/LAXkihbITPJIgRAQT00iUEzJKUUQwbedhMAjfi KTynMMu1gpIYbee5cqq2quAnw9hPJ0ICB5+wDxQidAZ39rwcNamm8TzT3DLSMA6/u8ZVRHy9BwZG4 H4qzdPKc99OaxzVyoEoTycQbNNL4umkhO7byCtTJxWiNXXt9YS5yyBFacq8uAGBOyehzGZXSpxE0W pEFJH4hA==; Received: from 089144206147.atnat0015.highway.bob.at ([89.144.206.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSclB-000481-0a; Mon, 20 May 2019 07:31:01 +0000 From: Christoph Hellwig To: Robin Murphy Cc: Joerg Roedel , Catalin Marinas , Will Deacon , Tom Murphy , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/24] iommu/dma: Squash __iommu_dma_{map,unmap}_page helpers Date: Mon, 20 May 2019 09:29:32 +0200 Message-Id: <20190520072948.11412-9-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520072948.11412-1-hch@lst.de> References: <20190520072948.11412-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Murphy The remaining internal callsites don't care about having prototypes compatible with the relevant dma_map_ops callbacks, so the extra level of indirection just wastes space and complictaes things. Signed-off-by: Robin Murphy Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 6ece8f477fc8..498e319d6607 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -717,18 +717,6 @@ static void iommu_dma_sync_sg_for_device(struct device *dev, arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir); } -static dma_addr_t __iommu_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, int prot) -{ - return __iommu_dma_map(dev, page_to_phys(page) + offset, size, prot); -} - -static void __iommu_dma_unmap_page(struct device *dev, dma_addr_t handle, - size_t size, enum dma_data_direction dir, unsigned long attrs) -{ - __iommu_dma_unmap(dev, handle, size); -} - static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) @@ -974,7 +962,8 @@ static void *iommu_dma_alloc(struct device *dev, size_t size, if (!addr) return NULL; - *handle = __iommu_dma_map_page(dev, page, 0, iosize, ioprot); + *handle = __iommu_dma_map(dev, page_to_phys(page), iosize, + ioprot); if (*handle == DMA_MAPPING_ERROR) { if (coherent) __free_pages(page, get_order(size)); @@ -991,7 +980,7 @@ static void *iommu_dma_alloc(struct device *dev, size_t size, if (!page) return NULL; - *handle = __iommu_dma_map_page(dev, page, 0, iosize, ioprot); + *handle = __iommu_dma_map(dev, page_to_phys(page), iosize, ioprot); if (*handle == DMA_MAPPING_ERROR) { dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT); @@ -1005,7 +994,7 @@ static void *iommu_dma_alloc(struct device *dev, size_t size, arch_dma_prep_coherent(page, iosize); memset(addr, 0, size); } else { - __iommu_dma_unmap_page(dev, *handle, iosize, 0, attrs); + __iommu_dma_unmap(dev, *handle, iosize); dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT); } @@ -1044,12 +1033,12 @@ static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr, * Hence how dodgy the below logic looks... */ if (dma_in_atomic_pool(cpu_addr, size)) { - __iommu_dma_unmap_page(dev, handle, iosize, 0, 0); + __iommu_dma_unmap(dev, handle, iosize); dma_free_from_pool(cpu_addr, size); } else if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) { struct page *page = vmalloc_to_page(cpu_addr); - __iommu_dma_unmap_page(dev, handle, iosize, 0, attrs); + __iommu_dma_unmap(dev, handle, iosize); dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT); dma_common_free_remap(cpu_addr, size, VM_USERMAP); } else if (is_vmalloc_addr(cpu_addr)){ @@ -1060,7 +1049,7 @@ static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr, __iommu_dma_free(dev, area->pages, iosize, &handle); dma_common_free_remap(cpu_addr, size, VM_USERMAP); } else { - __iommu_dma_unmap_page(dev, handle, iosize, 0, 0); + __iommu_dma_unmap(dev, handle, iosize); __free_pages(virt_to_page(cpu_addr), get_order(size)); } } -- 2.20.1