From patchwork Sat Apr 14 15:50:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10341369 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 2963B604D4 for ; Sat, 14 Apr 2018 15:49:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1710C28A5E for ; Sat, 14 Apr 2018 15:49:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A11928A89; Sat, 14 Apr 2018 15:49:11 +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=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (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 8C05828A5E for ; Sat, 14 Apr 2018 15:49:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D9EBE21F2E0F8; Sat, 14 Apr 2018 08:49:09 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::242; helo=mail-pf0-x242.google.com; envelope-from=jrdr.linux@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 71D19220E8CC5 for ; Sat, 14 Apr 2018 08:49:08 -0700 (PDT) Received: by mail-pf0-x242.google.com with SMTP id h69so8368038pfe.13 for ; Sat, 14 Apr 2018 08:49:08 -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=Rg5Ee+SBOm8j+uiQ6LB7ChSOvHVi/ep9hp//vz2DWBE=; b=cw8wYCDOTMEWKVsGuFuMhb4WBYsp9K0iefXdrbGHDemDegF7OLn7KI2/4RpCOK/AfL gvFIeehjUl1cqMVeO9eslBmpffprcZkqyqBzYiRh4y9iUOA4PnfN2bbxclcUFCeZfUTq iv1ncMLf3sFiP05h6bpRXTDs7AYickEv4cf3ZRdIptW+xCfYIwsPs9J7myMQCZpB3IjV tm1peGdM6OLyHUazWlKwn+aL2sM70qvDNpArgnJ3O97qw4qmSs8OM2m4k46WkotHIgvj GWeYQI+ndhU4IyBpdDu+juaGw0rDLZM/x0x4qJUZGcmBg8ozFDq2qj9zOCSMMHsoU5HT h/Mw== 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=Rg5Ee+SBOm8j+uiQ6LB7ChSOvHVi/ep9hp//vz2DWBE=; b=O6DAxP7miT2TX2TjjONGQEsPWte9e27Zvf1KL6c5fz+daiINZO1FeC9CMhLOchQyr5 /aXDSq/B3FNTNEzUkp60K44Z6Rr5UezzvVu7EL4yQkjqqhjyunq6KX2SIVYMG2XwzvNb u6txssH8BlH20UxXiSCaGPvXQiyX+FVRVm1TFeIQTIq+uomugVFITlp46xC44Jlbyr6k 6qyIIrA9sRr/PkBplosVVvSZ8x2OoMYipbbWlNYQfsLRFRamYpqnNFUUGqI0KL1SGfbX i1wQZ4pdojgXpar+mClMBxoI9uQMOH1S+LF4lIldgDb2gyv/C9/ro1eLkNd4iXC0w4Ss ZImw== X-Gm-Message-State: ALQs6tBY2TD5SQkSKAvnnC0bWGRCLMWM4ye6PTk4wf5jXsQoYS/NyhJx 6vOBFeWXZaKsguk5rJwzhCU= X-Google-Smtp-Source: AIpwx48AVYbnvLbjqxfeKni+WGAO0B7yjP3iOQRIbeBLbNtsSu1c2K/S1j/dqUXY1xqvilSQuhnf7A== X-Received: by 10.101.102.5 with SMTP id w5mr7564835pgv.151.1523720947892; Sat, 14 Apr 2018 08:49:07 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([183.82.16.203]) by smtp.gmail.com with ESMTPSA id q9sm16585352pgs.89.2018.04.14.08.49.06 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 14 Apr 2018 08:49:06 -0700 (PDT) Date: Sat, 14 Apr 2018 21:20:59 +0530 From: Souptick Joarder To: dan.j.williams@intel.com Subject: [PATCH] dax: Change return type to vm_fault_t Message-ID: <20180414155059.GA18015@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: willy@infradead.org, linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Use new return type vm_fault_t for fault and huge_fault handler. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox --- drivers/dax/device.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 2137dbc..a122701 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -243,11 +243,11 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, return -1; } -static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { struct device *dev = &dev_dax->dev; struct dax_region *dax_region; - int rc = VM_FAULT_SIGBUS; phys_addr_t phys; pfn_t pfn; unsigned int fault_size = PAGE_SIZE; @@ -274,17 +274,11 @@ static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) pfn = phys_to_pfn_t(phys, dax_region->pfn_flags); - rc = vm_insert_mixed(vmf->vma, vmf->address, pfn); - - if (rc == -ENOMEM) - return VM_FAULT_OOM; - if (rc < 0 && rc != -EBUSY) - return VM_FAULT_SIGBUS; - - return VM_FAULT_NOPAGE; + return vmf_insert_mixed(vmf->vma, vmf->address, pfn); } -static int __dev_dax_pmd_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pmd_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { unsigned long pmd_addr = vmf->address & PMD_MASK; struct device *dev = &dev_dax->dev; @@ -335,7 +329,8 @@ static int __dev_dax_pmd_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) } #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD -static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { unsigned long pud_addr = vmf->address & PUD_MASK; struct device *dev = &dev_dax->dev; @@ -386,13 +381,14 @@ static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) vmf->flags & FAULT_FLAG_WRITE); } #else -static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf) +static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax, + struct vm_fault *vmf) { return VM_FAULT_FALLBACK; } #endif /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ -static int dev_dax_huge_fault(struct vm_fault *vmf, +static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, enum page_entry_size pe_size) { int rc, id; @@ -423,7 +419,7 @@ static int dev_dax_huge_fault(struct vm_fault *vmf, return rc; } -static int dev_dax_fault(struct vm_fault *vmf) +static vm_fault_t dev_dax_fault(struct vm_fault *vmf) { return dev_dax_huge_fault(vmf, PE_SIZE_PTE); }