Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6620328imu; Wed, 30 Jan 2019 19:07:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN7RGIA90hJTK2IxEI6skjC24j4VkC3nuferaQ1p+lPbV22Zkowb/9OzhR1jVGU7JsarC5zo X-Received: by 2002:a63:4e15:: with SMTP id c21mr30014701pgb.50.1548904027223; Wed, 30 Jan 2019 19:07:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548904027; cv=none; d=google.com; s=arc-20160816; b=kWj2ClHws+qchut40M541wQdBkXeUdAFSgvnkG/3IXJKHqnoN4flfxGZS/aBSS0bCv lywSNuHXlnPLaHyofoMML6LFalxBYYktyBEyZbX+MNHixRSgssPBfijgQEuAzbfxywMy heXtZb/p/Q95njd021DMQYU9ZL7vxOPgDmvY+k0FArtQ9ngPNJSC+2s2FEZcZ40JXAh/ /NFuTk46Z6wx8XBnVU2Y1vn7WZ9dgFdA0O0Vl/PALIBukPrA30p6zWvBNKFBvmLdB3Cd oka6OhgNf6jnFqozazxleHrPComewQaumLzkuui/sTgel1/1CxpQPsnggUZVVgKlXbzG aGHA== 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=oV3lgkUcYAN/jPrWe5644CiuB3CqfdH1V0Z68MusNF+JkZofq2r49u5ma0OOzVLtH4 BeiTe8xOV10h10xebuK098YoiQj8uurhdacWYe2frUCPHe1bO8Y6dP+mC7ShsYH9qHYo odZmPGR7nPZnDSS2U/I1cEQ3UOHK17WbQU2t03OZ3BnQ7mByFobp/0ZDgj6a1viogFsk 4t1VjUh4O6wyUvSR+pur4X8P12r2+GLMS4hQ1IrGWFiJTHty+fjCQNJ7SiOlpwFIV5W5 L4FGlB2QZjbYAjCaf0RHpRj3JKzeX0mfs5RgawqJYYOMMrLxjUeS7J+fSGwSk4TLUnDd vNOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VJa1+zh8; 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 t77si2142467pgb.51.2019.01.30.19.06.52; Wed, 30 Jan 2019 19:07:07 -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=VJa1+zh8; 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 S1729038AbfAaDG2 (ORCPT + 99 others); Wed, 30 Jan 2019 22:06:28 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42092 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfAaDG2 (ORCPT ); Wed, 30 Jan 2019 22:06:28 -0500 Received: by mail-pf1-f194.google.com with SMTP id 64so793493pfr.9 for ; Wed, 30 Jan 2019 19:06:28 -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=VJa1+zh8xHi3tI1io1YyR1jW4Ql0L2HM/0G/TqGLCYIRuEUfaDMSQLwWgfnv/q2VCK iMQgvcHSc2/MMEr41Z3VcXIJpBynXvCLMm+MCb5Ony0kLh1P+43S1EyOZ0c2VVcXfUDi zyUHlPc92S25kuxJL0xxi6q5K7621sWC7v7ZPljG/f/9EmAD7+iDx7aFSG3OZ8ScP0cF VzOGvcgsG44tSmhzqBnqDDYP/OTdVImNeD06R22jMcUhnzLmqtpjiveuyfIVjBd7x9Me M4s/fGqqA5tbzFW8w6RcVcyXN17XcXe3Wf1t1LgEPIqHODKKlYApfWHRPjE12iaJHekM stRg== 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=D2Z4J1NHG9smLYn5ymmM+hhmBzhbf2BvBI4wk92ph44mcF195/dqggTjtFkkLbFe1+ 9PTCMvNwkUqF8fLeCoj7iydaQM3Ws9S2j0e6/pYHdy8IIPvmdolZI0D6lcPE5I7X0liC rfAP0Gu77q15AlXxq9mKZcYBgb6v6iEKU4eNrHcGYeWs1FbVrHsqhEQytVIgrskprLxP 2TdgPQjS4Tvn7cwAsaoz71OUllNW5hcmlskFzj0vMUzaslEQAbBNzolij57jeihbWq1o gOUbGESdVBRvs1hvIYLc3RzasL3Fe/XMC+SnbaRNxsBUeXidCJotN4dhsg+brYUZFS/q 7gZg== X-Gm-Message-State: AJcUukdmOvM+f2nhPcayqY5tEHTbXhzRTQLB6OaMuiQrm04fMnw7Fyvo zCCWGP9fHTWI3vAFi4Tyx54= X-Received: by 2002:a62:1f9d:: with SMTP id l29mr33146546pfj.14.1548903987795; Wed, 30 Jan 2019 19:06:27 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.20.103]) by smtp.gmail.com with ESMTPSA id v2sm4236663pgs.0.2019.01.30.19.06.26 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Jan 2019 19:06:27 -0800 (PST) Date: Thu, 31 Jan 2019 08:40: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: [PATCHv2 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20190131031040.GA2320@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