From patchwork Wed Sep 20 22:29:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Meyer X-Patchwork-Id: 9962735 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 B0FC0601D5 for ; Wed, 20 Sep 2017 22:39:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2F9529267 for ; Wed, 20 Sep 2017 22:39:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97E6829271; Wed, 20 Sep 2017 22:39:18 +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 0EF0E29267 for ; Wed, 20 Sep 2017 22:39:18 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:In-Reply-To:References:Message-ID: Mime-Version:To:From:Subject:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hL74rGCsXuIlstp/ys8OD4LjkfHwwBgaLFNr5rwPyUY=; b=VVjHXYYNo67SpD YWdnXgG/BiqAfw4r1N9kpzLQ+Ga0jIBTHemBpnoJ3cNlaeVXIS9erVTz67UFgT9SI5JhhI4DdXMaK /CJGFtS8fSEQDwLmPNpmoAUIn1ZUDu2ymQtFBGfdbvpLwy2UNz+stNQDN8D1TwXK/tD/a9unjWDfc nhym90sXmAFZ9u9DXqegPPa6zffgeSJLZEkRHwNP8QMmp8bX0Vd+IVxtTcmVquF6bLkJeInALc33T GFTe2dDGxixr5MtQAUzuo2xo+Ty8m4v1onunnkNfHgexRmvg02/4Styjnx+PgemP/1kQfSkwAF47G LxpHpNtpmLNDb6xYRqyA==; 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 1duneA-0005tK-MS; Wed, 20 Sep 2017 22:39:10 +0000 Received: from www17.your-server.de ([213.133.104.17]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dune5-0005lm-Nt; Wed, 20 Sep 2017 22:39:07 +0000 Received: from [95.222.26.195] (helo=olymp) by www17.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1dundU-0004y6-Hg; Thu, 21 Sep 2017 00:38:28 +0200 Subject: [PATCH 7/7] drm/rockchip: Cocci spatch "vma_pages" From: Thomas Meyer To: mark.yao@rock-chips.com, airlied@linux.ie, heiko@sntech.de, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Mime-Version: 1.0 Message-ID: <1505946334393-988165015-7-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 X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.99.2/23857/Wed Sep 20 18:44:07 2017) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170920_153905_956801_B049E4F3 X-CRM114-Status: UNSURE ( 4.93 ) 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: , 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. Found by coccinelle spatch "api/vma_pages.cocci" Signed-off-by: Thomas Meyer Acked-by: Mark Yao diff -u -p a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -220,7 +220,7 @@ static int rockchip_drm_gem_object_mmap_ { struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); unsigned int i, count = obj->size >> PAGE_SHIFT; - unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + unsigned long user_count = vma_pages(vma); unsigned long uaddr = vma->vm_start; unsigned long offset = vma->vm_pgoff; unsigned long end = user_count + offset;