From patchwork Fri Jan 11 15:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10758205 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA5CB91E for ; Fri, 11 Jan 2019 15:05:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94DE029C79 for ; Fri, 11 Jan 2019 15:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8695F2A02D; Fri, 11 Jan 2019 15:05:40 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2951429C79 for ; Fri, 11 Jan 2019 15:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 248DA8E0005; Fri, 11 Jan 2019 10:05:39 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1F8618E0001; Fri, 11 Jan 2019 10:05:39 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EBF48E0005; Fri, 11 Jan 2019 10:05:39 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id BDC468E0001 for ; Fri, 11 Jan 2019 10:05:38 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id y88so10520093pfi.9 for ; Fri, 11 Jan 2019 07:05:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition:user-agent; bh=fve/F1/lKXEnfpzre5B+d6239UbIM50sDNUC8vj1UvQ=; b=PEly6dDoUqiv25HuxQdMpLmovH7EDbKdzHgNHFdTjnV7OrY/o4hKeayg1kXfYhNaKI d/+YN1x8yvFvWt8fx3rbL5z+lbzYP+wefjUIhENxQ6HZIV4iP+qscpF7e+fYV9Kr3meI ik1LpYKuLZFtRKN65f+m3iSlzoQ4bcf0LFg8L5kdYdulB8edjTf6PsVilWFaFvFyUNGB XFcKVdw9W2USuX4WDLIoMq9iAa0VTkvCUm7wnvYOP0XQG8CFZyGWU0SlIuVln7FRdHNs icCNt3Em1UCkGSw3sx3WlMcYWfLPeZN0Zt0X69omJpdsRU34ehIg1k/nMUeA+VMvO7OD hpbw== X-Gm-Message-State: AJcUukfQ/MwKmzHa/8h9bfsII/xS0/Bqv+K6ES6+WQ3oa/wssb5zDNiu HsS0JQpzmJYfJ1osy6eL2yDIBJkua7DBvx/UzGRdtZN8Y9N6YcDEEmJIqdPmTRaDNucT+mDdm4U q9yiofvkvcc4Yna8zfmj6JEXxBwynroRJtEPfbEBe90L/Be3tODnQGpI1/hQNl6/60NCGLIQYVD 4R7GJc2v2e+xTE7GnOAt+ZUCV1Li2EQ6UvovBh7QGgWcgM9NoNV9+Ut1p3KOxReDrIPRR7A9YCK nskzQflreBn/g/NuPw9fDMKaSuSt8BW56l4Uv7oGquPbWPeZXjVettv9b6I/J5Rd/xvvGNQJxn+ hM0FFA+jCn5MQ+RojC4G5dHE/dGUwqowlV6kf8F2womtyS8sqzhafnk3ZFEFBA2i3411xXYoSOR D X-Received: by 2002:a63:c0f:: with SMTP id b15mr13805020pgl.314.1547219138461; Fri, 11 Jan 2019 07:05:38 -0800 (PST) X-Received: by 2002:a63:c0f:: with SMTP id b15mr13804978pgl.314.1547219137774; Fri, 11 Jan 2019 07:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219137; cv=none; d=google.com; s=arc-20160816; b=rqbDSgljwlcVym8Bm0sCqE9Dgbn423d+xdOTB8ZpBUtlcseshogZP2jc/FTACTCkF8 SuhXAYLFnQj7Hx43rnwwKHD9QAeejvfIJAiPoseyJSkZFg6TIlOdpeih8y69xEioGFWs 9oFRMMHwPUjCjAXiIvzzOzSxK2nWxKcA2/CTizN2GquPcLSyd8ncyuEjIg+J4ubkasnr e0mOEKaxjVgsGeg+09BLrzr4AmOJRIJKZaJfVvYTdE4FQfuUOl2iZ8DEn9b0hhpB0ekB m9iOCt8N80hYgspyoSpGXKdbKCCsC0iqWQ41J34xyul8deXpTDeviHRAEwZpkcE4zQdb TWJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:dkim-signature; bh=fve/F1/lKXEnfpzre5B+d6239UbIM50sDNUC8vj1UvQ=; b=QFUxjP51Wt0LmrFCqhcb4CqVt5jH110ui/WAzamLDDJaM3pTjy1oPCgxBr0q1vSwxK 3WzJMbFbzlQxal7LQhVsErA9XfxXvCKzM2MSKPoF9JJ54eOnByXRQJcWRNppkYBquW2c nmSTZoKYa7vefwEY97tws3SpFldmKTTJ/FtA+2cqLH0BV9fRtYAc2vaIJCRr2Au3q+R2 WINnAHQbMVZQMByZkfg4CAVril+CIfYv70NTGERFtIrFNXenZFXNghaHkr6RqK/aauwS rpDDtc1v+3YedRDAku7VJo551P815tPAPXHaeZx4f/0DzjGfsAZwP8mmfwkGK5d6QcfB qM3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sh2LY1Wi; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b35sor3496331plb.6.2019.01.11.07.05.37 for (Google Transport Security); Fri, 11 Jan 2019 07:05:37 -0800 (PST) Received-SPF: pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sh2LY1Wi; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-Smtp-Source: ALg8bN5Rc2l8bWM7uxkHK8LK4e398s3Iy/tXK9itkSm2yPC22Yk8baS7VKxthK4Bra16e8DuO0AC9w== 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-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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,