diff --git a/drivers/gpu/arm/midgard/mali_kbase_mem.c b/drivers/gpu/arm/midgard/mali_kbase_mem.c index 4a223e8ee..42e0df5db 100644 --- a/drivers/gpu/arm/midgard/mali_kbase_mem.c +++ b/drivers/gpu/arm/midgard/mali_kbase_mem.c @@ -2182,14 +2182,14 @@ static int kbase_jd_user_buf_map(struct kbase_context *kctx, pinned_pages = get_user_pages(NULL, mm, address, alloc->imported.user_buf.nr_pages, - reg->flags & KBASE_REG_GPU_WR, - 0, pages, NULL); + reg->flags & KBASE_REG_GPU_WR ? FOLL_WRITE : 0, + pages, NULL); #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) pinned_pages = get_user_pages_remote(NULL, mm, address, alloc->imported.user_buf.nr_pages, - reg->flags & KBASE_REG_GPU_WR, - 0, pages, NULL); + reg->flags & KBASE_REG_GPU_WR ? FOLL_WRITE : 0, + pages, NULL); #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) pinned_pages = get_user_pages_remote(NULL, mm, address, @@ -2201,7 +2201,7 @@ static int kbase_jd_user_buf_map(struct kbase_context *kctx, address, alloc->imported.user_buf.nr_pages, reg->flags & KBASE_REG_GPU_WR ? FOLL_WRITE : 0, - pages, NULL, NULL); + pages, NULL); #endif if (pinned_pages <= 0) diff --git a/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c b/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c index eea429a8..76610fda 100644 --- a/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c +++ b/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c @@ -1161,10 +1161,8 @@ static struct kbase_va_region *kbase_mem_from_user_buffer( #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) faulted_pages = get_user_pages(current, current->mm, address, *va_pages, - reg->flags & KBASE_REG_GPU_WR, 0, pages, NULL); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) - faulted_pages = get_user_pages(address, *va_pages, - reg->flags & KBASE_REG_GPU_WR, 0, pages, NULL); + reg->flags & KBASE_REG_GPU_WR ? FOLL_WRITE : 0, + pages, NULL); #else faulted_pages = get_user_pages(address, *va_pages, reg->flags & KBASE_REG_GPU_WR ? FOLL_WRITE : 0,