From patchwork Sun Nov 19 21:17:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10065805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6B9FF6023A for ; Sun, 19 Nov 2017 21:17:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59FB728E59 for ; Sun, 19 Nov 2017 21:17:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CBB428FA1; Sun, 19 Nov 2017 21:17:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9DDB28E59 for ; Sun, 19 Nov 2017 21:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sWIP9gVe/bvEVQKh5yoInc4rA6w75HJBesfokTr492k=; b=Izhh8glXOxoJxa H9SONnHyp+S6Em6m0PVpfZ6PCQ9r85oKF76q/8fEIughHNVBcfQbmUPHOKoE5VO5tMGTVQESoFMHy zK9NkJGHZ3b0/zmty+jyj11sBGGKxa/FeA0Ga5xGF+XhwWM1QGdOxIJ0mRZoq6BX+rx3tUcDSM1GG XqBXpEIrrW6J0RrIwqxha1hooeHWAnmM4IBc/67K3u1aYLBUxERro//hOzSF4cppwSfYvmkKJQDDc GFqFHFbyPM3f5xW7yzQ5FUy/WXerKclBcApXwpO3P2eokeoHVbVHTQWwlb2bIukeN4J9OQvM6WbCc TXvG1IrH7C8UQ6ojqZkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eGWyR-0003iY-6o; Sun, 19 Nov 2017 21:17:55 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGWyO-0003VT-5T for linux-arm-kernel@lists.infradead.org; Sun, 19 Nov 2017 21:17:53 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eGWxs-0000Tu-Mq; Sun, 19 Nov 2017 21:17:21 +0000 From: Colin King To: Russell King , Vladimir Murzin , Sricharan R , Joerg Roedel , linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm: dma-mapping: use vma_pages helper function Date: Sun, 19 Nov 2017 21:17:19 +0000 Message-Id: <20171119211719.16859-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171119_131752_362389_57466D33 X-CRM114-Status: UNSURE ( 9.26 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King Use the vma_pages helper function on vma instead of an explicit calculation. Found by coccinelle spatch "api/vma_pages.cocci" Signed-off-by: Colin Ian King --- arch/arm/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ada8eb206a90..ec0f277d1d4d 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -831,7 +831,7 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma, unsigned long attrs) { int ret; - unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + unsigned long nr_vma_pages = vma_pages(vma); unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; unsigned long pfn = dma_to_pfn(dev, dma_addr); unsigned long off = vma->vm_pgoff;