Commit a38b80c5 authored by Souptick Joarder's avatar Souptick Joarder Committed by Martin K. Petersen

scsi: cxlflash: Change return type for fault handler

Use new return type vm_fault_t for 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.

Ref-> commit 1c8f4220 ("mm: change return type to vm_fault_t")

Previously, VM_FAULT_NOPAGE was returned without verifying return value of
vm_insert_pfn. The new inline vmf_insert_pfn() will address this issue by
returning correct VM_FAULT_* type from fault handler.
Signed-off-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4ae5e9d1
...@@ -1158,7 +1158,7 @@ static int afu_release(struct inode *inode, struct file *file) ...@@ -1158,7 +1158,7 @@ static int afu_release(struct inode *inode, struct file *file)
* *
* Return: 0 on success, -errno on failure * Return: 0 on success, -errno on failure
*/ */
static int ocxlflash_mmap_fault(struct vm_fault *vmf) static vm_fault_t ocxlflash_mmap_fault(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct ocxlflash_context *ctx = vma->vm_file->private_data; struct ocxlflash_context *ctx = vma->vm_file->private_data;
...@@ -1181,8 +1181,7 @@ static int ocxlflash_mmap_fault(struct vm_fault *vmf) ...@@ -1181,8 +1181,7 @@ static int ocxlflash_mmap_fault(struct vm_fault *vmf)
mmio_area = ctx->psn_phys; mmio_area = ctx->psn_phys;
mmio_area += offset; mmio_area += offset;
vm_insert_pfn(vma, vmf->address, mmio_area >> PAGE_SHIFT); return vmf_insert_pfn(vma, vmf->address, mmio_area >> PAGE_SHIFT);
return VM_FAULT_NOPAGE;
} }
static const struct vm_operations_struct ocxlflash_vmops = { static const struct vm_operations_struct ocxlflash_vmops = {
......
...@@ -1108,7 +1108,7 @@ static struct page *get_err_page(struct cxlflash_cfg *cfg) ...@@ -1108,7 +1108,7 @@ static struct page *get_err_page(struct cxlflash_cfg *cfg)
* *
* Return: 0 on success, VM_FAULT_SIGBUS on failure * Return: 0 on success, VM_FAULT_SIGBUS on failure
*/ */
static int cxlflash_mmap_fault(struct vm_fault *vmf) static vm_fault_t cxlflash_mmap_fault(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct file *file = vma->vm_file; struct file *file = vma->vm_file;
...@@ -1119,7 +1119,7 @@ static int cxlflash_mmap_fault(struct vm_fault *vmf) ...@@ -1119,7 +1119,7 @@ static int cxlflash_mmap_fault(struct vm_fault *vmf)
struct ctx_info *ctxi = NULL; struct ctx_info *ctxi = NULL;
struct page *err_page = NULL; struct page *err_page = NULL;
enum ctx_ctrl ctrl = CTX_CTRL_ERR_FALLBACK | CTX_CTRL_FILE; enum ctx_ctrl ctrl = CTX_CTRL_ERR_FALLBACK | CTX_CTRL_FILE;
int rc = 0; vm_fault_t rc = 0;
int ctxid; int ctxid;
ctxid = cfg->ops->process_element(ctx); ctxid = cfg->ops->process_element(ctx);
...@@ -1159,7 +1159,7 @@ static int cxlflash_mmap_fault(struct vm_fault *vmf) ...@@ -1159,7 +1159,7 @@ static int cxlflash_mmap_fault(struct vm_fault *vmf)
out: out:
if (likely(ctxi)) if (likely(ctxi))
put_context(ctxi); put_context(ctxi);
dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc); dev_dbg(dev, "%s: returning rc=%x\n", __func__, rc);
return rc; return rc;
err: err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment