From patchwork Mon Apr 15 12:48:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Bin X-Patchwork-Id: 2447681 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 683E23FD8C for ; Tue, 16 Apr 2013 06:30:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62EBFE6307 for ; Mon, 15 Apr 2013 23:30:51 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 350 seconds by postgrey-1.32 at gabe; Mon, 15 Apr 2013 05:57:32 PDT Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [119.145.14.64]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D367E61A9 for ; Mon, 15 Apr 2013 05:57:31 -0700 (PDT) Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BAP37185; Mon, 15 Apr 2013 20:50:21 +0800 (CST) Received: from SZXEML412-HUB.china.huawei.com (10.82.67.91) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Mon, 15 Apr 2013 20:50:15 +0800 Received: from localhost (10.135.74.57) by szxeml412-hub.china.huawei.com (10.82.67.91) with Microsoft SMTP Server id 14.1.323.7; Mon, 15 Apr 2013 20:50:07 +0800 From: Libin To: Arnd Bergmann , Greg Kroah-Hartman , David Airlie , Bjorn Helgaas , "Hans J. Koch" , Petr Vandrovec , Andrew Morton Subject: [PATCH 2/6] PCI: use vma_pages() to replace (vm_end - vm_start) >> PAGE_SHIFT Date: Mon, 15 Apr 2013 20:48:54 +0800 Message-ID: <1366030138-71292-2-git-send-email-huawei.libin@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1366030138-71292-1-git-send-email-huawei.libin@huawei.com> References: <1366030138-71292-1-git-send-email-huawei.libin@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.74.57] X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 15 Apr 2013 23:26:56 -0700 Cc: Thomas Hellstrom , linux-pci@vger.kernel.org, Jiri Kosina , guohanjun@huawei.com, Hugh Dickins , Rik van Riel , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Konstantin Khlebnikov , Al Viro , Nadia Yvette Chambers , David Rientjes , wangyijing@huawei.com, Dave Airlie , Michel Lespinasse , Mel Gorman X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org (*->vm_end - *->vm_start) >> PAGE_SHIFT operation is implemented as a inline funcion vma_pages() in linux/mm.h, so using it. Signed-off-by: Libin --- drivers/pci/pci-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 9c6e9bb..5b4a9d9 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -897,7 +897,7 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma, if (pci_resource_len(pdev, resno) == 0) return 0; - nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + nr = vma_pages(vma); start = vma->vm_pgoff; size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; pci_start = (mmap_api == PCI_MMAP_PROCFS) ?