ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / linux / mali_ukk_soft_job.c
index 4dd005dca253067578bb03194028b10bb0a074c9..beeb7531a662c673b57c195a83cfdfd915a812c8 100755 (executable)
@@ -1,11 +1,11 @@
 /*
- * This confidential and proprietary software may be used only as
- * authorised by a licensing agreement from ARM Limited
- * (C) COPYRIGHT 2013 ARM Limited
- * ALL RIGHTS RESERVED
- * The entire notice above must be reproduced on all authorised
- * copies and copies may only be made to the extent permitted
- * by a licensing agreement from ARM Limited.
+ * Copyright (C) 2013-2014, 2016 ARM Limited. All rights reserved.
+ * 
+ * This program is free software and is provided to you under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
+ * 
+ * A copy of the licence is included with the program, and can also be obtained from Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 #include <linux/fs.h>       /* file system operations */
 #include <asm/uaccess.h>    /* user space access */
@@ -21,8 +21,9 @@
 
 int soft_job_start_wrapper(struct mali_session_data *session, _mali_uk_soft_job_start_s __user *uargs)
 {
-       u32 type, user_job, point;
-       _mali_uk_fence_t uk_fence;
+       _mali_uk_soft_job_start_s kargs;
+       u32 type, point;
+       u64 user_job;
        struct mali_timeline_fence fence;
        struct mali_soft_job *job = NULL;
        u32 __user *job_id_ptr = NULL;
@@ -35,14 +36,17 @@ int soft_job_start_wrapper(struct mali_session_data *session, _mali_uk_soft_job_
 
        MALI_DEBUG_ASSERT_POINTER(session->soft_job_system);
 
-       if (0 != get_user(type, &uargs->type))                 return -EFAULT;
-       if (0 != get_user(user_job, &uargs->user_job))         return -EFAULT;
-       if (0 != get_user(job_id_ptr, &uargs->job_id_ptr))     return -EFAULT;
+       if (0 != copy_from_user(&kargs, uargs, sizeof(kargs))) {
+               return -EFAULT;
+       }
+
+       type = kargs.type;
+       user_job = kargs.user_job;
+       job_id_ptr = (u32 __user *)(uintptr_t)kargs.job_id_ptr;
 
-       if (0 != copy_from_user(&uk_fence, &uargs->fence, sizeof(_mali_uk_fence_t))) return -EFAULT;
-       mali_timeline_fence_copy_uk_fence(&fence, &uk_fence);
+       mali_timeline_fence_copy_uk_fence(&fence, &kargs.fence);
 
-       if (MALI_SOFT_JOB_TYPE_USER_SIGNALED < type) {
+       if ((MALI_SOFT_JOB_TYPE_USER_SIGNALED != type) && (MALI_SOFT_JOB_TYPE_SELF_SIGNALED != type)) {
                MALI_DEBUG_PRINT_ERROR(("Invalid soft job type specified\n"));
                return -EINVAL;
        }