Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp671740imu; Fri, 11 Jan 2019 07:09:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN6N2C0DRydZlVMoemCtsmhUC1WGievLaOJnGK51fXnUT/eMtcEfjZ4JCU6II9uqhyfWIDVB X-Received: by 2002:a62:399b:: with SMTP id u27mr15462998pfj.181.1547219354729; Fri, 11 Jan 2019 07:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219354; cv=none; d=google.com; s=arc-20160816; b=tcXc87cST0TuXlVsslgHKL5kn1S4okRVu6bnb1ZWnhQGAHLl0VnIBYQTBPDVUnZ5AH yXJ7PybKF1fmvffDVkKL1amQi0+fOZJAH4rak0GzlyEBOaOoT//YyCNsclcoX9d2XpB8 jMuGKCGYUIS7ZnKyUM5Cy5sv3RMu/7ezymbKPbdyXiENrcgJsuuKYKjmswTwShvCAURk bVYiSYBbP0TXieSKhpcOsIOvdViMZg5j2104TJqSwt8cnEyhp+X5jMNEjLZlGMrEv3ju JlgjNr2ojX3wK9cmLyOF96Lq6k5vt2il8bNm09lv4+1cMdDp8lWTsf1atFyqQif4Z+s8 zRaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=5lu9A1QSpPTMUXYRUbEIMz+FrtlaKDaua7/G7w3FZL8=; b=rIkD+GmTwgRIyopn1/usd3Fa8g04b/MYLR98AKr3yIup3bCo6BLMG93+G3mjLV196s oegld2lg4QGA6P1CsoJGOFsVrlNKKGeOa4qCBTTkDvAuZU6/LG+Z2hTfPMebBU+hka71 jUM/no+0V0HdWiIlpm4NrfI7SQOJe6xhDVxaP3AVPhRKP6HRFYiTa3Jez5RdnnfrspHG BRGuu7z0BnUrVAfpYcVJgqsBWplQg3BjVMG0iOyp+exgWv7o+t/LerkcnxKuIE6hQghh +DoBNJnl+JbnzFDA0vQUTpkLeNIbAhyb2mFXe7OwmIkst8TQCOYBdHebnaC5NF+n5LWH 73Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QsvM0uu4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si1906507pfk.35.2019.01.11.07.08.59; Fri, 11 Jan 2019 07:09:14 -0800 (PST) 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=pass header.i=@gmail.com header.s=20161025 header.b=QsvM0uu4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391938AbfAKPHN (ORCPT + 99 others); Fri, 11 Jan 2019 10:07:13 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44162 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391836AbfAKPHL (ORCPT ); Fri, 11 Jan 2019 10:07:11 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so7056885pfh.11 for ; Fri, 11 Jan 2019 07:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=5lu9A1QSpPTMUXYRUbEIMz+FrtlaKDaua7/G7w3FZL8=; b=QsvM0uu4icAZvextylbdiwQF+jVmwkwcRTFbwvekeKAkggRQtNuG1yoUKv9QGnngR+ DK2boV+OXN4GEhRdq8EaSr0OONaDWE88K/OJ5VAxGivZoh+YGndf9KfrXkwvF6gnVkQX nTyB6idbYpK55CJm0E7qRJQSDcfPgFFxJTFLEELimduks6bbI/fiwhEUg+VQq+4UbKEO /5m8X2KXTUvmdgd9pkhtAPR9EFxD7sLEnYFjQO13ov5Khi9lOk2hF31OiH2YFVU1fvkc ti6rmIsEVP1wp/8gEx/yh8Oebts9hgzlTUAdFMrdOT/2E8srkxPSJ70jx7N4ou8HhnWV uW+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=5lu9A1QSpPTMUXYRUbEIMz+FrtlaKDaua7/G7w3FZL8=; b=r37z/6i4yiNFzv9xYE0iLS/ZHWxf98NTgnGPIID7Ji6PgxufLmSPtj7NM7RMkvnNZ3 qQE2Fmao0vVIV0aYCbiBek7cCPmMMNaSdG0ChDX5vQ2JCa/xPf84fg8FVlN4DbRemN4k RJvCad7tNKcAYw5FU7aTeql+HQ6G639+IefGM4ZHqAP+o2d8CE09+i7jB3nAVlJLJGYT 4XbzIBWkjKbGjxH3LPKn8Irs1kdrxPxO9XzOvlUQevzzDl7XEv2DjC/ayGPZP3acN+24 +91PQMQXsXDquyV0gB1L/zTU61raPgTIgv38RybZoIwthRyNsqe7IFeE5Y19cN+nb0wU fmVg== X-Gm-Message-State: AJcUukepGOFzkUa4zgB4YFaQh41bIcvdyDXy/uRnHZFI6lT8e/gquJFQ UMn0XLJQ8PYGHZjsFooI//c= X-Received: by 2002:a62:1043:: with SMTP id y64mr15144503pfi.78.1547219230435; Fri, 11 Jan 2019 07:07:10 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.52.190]) by smtp.gmail.com with ESMTPSA id b202sm150546595pfb.88.2019.01.11.07.07.08 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Jan 2019 07:07:09 -0800 (PST) Date: Fri, 11 Jan 2019 20:41:11 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, joro@8bytes.org, linux@armlinux.org.uk, robin.murphy@arm.com Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range Message-ID: <20190111151110.GA2798@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert to use vm_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder --- drivers/iommu/dma-iommu.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index d1b0475..802de67 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -622,17 +622,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, int iommu_dma_mmap(struct page **pages, size_t size, struct vm_area_struct *vma) { - unsigned long uaddr = vma->vm_start; - unsigned int i, count = PAGE_ALIGN(size) >> PAGE_SHIFT; - int ret = -ENXIO; - - for (i = vma->vm_pgoff; i < count && uaddr < vma->vm_end; i++) { - ret = vm_insert_page(vma, uaddr, pages[i]); - if (ret) - break; - uaddr += PAGE_SIZE; - } - return ret; + return vm_insert_range(vma, pages, PAGE_ALIGN(size) >> PAGE_SHIFT); } static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys, -- 1.9.1