Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751861AbdITWia (ORCPT ); Wed, 20 Sep 2017 18:38:30 -0400 Received: from www17.your-server.de ([213.133.104.17]:38950 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbdITWi3 (ORCPT ); Wed, 20 Sep 2017 18:38:29 -0400 Subject: [PATCH 5/7] MIPS: Cocci spatch "vma_pages" From: Thomas Meyer To: ralf@linux-mips.org, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Message-ID: <1505946334393-199079578-5-diffsplit-thomas@m3y3r.de> References: <1505946334393-568186305-0-diffsplit-thomas@m3y3r.de> In-Reply-To: <1505946334393-568186305-0-diffsplit-thomas@m3y3r.de> Date: Thu, 21 Sep 2017 00:29:36 +0200 X-Mailer: Evolution 3.22.6-1 Content-Transfer-Encoding: 7bit X-Authenticated-Sender: thomas@m3y3r.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 705 Lines: 18 Use vma_pages function on vma object instead of explicit computation. Found by coccinelle spatch "api/vma_pages.cocci" Signed-off-by: Thomas Meyer --- diff -u -p a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c @@ -179,7 +179,7 @@ static int mips_dma_mmap(struct device * void *cpu_addr, dma_addr_t dma_addr, size_t size, unsigned long attrs) { - unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + unsigned long user_count = vma_pages(vma); unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; unsigned long addr = (unsigned long)cpu_addr; unsigned long off = vma->vm_pgoff;