Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp671007imu; Fri, 11 Jan 2019 07:08:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN7T+jNm8tyZJr7kfqnaw4BWkx5oFzcRGUHubL4kdE0Yw4TFJHDK/eNdvomQjhRhI4RufCHo X-Received: by 2002:a17:902:2468:: with SMTP id m37mr14984568plg.314.1547219318364; Fri, 11 Jan 2019 07:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219318; cv=none; d=google.com; s=arc-20160816; b=uuoK6zNRzbhLRXgKI8xmByi8y5bX8rksEgAWFyTfs/fcMIlpsTKUmdGRZCcdp1OJXd wQwtCA9de66ujZmXcrYVCmhgb9JNm+mpoqaakhZ97fXUWXgwyLZMnir0Diw7yCSd+MLz x7vwSZzgTWUk+oz572sCAl2ctyhp9P52pU9EmoouqmjHM/lowVXAUkZ0aI+5b6r5nFhv wF+xea4wFM+iYLfvavTXIfW2Vfd9+wkDnolPbayNnom3peH3pnV3U9pk5dpyGIbNMsKz AxZFk7oQvJllQlj7lhymSNFAg74FZpc2yLqbkm156GIjdEdwvxbftRosMkP3Ec/FAV9h Qe8g== 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=fve/F1/lKXEnfpzre5B+d6239UbIM50sDNUC8vj1UvQ=; b=kiYF7kVHlmR8Ssj9WRcLvdgNECKF9YNiNRvdiRHJim82RiKKysuAVb3f3Glpi6PGfM 9R0rrhaks6YSDdcMmA5rmbjDzxNdLQnTm80KwrsFwQot7TaF5xasziPW6LA6xeCDMEji dzKBSapg2Epy1z/MyDq59Fe4h/sRHNJKNuJowQIeYSc4/Vs2R+6AhvSFzmhl5aJQVVAX bTu/WLEy3Bp0tQc3aBv5ahkwOeco1kPt7z7RWLkUWVw8vTC52lhjq66P/YXE1NICrm9/ KDVjYLmeq+dHGZbEFY2nZZdZuKXZpmIAJ1fQJo6HoTVn0fhtYVOqKAgkEf60wx2HINlU ygdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sh2LY1Wi; 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 g31si58864546pld.358.2019.01.11.07.08.23; Fri, 11 Jan 2019 07:08:38 -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=sh2LY1Wi; 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 S2391887AbfAKPFk (ORCPT + 99 others); Fri, 11 Jan 2019 10:05:40 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39575 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730940AbfAKPFi (ORCPT ); Fri, 11 Jan 2019 10:05:38 -0500 Received: by mail-pl1-f193.google.com with SMTP id 101so6877075pld.6 for ; Fri, 11 Jan 2019 07:05:37 -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=fve/F1/lKXEnfpzre5B+d6239UbIM50sDNUC8vj1UvQ=; b=sh2LY1WiZPIeUaF3MW5DJg/QEYmtg7MuKqRcV+ohKVqeLOX2kAj87/ncMa6egebbYo k294jPvUpvY8tWh/TVJyCnvyC/T/VHszUoQByu4+B0bLPUEBcCPJg3A6iuRrk0nL/SCc lpg3ZBT6tI1It72Jxe2UE98iYfsC88cR1xfpH7vrMx9OJMw9tL2Vr1vv2W8XZ4Xktn9H NZtgrvTlD3Ik9YbSkPstnCWGQNPhb3+vQLQJ5oV3oYtnxdhNYQ0n2lHyDmzWabMOBagm +fOV5sL4jmozsC4arWO7kSdaVEIRpgV9bHvSvYqaiApnZh3+zyi/XPtspSlyoMBygeU3 sZeA== 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=fve/F1/lKXEnfpzre5B+d6239UbIM50sDNUC8vj1UvQ=; b=o90pOzefIBz3B1B/6oUtM3PgOtPhEVGVneY+/iLSMHXJP5J+JNIM8cqId+ep128ZOB sSinuRnLMH+Lz0+r3b80yClN3V08C5q7ZrxlLvt1SsYX2+m88+1gnxlb+kBIOsB8QZyw qDna4/9mf3sBjVLOF/0cAHozJI4e/MLfWXOoTPrkZhg2FE2Ex09D5/ac8YcqjOZs1WAy enjmj5PjWt72eE9EGFBfXnnY1dbmtGj0DKbCyRxdAfgWU8L/9WsbrsEMeJUk6j9gvMLJ OiE6zceTFijFwKuEKxQt4rSTrFKoa2vwEwqyBzX3b5VQ49C/46NvwbxtaD1eHtrpgj/D Bdzg== X-Gm-Message-State: AJcUukdlNmB9esHKA6p5B3ORXvZHZiWgKdPUnvAk398NsKJ0IpJ7Mdgf qlLABz21takkzNzuBSFa3Fk= X-Received: by 2002:a17:902:1105:: with SMTP id d5mr14463670pla.47.1547219137463; Fri, 11 Jan 2019 07:05:37 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.52.190]) by smtp.gmail.com with ESMTPSA id h15sm98053997pgl.43.2019.01.11.07.05.35 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Jan 2019 07:05:36 -0800 (PST) Date: Fri, 11 Jan 2019 20:39:33 +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 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20190111150933.GA2760@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 --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index a8db758..c9e207f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -221,26 +221,13 @@ 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, rk_obj->pages, count); } static int rockchip_drm_gem_object_mmap_dma(struct drm_gem_object *obj, -- 1.9.1