video: rockchip: hdmi: misc clean up to hdmi driver
[firefly-linux-kernel-4.4.55.git] / drivers / android / binder.c
index 83af691b5840ce4e8aa9c8c526aec69d9bcdecdc..57f52a2afa356788d4ee18f02867361da2b20a26 100644 (file)
@@ -444,12 +444,12 @@ static void binder_set_nice(long nice)
                set_user_nice(current, nice);
                return;
        }
-       min_nice = 20 - current->signal->rlim[RLIMIT_NICE].rlim_cur;
+       min_nice = rlimit_to_nice(current->signal->rlim[RLIMIT_NICE].rlim_cur);
        binder_debug(BINDER_DEBUG_PRIORITY_CAP,
                     "%d: nice value %ld not allowed use %ld instead\n",
                      current->pid, nice, min_nice);
        set_user_nice(current, min_nice);
-       if (min_nice < 20)
+       if (min_nice <= MAX_NICE)
                return;
        binder_user_error("%d RLIMIT_NICE not set\n", current->pid);
 }
@@ -551,7 +551,6 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
 {
        void *page_addr;
        unsigned long user_page_addr;
-       struct vm_struct tmp_area;
        struct page **page;
        struct mm_struct *mm;
 
@@ -590,7 +589,6 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
 
        for (page_addr = start; page_addr < end; page_addr += PAGE_SIZE) {
                int ret;
-               struct page **page_array_ptr;
 
                page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE];
 
@@ -601,11 +599,11 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
                                proc->pid, page_addr);
                        goto err_alloc_page_failed;
                }
-               tmp_area.addr = page_addr;
-               tmp_area.size = PAGE_SIZE + PAGE_SIZE /* guard page? */;
-               page_array_ptr = page;
-               ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr);
-               if (ret) {
+               ret = map_kernel_range_noflush((unsigned long)page_addr,
+                                       PAGE_SIZE, PAGE_KERNEL, page);
+               flush_cache_vmap((unsigned long)page_addr,
+                               (unsigned long)page_addr + PAGE_SIZE);
+               if (ret != 1) {
                        pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n",
                               proc->pid, page_addr);
                        goto err_map_kernel_failed;
@@ -1404,7 +1402,8 @@ static void binder_transaction(struct binder_proc *proc,
                        return_error = BR_DEAD_REPLY;
                        goto err_dead_binder;
                }
-               if (security_binder_transaction(proc->tsk, target_proc->tsk) < 0) {
+               if (security_binder_transaction(proc->tsk,
+                                               target_proc->tsk) < 0) {
                        return_error = BR_FAILED_REPLY;
                        goto err_invalid_target_handle;
                }
@@ -1565,7 +1564,8 @@ static void binder_transaction(struct binder_proc *proc,
                                return_error = BR_FAILED_REPLY;
                                goto err_binder_get_ref_for_node_failed;
                        }
-                       if (security_binder_transfer_binder(proc->tsk, target_proc->tsk)) {
+                       if (security_binder_transfer_binder(proc->tsk,
+                                                           target_proc->tsk)) {
                                return_error = BR_FAILED_REPLY;
                                goto err_binder_get_ref_for_node_failed;
                        }
@@ -1599,7 +1599,8 @@ static void binder_transaction(struct binder_proc *proc,
                                return_error = BR_FAILED_REPLY;
                                goto err_binder_get_ref_failed;
                        }
-                       if (security_binder_transfer_binder(proc->tsk, target_proc->tsk)) {
+                       if (security_binder_transfer_binder(proc->tsk,
+                                                           target_proc->tsk)) {
                                return_error = BR_FAILED_REPLY;
                                goto err_binder_get_ref_failed;
                        }
@@ -1660,7 +1661,9 @@ static void binder_transaction(struct binder_proc *proc,
                                return_error = BR_FAILED_REPLY;
                                goto err_fget_failed;
                        }
-                       if (security_binder_transfer_file(proc->tsk, target_proc->tsk, file) < 0) {
+                       if (security_binder_transfer_file(proc->tsk,
+                                                         target_proc->tsk,
+                                                         file) < 0) {
                                fput(file);
                                return_error = BR_FAILED_REPLY;
                                goto err_get_unused_fd_failed;
@@ -2078,7 +2081,7 @@ static int binder_thread_write(struct binder_proc *proc,
                        if (get_user(cookie, (binder_uintptr_t __user *)ptr))
                                return -EFAULT;
 
-                       ptr += sizeof(void *);
+                       ptr += sizeof(cookie);
                        list_for_each_entry(w, &proc->delivered_death, entry) {
                                struct binder_ref_death *tmp_death = container_of(w, struct binder_ref_death, work);
 
@@ -2838,7 +2841,7 @@ static int binder_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        return VM_FAULT_SIGBUS;
 }
 
-static struct vm_operations_struct binder_vm_ops = {
+static const struct vm_operations_struct binder_vm_ops = {
        .open = binder_vma_open,
        .close = binder_vma_close,
        .fault = binder_vm_fault,