From patchwork Wed Apr 25 04:59:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10361819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8360F60225 for ; Wed, 25 Apr 2018 07:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CF5228DF0 for ; Wed, 25 Apr 2018 07:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61F8628F79; Wed, 25 Apr 2018 07:15:59 +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=-5.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07E5E28DF0 for ; Wed, 25 Apr 2018 07:15:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E8456E581; Wed, 25 Apr 2018 07:14:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6C276E517 for ; Wed, 25 Apr 2018 04:57:25 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id i6so12468767pgv.3 for ; Tue, 24 Apr 2018 21:57:25 -0700 (PDT) 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=g1nXUjj9HfDsxAKJqSWff+336mcUncs8y1xWbrYPj44=; b=ofSOQWCqRLJ+sYuAAsKqADT/WyKps3xQEf+UD+0ZtKddCowQnQU3g9wO0t6jCbzqbW 09uZfYWcocWcv279ADMRVZ9TCg4gFcvlJwamtVMLS44e2KMxuDqlIoD3/p/EsvObAiOi JSjpY2OHply3Nh5UHjSJ4YzVIdh7fU5gov2zninMmrpHK+1koi+5hkQouVGSLnmSbagP fpxapmjFnhebJZBvAGaI609+2Zo8nSfVkDGBVSKdMbg9htV1K2VeaxtdQw7b7SPqN1hx DFqAhPop8fmM3Xyr9fN+1NPmkyYu8i0dcuOJenH38XnCvnSuXnlOD9N02ej2XcV2cB1j cuIg== 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=g1nXUjj9HfDsxAKJqSWff+336mcUncs8y1xWbrYPj44=; b=FvomYHXvTUejH/r3rN2WngOIJ09LJDp1HYuT5XN0VU+m77qPIapByp+KsBgLDr5WEn swsMaveRP946TmNI3S/Uiw8fXrWmA4sdv4hpQYXev0j6oR87eMcfjbSBfoRtyhqUgHvy Y/jNhvGNRu3WPXRJXb5nQuOrTGG95B6SmQoDtnqNO61gNNickIKPilU4Zr1eKQBMNIlo peU5OgYgfmW82FKrZfaQDe00Qq3tJZm6Vtl9zwJO5drwUYOijJp/X69a02U8zc3flqxE a9K5U9Cko0JLp+1LP7rE47UGybNICFll/wRTBxg2vSQxBcMXFTQZGOmjRRJ+r49BYCSU XN9A== X-Gm-Message-State: ALQs6tDStgkNtjafzIaPFSbJXoVFFT2QeSDUL2ccEpJuh/tphP3LgPcN RvYU6eNjZVasq6msMXadqdo3SZYgi0s= X-Google-Smtp-Source: AIpwx4+qjUcm6Ti8C3AbzXPDo6HwHZd78DnDvyDaNk+9cr1dPH+6KC5vJu0iZXcqoNyJ8tgPmlDqMQ== X-Received: by 10.99.109.134 with SMTP id i128mr22980469pgc.59.1524632245425; Tue, 24 Apr 2018 21:57:25 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([2405:204:412c:6ea6:c066:5423:e559:640f]) by smtp.gmail.com with ESMTPSA id z13sm39073617pfk.156.2018.04.24.21.57.23 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Apr 2018 21:57:24 -0700 (PDT) Date: Wed, 25 Apr 2018 10:29:22 +0530 From: Souptick Joarder To: airlied@redhat.com, christian.koenig@amd.com, cakturk@gmail.com, seanpaul@chromium.org, daniel.vetter@ffwll.ch, mhocko@kernel.org Subject: [PATCH v2] gpu: drm: udl: Adding new typedef vm_fault_t Message-ID: <20180425045922.GA21590@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Wed, 25 Apr 2018 07:10:54 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: willy@infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use new return type vm_fault_t for fault and huge_fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type. Commit 1c8f422059ae ("mm: change return type to vm_fault_t") Previously vm_insert_page() returns err which driver mapped into VM_FAULT_* type. The new function vmf_ insert_page() will replace this inefficiency by returning VM_FAULT_* type. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox --- v2: Updated the change log drivers/gpu/drm/udl/udl_drv.h | 3 ++- drivers/gpu/drm/udl/udl_gem.c | 15 ++------------- 2 files changed, 4 insertions(+), 14 deletions(-) -- 1.9.1 diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index 2a75ab8..11151c4 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h @@ -16,6 +16,7 @@ #include #include +#include #define DRIVER_NAME "udl" #define DRIVER_DESC "DisplayLink" @@ -134,7 +135,7 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev, int udl_gem_vmap(struct udl_gem_object *obj); void udl_gem_vunmap(struct udl_gem_object *obj); int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); -int udl_gem_fault(struct vm_fault *vmf); +vm_fault_t udl_gem_fault(struct vm_fault *vmf); int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, int width, int height); diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index dee6bd9..cf5fe35 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c @@ -100,13 +100,12 @@ int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) return ret; } -int udl_gem_fault(struct vm_fault *vmf) +vm_fault_t udl_gem_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); struct page *page; unsigned int page_offset; - int ret = 0; page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT; @@ -114,17 +113,7 @@ int udl_gem_fault(struct vm_fault *vmf) return VM_FAULT_SIGBUS; page = obj->pages[page_offset]; - ret = vm_insert_page(vma, vmf->address, page); - switch (ret) { - case -EAGAIN: - case 0: - case -ERESTARTSYS: - return VM_FAULT_NOPAGE; - case -ENOMEM: - return VM_FAULT_OOM; - default: - return VM_FAULT_SIGBUS; - } + return vmf_insert_page(vma, vmf->address, page); } int udl_gem_get_pages(struct udl_gem_object *obj)