Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1734117pxu; Tue, 24 Nov 2020 07:42:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxultm2F/KDRoTcfHR5JOuweLc+CfxOQsKISGYCdukOyf+9FtPN4VJX78UZgHaO+YSCHX5b X-Received: by 2002:a17:906:8319:: with SMTP id j25mr5072798ejx.68.1606232522831; Tue, 24 Nov 2020 07:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606232522; cv=none; d=google.com; s=arc-20160816; b=dASluUYK6LLxQRKyHtjM46AcCIsMyD+uae6lRenDE8/Z3EbiKaQsGoTrkMF/H6zZtZ zALrQ/K74P44bQXDYYo5tVKiQnFHNrABZBWL70Xqy0emVPLPhaaoqQhJtuHC1/bgy9ec zSMDeifgNEpvsGM0BVnR9mdi+d/y816CHNCO3IsCyqUroTjJnwMSc8sVymBk2mSN1kDp FmjDs3m7f33MtQVmHgEI0yDOHA3E6nqVgOqL1l1/8UvVuGhxfh7R/U35lJgEE3uA8W5X HFDKwTaYVtQiRhYcFJEA/OwnrosD5o/mVz+5GNUp10OWM6LnVsucH28sgv7FDzg6XWpR BuSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mn1wB4UIIJYCPFpu55sy3LOHzNh5rEWUlXSp9HWhrTs=; b=GXC9F5WYwKkg2mkdoH2XScaSpaxosAVtlmAUBxaBNJ+Am/wQIvO7DFWGJfjSV5VixO Ei+nXF2zyyaqyD0r7wRFdvSxcT0ryVePauGfuer9ZJVWmdRLZcu0QEOJSQLICVbX/kJx Fk4+VxGvuGux49xTdstES9Q1A7zF6IU2tr5eJ2y2yrTEothh6vbo8wx45D+hq9PPPspM l39tKD9DTt0jzhsppwm6jZXLWZqfhjnTmhPFE8ksqmBDS7rS3gVk9UXCp4IlD0eNo/OX MxJ2y61Yoi2JwKwAozLHvmaE7OP+UvvYeUQvutxuSryujqf/sm2GS5X4hrlYgRbinRmv EUpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=n2RkEURO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si8882154edu.46.2020.11.24.07.41.38; Tue, 24 Nov 2020 07:42:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=n2RkEURO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389828AbgKXPiw (ORCPT + 99 others); Tue, 24 Nov 2020 10:38:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389806AbgKXPiu (ORCPT ); Tue, 24 Nov 2020 10:38:50 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71D7EC0613D6 for ; Tue, 24 Nov 2020 07:38:50 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id e7so5234407wrv.6 for ; Tue, 24 Nov 2020 07:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mn1wB4UIIJYCPFpu55sy3LOHzNh5rEWUlXSp9HWhrTs=; b=n2RkEUROrYeufAtCSKDWr3fmq/B5Dj/1/iujvWXNBpKVXM46G14POxuNtrvFGvG4xS 65IlJ8mFMtlZ+DEw0CCukK4ngUegaZeo8SVlB1Gy+ncs+XC07IzM0JfpHRFMuhx4DL+q Rc6TA7y3GVyTSBWrC+0pOexy8rwtT88yGy6aM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mn1wB4UIIJYCPFpu55sy3LOHzNh5rEWUlXSp9HWhrTs=; b=G4WQwb+uHGQQTVnDsrcuygWqtGxW/Odzxzsi4O8Zk48osgyznZFFIAEdnI8vTywHNB 9+i0nSAhruZ9n+2Ff6NpHz9ttggFvY/9ZzM/GS2tvOgh/Zag7xfviF+bK5a+NZVh+tg0 e7EUX4lvjOCC0h77QlWi+pc7P7NOWplFWqXTgrfT/K9aXLRk5EInXEe0sH9cgopxgpv9 TACVp2M7U3Ffm9kVle5uWryh3XU2hNRQnFDYd82bzuH+7dL0BrjySpcVl96l/UfSLPm/ CGNrP0XHuz1DuZLZYtr6YCaJkxW29Xlxb6frUH7xIp1/YZD4+4IuJlPWjDwBtvZjFAl9 nZaw== X-Gm-Message-State: AOAM531Fw+BSZNoMmJfPNWbn4qxnSs2TRwmfS8RZaXgoV9QhzYFrNWoD mnCqWGHOjv74uO3Pvh+YC9AIWA== X-Received: by 2002:adf:e80b:: with SMTP id o11mr5939427wrm.409.1606232329253; Tue, 24 Nov 2020 07:38:49 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id 25sm5814752wmk.19.2020.11.24.07.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 07:38:48 -0800 (PST) From: Ricardo Ribalda To: Christoph Hellwig , Mauro Carvalho Chehab , Marek Szyprowski , IOMMU DRIVERS , Joerg Roedel , Robin Murphy , Linux Doc Mailing List , Linux Kernel Mailing List , Linux Media Mailing List , Tomasz Figa , Sergey Senozhatsky Subject: [PATCH 3/6] dma-iommu: remove __iommu_dma_mmap Date: Tue, 24 Nov 2020 16:38:42 +0100 Message-Id: <20201124153845.132207-3-ribalda@chromium.org> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog In-Reply-To: <20201124153845.132207-1-ribalda@chromium.org> References: <20201124153845.132207-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig The function has a single caller, so open code it there and take advantage of the precalculated page count variable. Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 73249732afd3..a2fb92de7e3d 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -655,21 +655,6 @@ static void *iommu_dma_alloc_remap(struct device *dev, size_t size, return NULL; } -/** - * __iommu_dma_mmap - Map a buffer into provided user VMA - * @pages: Array representing buffer from __iommu_dma_alloc() - * @size: Size of buffer in bytes - * @vma: VMA describing requested userspace mapping - * - * Maps the pages of the buffer in @pages into @vma. The caller is responsible - * for verifying the correct size and protection of @vma beforehand. - */ -static int __iommu_dma_mmap(struct page **pages, size_t size, - struct vm_area_struct *vma) -{ - return vm_map_pages(vma, pages, PAGE_ALIGN(size) >> PAGE_SHIFT); -} - static void iommu_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) { @@ -1074,7 +1059,7 @@ static int iommu_dma_mmap(struct device *dev, struct vm_area_struct *vma, struct page **pages = dma_common_find_pages(cpu_addr); if (pages) - return __iommu_dma_mmap(pages, size, vma); + return vm_map_pages(vma, pages, nr_pages); pfn = vmalloc_to_pfn(cpu_addr); } else { pfn = page_to_pfn(virt_to_page(cpu_addr)); -- 2.29.2.454.gaff20da3a2-goog