Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3604712imu; Mon, 24 Dec 2018 05:22:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN73JuTfe+gNG0nyn2nEY07kjNwxYiEkLtRMByniHm4j24xtLk3xAwcA3cB4cHZPWeVMgzCq X-Received: by 2002:a62:9111:: with SMTP id l17mr13084314pfe.200.1545657728956; Mon, 24 Dec 2018 05:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545657728; cv=none; d=google.com; s=arc-20160816; b=LHYJJ6EntCNl7tRmUN1VSaNxb5o4CFmDR43iG+/gmqDiaX2Ez5VxNmjl03e8X9L3Zl g6045Cq7dGk0xNRs8bfH5T2ON7CQIObSZtNI7HfPl8M+jOTm4/3aO6PwPxIPghJiO/oA ON7/hV1Shsh49UKPN9sxrD2kE9gI0/oOQDndv+wLuzN1NVucCEfOueEPsJ7LkVAneCQ7 8FoTA+XxQsU8OZKK+QkK5jgaD7vSmTWaTw5+1iL+BmqdZYGp8fxpC6NahwqsLfiyFWuW MD4fQKSilBMtds5rDyt11pa0UW/tXlGL4EvI/1YzpbcWAOyNBIV0TcTtvar/iUALLmMz lLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=ta45jCjTTw9h608mLSaRumjRsUxHErr+7YYhcRdk80Q=; b=ZyCBhWzRYCpxld7Tppin2Uu82H72FtJEI0PN3m/4UqRB6LZvwCL0qKWYvERR5O2OEt pMqkZZn5fqUiOJuesCzHplNk1zFmQHaDraX0XxK0gZOWMlnJWd5zIhGA6NyDmG9WUu2S Kj/UTy2X3c2eEw5qNQZW0+aQTs92t6DI7uqX33jxa2qExQIfDkdZEy5r2T7PzoyRoM9e C8NDsKwFFEUj7AhEmgIPQLWXhHcZMHVsXkeqlRBiKxaXOlb0TsBtYXtmn7U+KWly4Cih h64hI1tyFrzJI0jcU4LjU6UHcYFTJUfe5NavVgkvdTiMz+O141WlMwIB5YtI1vBt0aYj 45fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bZlLJOIm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e188si28737714pfa.16.2018.12.24.05.21.53; Mon, 24 Dec 2018 05:22:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bZlLJOIm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725888AbeLXNTu (ORCPT + 99 others); Mon, 24 Dec 2018 08:19:50 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41624 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbeLXNTu (ORCPT ); Mon, 24 Dec 2018 08:19:50 -0500 Received: by mail-pf1-f194.google.com with SMTP id b7so5798425pfi.8 for ; Mon, 24 Dec 2018 05:19:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=ta45jCjTTw9h608mLSaRumjRsUxHErr+7YYhcRdk80Q=; b=bZlLJOImO/1bupplpSBgyvMTMpxNs0KKCyh9eTwdH+0uwPXfvhWmQ2pAF8DBwsk9Rh bUzZMgNq5nuyQY4GhD3gBu+bVpcBE11KxlyMH4e4GZcPAfuh33MQNhj1AdFZ3jCDGO80 pw0nh5Zx//0/hc8/8FFns4JVjWJHJEPmTg/eT1k0ZUpBl00xFnUcKdIg5f+PdxVKKQa5 FCwYRtJKVzzaeQlNqWS4BSXGJQUhPC21z/MJEvaiy2M9oJNQzcrFQKX4+e8lpIRSzbhj CXPgWhP0XbFWNCAtL9bP3cJwnXoT0RpNFDimxMCjz/XJnM+Mzti5wvF9ze4fxY1gPbV3 yV9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=ta45jCjTTw9h608mLSaRumjRsUxHErr+7YYhcRdk80Q=; b=SnPCG/AleiGGHhnAXqRtQ2/xP+j+uqqEaU2W4L+kkyuOoEa64ugVcii4ApSf95i7A2 jqBYzO1hMU9XprDNBsvafqPuAMKFSbGJEa90jJ5J22u1/WWqXWbts450sQaRTysa3tMm FNsP9MtRQZmWKBHGv+tdeE4IEWdCnkEKyG5PPsFNmy486+Wn2jogQLpSCYrOMz/wrXsD 9coCRh5cR+aNnvfhDWTYfDHUNncJNirgLNagkT6JQsw7AKKI2jFZt/HscIMscSUoT5H9 zt/gIpq+xKrImv9m45DApwAogZOl7ytopXr3/6uXDGXsHwwL5Ov8JqyUUDLmrKwY4LVQ 37CA== X-Gm-Message-State: AJcUukdWBjOOw0ebCLNkXwwocFDalQPafLmNjfcycnL6m20xLDYLq28X rDMHvhehXxCd/WEgw+7X7jg= X-Received: by 2002:a63:db48:: with SMTP id x8mr11898908pgi.365.1545657589149; Mon, 24 Dec 2018 05:19:49 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.18.181]) by smtp.gmail.com with ESMTPSA id s9sm42516339pgl.88.2018.12.24.05.19.47 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Dec 2018 05:19:48 -0800 (PST) Date: Mon, 24 Dec 2018 18:53:40 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, hjc@rock-chips.com, heiko@sntech.de, airlied@linux.ie, linux@armlinux.org.uk, robin.murphy@arm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Subject: [PATCH v5 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20181224132340.GA22112@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert to use vm_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder Tested-by: Heiko Stuebner Acked-by: Heiko Stuebner --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index a8db758..28458ae 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -221,26 +221,18 @@ static int rockchip_drm_gem_object_mmap_iommu(struct drm_gem_object *obj, struct vm_area_struct *vma) { struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); - unsigned int i, count = obj->size >> PAGE_SHIFT; + unsigned int count = obj->size >> 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; - int ret; if (user_count == 0) return -ENXIO; if (end > count) return -ENXIO; - for (i = offset; i < end; i++) { - ret = vm_insert_page(vma, uaddr, rk_obj->pages[i]); - if (ret) - return ret; - uaddr += PAGE_SIZE; - } - - return 0; + return vm_insert_range(vma, vma->vm_start, rk_obj->pages + offset, + user_count); } static int rockchip_drm_gem_object_mmap_dma(struct drm_gem_object *obj, -- 1.9.1