Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3198540imu; Mon, 17 Dec 2018 15:19:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/XwOAOK4bqd+CpCHoihC5W+lzWRl4WGwUjScSNdZwEWlAaXrDaaInQmpYbhHfK2u8NSPhRQ X-Received: by 2002:a63:2b01:: with SMTP id r1mr13641494pgr.432.1545088772018; Mon, 17 Dec 2018 15:19:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545088771; cv=none; d=google.com; s=arc-20160816; b=Owyoed9O3/pCD2MGm7bzRKnWSuk/5yT4dwzuZrkLRm46Pp3dqSD1XOkAUMrpHpHpLn b01dF4iDOVU0TaQcuFwTHolsjNfs4n5f3QfBiYuXm+uTwE7sDA33WRkb62HeXYPq7F0z 9olzalFd+dj41mQgUY+ARHht9CUGyZ1TRJl75JURPD/NnYmD5u6em5I+uZf4FXQ1CLiC +fymIgPLg0O7iZYmrcKB55w9cRnqDvWVwMVYiPRiJbvsiNlJ1GfWbqsWY2Ho5P7svGa1 8UbHSulsNaKRi3QZ8qGZChkBizqxH9wYuYpoGZ67xM2Tt1pZoSZ/6UzD7TI6rK24iCDA SnTg== 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=vHtNG5YY7oqAEcnnEFXV1qkzWXHTgkZmEB/ZXAxtcsE=; b=HDdWajr6Ob0T/qTN7yEXCaZdcsmJh270Bnzy7OTsjOBBZKIMmbFC7xWixJrtAVk5pR yQBhzyP7DNt0KUxrl+ZTRd1LMgMwgz2WyUvBGgP2IofPeeO2qn5lBTGoQmLsrJdYKOMr tk7r4EiObR5E0ZZfZbje6vx76pPpey+7eF/fNZNt/Mc+sw2+AWcWLYJhkq9OVs0DozPp I2R83AR4dl+aB3np93JKfQIliT8kZG7MD6mbEPUIIejEst3DV9zML4bVnAtPqqZR5gf2 cM4sHQ6BjTRHsS6/Wk4qSsshLe99VzIJcihNw1KfZzIEPTCp1tPUVbZhViMHOOMYHOg/ URIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HDTJCfgn; 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 c1si11986006pld.194.2018.12.17.15.19.17; Mon, 17 Dec 2018 15:19:31 -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=HDTJCfgn; 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 S2389453AbeLQUTn (ORCPT + 99 others); Mon, 17 Dec 2018 15:19:43 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38833 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728155AbeLQUTm (ORCPT ); Mon, 17 Dec 2018 15:19:42 -0500 Received: by mail-pl1-f196.google.com with SMTP id e5so6663095plb.5 for ; Mon, 17 Dec 2018 12:19:42 -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=vHtNG5YY7oqAEcnnEFXV1qkzWXHTgkZmEB/ZXAxtcsE=; b=HDTJCfgnh+j0eG6OnfEpzoBfilcO9b+44SSH+rczBsLIYMzVoHJCuW+pyMCFqzu1V/ Zy29YyLtOwX2UDdP/SXCBW97juLvRF2DVYMvTzi4i7gL6TPz9Limk1pxhoJF2ZR2gdCa 7tJqkTGxerJpUQ4Okn3XGjeaWWgwbzll56yffTbkYAxyfBuv/nGBVByby04RrCEOGLBh iw4KiWfDMyasNKW7SRmZWh7oGNwhOdjF9l+eHcRuO4ZmQmXbT2DzCdawrCDVnJ6qPfsO 1gQeUUbdnGeiVu6w6a6Y+0opTR0MRZS8NcET2Nm32kXGicA27G+cCt8iUbI/NAzK56ww TNPA== 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=vHtNG5YY7oqAEcnnEFXV1qkzWXHTgkZmEB/ZXAxtcsE=; b=jPlU7FliLzceOkEZ2Rwjb4xiIRS0hBE1fc1RfNgkCtUFAD/AkS8UCg8t3snVJAVmZA YJCyVRqlBCfZIUurKEomQQRPM/ZFoOD+w4SK4b3wFSVL6lA9KTYva/JgJWM8WGFx++1E c7icSOowPlcbvvewR/FbV+j11gH+pFIoakDPFlXwQH/k+5CU2iMwuAa8QRL3S/AppHEq jSuV0nUDj8fkJe7+1M8qK+XPocMtz/mqieIe8o3v0e4iNvhZV9K3lkUKd2Yjpu8GVcDW D4GDpVSUBmJP1dL4i2LG+4/Ia4KCk9Hb0uj+4m1xZS5N8o33RAKldCQUC1Y0c/KJ24wC ps/A== X-Gm-Message-State: AA+aEWZzmOQtgLbxNaRiFUb6FQPSxy8BbgBm+IOyqnxM+o7bMIIP+KKI p8G4TU38O/xIM5/c15yiXMs= X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr14060709plo.50.1545077982019; Mon, 17 Dec 2018 12:19:42 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.98.208]) by smtp.gmail.com with ESMTPSA id u87sm31872783pfi.2.2018.12.17.12.19.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 12:19:41 -0800 (PST) Date: Tue, 18 Dec 2018 01:53:34 +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 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 v4 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20181217202334.GA11758@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 | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index a8db758..8279084 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -221,26 +221,11 @@ 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 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 - offset); } static int rockchip_drm_gem_object_mmap_dma(struct drm_gem_object *obj, -- 1.9.1