Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2680460yba; Mon, 22 Apr 2019 11:02:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqy00WVzd3+VhxBr57to027BjnljF5z+tYf8O7Gz6PbkySei3bT3p7hYinZcUK6SqDbSzt/A X-Received: by 2002:aa7:8e55:: with SMTP id d21mr21808203pfr.62.1555956126532; Mon, 22 Apr 2019 11:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555956126; cv=none; d=google.com; s=arc-20160816; b=lkoch6qo/Uq3hiNgfRAVc8sJwE96vwc/aZ9dNV5PeMixoYioHxtkVZADdnSor+9pJb Ncu/deLWg9AT6qCY9BQz2pXislo0Y15gcOdnmNmGMundpzpPvG9ajV8WsYv61a7gY4L3 rL6a7REOXRrUyD9vO3sfiRLaWujuUboQ0xuX/+eJdqqsESAtA7t+XceI5xvqJXKnuboM UACwfnxlga642vD1t6z/L81ttWsyU+lm+29GRuTXJ5nR9ViIkolfSn+pPy7HJtufT3tg n+zsIooT14JrMK0QYKnQsaQ1l6Ala2nl3omnbIIMu6VXdxqQooKIvoW/CrgjD6N3i2XM wVHg== 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=krhqdCyvg3QIToI+sot/SU61LofZ66Zpb9uqYospYqs=; b=C0lBGT0exzT3zqrDUosQT5UiS8B8qKwrfLURp+qjFklNzvTJITfvb0y9Zt7QvMqm8c 4PZ+IbfI5isD7sNcv5RonFwKJNVev1ujrbFzqtEyv1hlNBFUQiooKwLQP2OPLXxBRSOU Q99fLQ8mZMgIvf0wm1DAD7Oxz4jnLTnsSdW2bDBvV4RSBP1PrfAt6LfNirEKwxnejjlZ WK1yLyvJJ4J1i+LyDcxnz4mRJUGzHpqS+PA1ihyNT/VW+wWq2+6SoI5xAO7B75MBV42u v2K/jO+jN0chFpVS/zXcnBj/f+HhoKstpgwRUu/zCTosrpj1MjnYI4YeyV5Li3jHqyCm QKOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cLSlF5FG; 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 b65si15539562pfg.120.2019.04.22.11.01.51; Mon, 22 Apr 2019 11:02:06 -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=cLSlF5FG; 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 S1728512AbfDVSAo (ORCPT + 99 others); Mon, 22 Apr 2019 14:00:44 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37638 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVSAn (ORCPT ); Mon, 22 Apr 2019 14:00:43 -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=krhqdCyvg3QIToI+sot/SU61LofZ66Zpb9uqYospYqs=; b=cLSlF5FGYPbdqMVCUUrqLlonbr AQODQzTrPYNbkjpl1FdmbdOtkFW6K8wP6uTzAqzOp2ABoFrdAGRQzAJ2ThgIqdV1CB9RKySVboVwE XrLRQnXv3TkUYHqC8q759ipyns3cNrFjBUspPW5w9bn4CrbX7T+8UGnS5ZDmMNGcgdMg7CQsmbTAq wT/wwCDj47VJhpU+NZ0xUmGce4iopA3cTjdDjrMep7279C0KMAoirhPZPblkpKKb1sOgzTJJ3dr5z 8mCnnjk+BC9fpZTZCSqrdB/ezLgiadifw+okiFdQfvUhZNYMytm+mjZe/aQXSS7ytZtWyvq3wCQ1K zAszlHgQ==; 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 1hIdF5-0001uG-70; Mon, 22 Apr 2019 18:00:35 +0000 From: Christoph Hellwig To: Robin Murphy 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 Subject: [PATCH 10/26] iommu/dma: Squash __iommu_dma_{map,unmap}_page helpers Date: Mon, 22 Apr 2019 19:59:26 +0200 Message-Id: <20190422175942.18788-11-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 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 4ebd08e3a83a..b52c5d6be7b4 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -698,18 +698,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) @@ -955,7 +943,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)); @@ -972,7 +961,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); @@ -986,7 +975,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); } @@ -1025,12 +1014,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)){ @@ -1041,7 +1030,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