The patch titled Subject: drivers/gpu/drm/gma500/: change return type to vm_fault_t has been added to the -mm tree. Its filename is gpu-drm-gma500-change-return-type-to-vm_fault_t.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/gpu-drm-gma500-change-return-type-to-vm_fault_t.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/gpu-drm-gma500-change-return-type-to-vm_fault_t.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Souptick Joarder <jrdr.linux@xxxxxxxxx> Subject: drivers/gpu/drm/gma500/: change return type to vm_fault_t 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-> 1c8f422059ae ("mm: change return type to vm_fault_t") Previously vm_insert_{pfn,mixed} returns err which driver mapped into VM_FAULT_* type. The new function vmf_insert_{pfn,mixed} will replace this inefficiency by returning VM_FAULT_* type. vmf_error() is the newly introduce inline function in 4.17-rc6. Link: http://lkml.kernel.org/r/20180713154541.GA3345@jordon-HP-15-Notebook-PC Signed-off-by: Souptick Joarder <jrdr.linux@xxxxxxxxx> Reviewed-by: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx> Cc: David Airlie <airlied@xxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/gma500/framebuffer.c | 14 ++++-------- drivers/gpu/drm/gma500/gem.c | 27 +++++++++---------------- drivers/gpu/drm/gma500/psb_drv.h | 3 +- 3 files changed, 17 insertions(+), 27 deletions(-) diff -puN drivers/gpu/drm/gma500/framebuffer.c~gpu-drm-gma500-change-return-type-to-vm_fault_t drivers/gpu/drm/gma500/framebuffer.c --- a/drivers/gpu/drm/gma500/framebuffer.c~gpu-drm-gma500-change-return-type-to-vm_fault_t +++ a/drivers/gpu/drm/gma500/framebuffer.c @@ -108,7 +108,7 @@ static int psbfb_pan(struct fb_var_scree return 0; } -static int psbfb_vm_fault(struct vm_fault *vmf) +static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct psb_framebuffer *psbfb = vma->vm_private_data; @@ -118,7 +118,7 @@ static int psbfb_vm_fault(struct vm_faul int page_num; int i; unsigned long address; - int ret; + vm_fault_t ret = VM_FAULT_SIGBUS; unsigned long pfn; unsigned long phys_addr = (unsigned long)dev_priv->stolen_base + gtt->offset; @@ -131,18 +131,14 @@ static int psbfb_vm_fault(struct vm_faul for (i = 0; i < page_num; i++) { pfn = (phys_addr >> PAGE_SHIFT); - ret = vm_insert_mixed(vma, address, + ret = vmf_insert_mixed(vma, address, __pfn_to_pfn_t(pfn, PFN_DEV)); - if (unlikely((ret == -EBUSY) || (ret != 0 && i > 0))) + if (unlikely(ret & VM_FAULT_ERROR)) break; - else if (unlikely(ret != 0)) { - ret = (ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS; - return ret; - } address += PAGE_SIZE; phys_addr += PAGE_SIZE; } - return VM_FAULT_NOPAGE; + return ret; } static void psbfb_vm_open(struct vm_area_struct *vma) diff -puN drivers/gpu/drm/gma500/gem.c~gpu-drm-gma500-change-return-type-to-vm_fault_t drivers/gpu/drm/gma500/gem.c --- a/drivers/gpu/drm/gma500/gem.c~gpu-drm-gma500-change-return-type-to-vm_fault_t +++ a/drivers/gpu/drm/gma500/gem.c @@ -134,12 +134,13 @@ int psb_gem_dumb_create(struct drm_file * vma->vm_private_data points to the GEM object that is backing this * mapping. */ -int psb_gem_fault(struct vm_fault *vmf) +vm_fault_t psb_gem_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct drm_gem_object *obj; struct gtt_range *r; - int ret; + int err; + vm_fault_t ret; unsigned long pfn; pgoff_t page_offset; struct drm_device *dev; @@ -158,9 +159,10 @@ int psb_gem_fault(struct vm_fault *vmf) /* For now the mmap pins the object and it stays pinned. As things stand that will do us no harm */ if (r->mmapping == 0) { - ret = psb_gtt_pin(r); - if (ret < 0) { - dev_err(dev->dev, "gma500: pin failed: %d\n", ret); + err = psb_gtt_pin(r); + if (err < 0) { + dev_err(dev->dev, "gma500: pin failed: %d\n", err); + ret = vmf_error(err); goto fail; } r->mmapping = 1; @@ -175,18 +177,9 @@ int psb_gem_fault(struct vm_fault *vmf) pfn = (dev_priv->stolen_base + r->offset) >> PAGE_SHIFT; else pfn = page_to_pfn(r->pages[page_offset]); - ret = vm_insert_pfn(vma, vmf->address, pfn); - + ret = vmf_insert_pfn(vma, vmf->address, pfn); fail: mutex_unlock(&dev_priv->mmap_mutex); - switch (ret) { - case 0: - case -ERESTARTSYS: - case -EINTR: - return VM_FAULT_NOPAGE; - case -ENOMEM: - return VM_FAULT_OOM; - default: - return VM_FAULT_SIGBUS; - } + + return ret; } diff -puN drivers/gpu/drm/gma500/psb_drv.h~gpu-drm-gma500-change-return-type-to-vm_fault_t drivers/gpu/drm/gma500/psb_drv.h --- a/drivers/gpu/drm/gma500/psb_drv.h~gpu-drm-gma500-change-return-type-to-vm_fault_t +++ a/drivers/gpu/drm/gma500/psb_drv.h @@ -21,6 +21,7 @@ #define _PSB_DRV_H_ #include <linux/kref.h> +#include <linux/mm_types.h> #include <drm/drmP.h> #include <drm/drm_global.h> @@ -749,7 +750,7 @@ extern int psb_gem_get_aperture(struct d struct drm_file *file); extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args); -extern int psb_gem_fault(struct vm_fault *vmf); +extern vm_fault_t psb_gem_fault(struct vm_fault *vmf); /* psb_device.c */ extern const struct psb_ops psb_chip_ops; _ Patches currently in -mm which might be from jrdr.linux@xxxxxxxxx are fs-9p-adding-new-return-type-vm_fault_t.patch mm-convert-return-type-of-handle_mm_fault-caller-to-vm_fault_t.patch fs-proc-adding-new-typedef-vm_fault_t.patch fs-nilfs2-adding-new-return-type-vm_fault_t.patch hwtracing-intel_th-change-return-type-to-vm_fault_t.patch fs-nfs-adding-new-return-type-vm_fault_t.patch fs-afs-adding-new-return-type-vm_fault_t.patch char-agp-change-return-type-to-vm_fault_t.patch gpu-drm-gma500-change-return-type-to-vm_fault_t.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html