From patchwork Wed Nov 22 15:20:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasyl Gomonovych X-Patchwork-Id: 10070575 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 7B429603FA for ; Wed, 22 Nov 2017 15:21:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D99529D05 for ; Wed, 22 Nov 2017 15:21:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6271D29D0D; Wed, 22 Nov 2017 15:21:29 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, 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 0EFAA29D05 for ; Wed, 22 Nov 2017 15:21:29 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=D4D4/VffzBJtKo22+NPk71hj4CVfCzH5I6EnvULgNWw=; b=GEp fkSB3aldf1lrbeN//995Gd1dwp/HkcCrOo4g7xxZR0j/mR/91uxruU/TE79D6cgSQQz+48kZJq8/I 5poewrSyfGt+MJWBmU1ReFOPlM96pG/uUYVgBAg5C1xzEH6VL+k6jfR8bdLuasZKimFoccSgwh/Xg nO/4lq3+BDIvjuZsR8cxDBJlnsAOGbA25YgVIrlILEnO4COv9orZwxKdw6PBsYGxvx4QRX6VTfj1M 287uIS4HKFu2doi1SQcJ0l/tkwkyPNHHKUwUJYcMnZzR92T1rzJRj67Q0iSBpHejWI20zvprE1CPj RHCVjrGuk6g497T/XWP6OP8q7P69thw==; 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 1eHWq8-0005gs-KG; Wed, 22 Nov 2017 15:21:28 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eHWq1-0005FO-58 for linux-arm-kernel@lists.infradead.org; Wed, 22 Nov 2017 15:21:26 +0000 Received: by mail-lf0-x244.google.com with SMTP id x68so18690753lff.0 for ; Wed, 22 Nov 2017 07:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=nJpbEQeLyxY++IjQwX96pVIpkkH4tRIVxpC52Gz+IpA=; b=stKuCUldAc/mWGJCMRhMvpyNBWgXHoyCwl7ENnWOHuJsz02lte6NNg0ykn22t/YMue wjK4qCaZcLMQM6+1R4lauz34UgOnXVSf4SftAnDAGmLk+zsuZRPisOWnaDyJzKIRWbcI dpFf3jV16uojNOg4dJqLL3GPHv7glDd8Q009s44MMGznF3XSRoq840HFCHe9+oqdhcx0 sxEv7HfCTzYbV9QQfIeiTIL0cpEndG/wLSMwfbXXi6YciARn19bmdgPampgt/4oVdcsC 1Qy0PWV6Uhof+5SJkbDeTI0j7eQTNe7K3N1w1i9cHM2Wb/0eJvceGe5+mPTZiSFdtDIz gYIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nJpbEQeLyxY++IjQwX96pVIpkkH4tRIVxpC52Gz+IpA=; b=b1lwWTv5ht72rI/wub1aN99k5eYiN3P08qJekaLwyelyAKcwqbHoHQgWewNmWC38+e 0IkQ8Acy7JIqY1DbOatmz4PwvGunVHNX3kSucRaZIZ8UaCzGWXtRvLWY7UVV3HyoZ+d0 EqmiF7rFoyM1IuSUn4mrIplh9d/Cbs9J5UxyvsVgKrKWBO7fg+WDnHmquFV1C8lcO1W3 zc2T2cCRimDqKknmLNleiGv1YMdYu7bWptm/LEE5R5W/i4xmkUcXnTTWYzeZ9Fov97QL reNZ8XB2yZfbUx9RIdKIhtrTmhn8TMG4sd1Cm46qyAtM7WFRBc1/Qp5dhYcPUTE0pXlR TcMQ== X-Gm-Message-State: AJaThX7gupwMKt7fLN6xXSb6ctup9efluM7g1BZX9MpFDAqztiSg5Rf+ Azi6mSQsxvSv9yxKDZMxmg8= X-Google-Smtp-Source: AGs4zMbeDqNit2Hb0F2mRWaj1lqR4jvgydrFjaCB2k72ppcadGHZ5G3N6VI2ohpg/WYJ0K3wo9A/eA== X-Received: by 10.46.88.1 with SMTP id m1mr7360304ljb.72.1511364059147; Wed, 22 Nov 2017 07:20:59 -0800 (PST) Received: from localhost.localdomain ([195.254.138.66]) by smtp.gmail.com with ESMTPSA id h101sm3756869lji.35.2017.11.22.07.20.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Nov 2017 07:20:58 -0800 (PST) From: Vasyl Gomonovych To: linux@armlinux.org.uk, jroedel@suse.de, vladimir.murzin@arm.com, linux-arm-kernel@lists.infradead.org, sricharan@codeaurora.org Subject: [PATCH] ARM: dma-mapping: Use vma_pages helper Date: Wed, 22 Nov 2017 16:20:50 +0100 Message-Id: <1511364050-912-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171122_072121_416518_F8E8F2A3 X-CRM114-Status: GOOD ( 10.45 ) 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: gomonovych@gmail.com, linux-kernel@vger.kernel.org MIME-Version: 1.0 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 Use vma_pages function on vma object instead of explicit computation. arch/arm/mm/dma-mapping.c:849:36-42: WARNING: Consider using vma_pages helper on vma Generated by: scripts/coccinelle/api/vma_pages.cocci Signed-off-by: Vasyl Gomonovych --- 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 fcf1473d6fed..855427620b01 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -846,7 +846,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;