Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging: android: binder: fix up some checkpatch warnings

This cleans up the majority of the checkpatch warnings in the android
binder driver. All that is left now is a bunch of too-long-line stuff.


Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+273 -161
+273 -161
drivers/staging/android/binder.c
··· 44 44 static HLIST_HEAD(binder_deferred_list); 45 45 static DEFINE_MUTEX(binder_deferred_lock); 46 46 47 - static int binder_read_proc_proc( 48 - char *page, char **start, off_t off, int count, int *eof, void *data); 47 + static int binder_read_proc_proc(char *page, char **start, off_t off, 48 + int count, int *eof, void *data); 49 49 50 50 /* This is only defined in include/asm-arm/sizes.h */ 51 51 #ifndef SZ_1K ··· 81 81 static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR | 82 82 BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION; 83 83 module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO); 84 + 84 85 static int binder_debug_no_lock; 85 86 module_param_named(proc_no_lock, binder_debug_no_lock, bool, S_IWUSR | S_IRUGO); 87 + 86 88 static DECLARE_WAIT_QUEUE_HEAD(binder_user_error_wait); 87 89 static int binder_stop_on_user_error; 88 - static int binder_set_stop_on_user_error( 89 - const char *val, struct kernel_param *kp) 90 + 91 + static int binder_set_stop_on_user_error(const char *val, 92 + struct kernel_param *kp) 90 93 { 91 94 int ret; 92 95 ret = param_set_int(val, kp); ··· 188 185 int local_strong_refs; 189 186 void __user *ptr; 190 187 void __user *cookie; 191 - unsigned has_strong_ref : 1; 192 - unsigned pending_strong_ref : 1; 193 - unsigned has_weak_ref : 1; 194 - unsigned pending_weak_ref : 1; 195 - unsigned has_async_transaction : 1; 196 - unsigned accept_fds : 1; 197 - int min_priority : 8; 188 + unsigned has_strong_ref:1; 189 + unsigned pending_strong_ref:1; 190 + unsigned has_weak_ref:1; 191 + unsigned pending_weak_ref:1; 192 + unsigned has_async_transaction:1; 193 + unsigned accept_fds:1; 194 + unsigned min_priority:8; 198 195 struct list_head async_todo; 199 196 }; 200 197 ··· 224 221 struct list_head entry; /* free and allocated entries by addesss */ 225 222 struct rb_node rb_node; /* free entry by size or allocated entry */ 226 223 /* by address */ 227 - unsigned free : 1; 228 - unsigned allow_user_free : 1; 229 - unsigned async_transaction : 1; 230 - unsigned debug_id : 29; 224 + unsigned free:1; 225 + unsigned allow_user_free:1; 226 + unsigned async_transaction:1; 227 + unsigned debug_id:29; 231 228 232 229 struct binder_transaction *transaction; 233 230 ··· 309 306 struct binder_proc *to_proc; 310 307 struct binder_thread *to_thread; 311 308 struct binder_transaction *to_parent; 312 - unsigned need_reply : 1; 313 - /*unsigned is_dead : 1;*/ /* not used at the moment */ 309 + unsigned need_reply:1; 310 + /* unsigned is_dead:1; */ /* not used at the moment */ 314 311 315 312 struct binder_buffer *buffer; 316 313 unsigned int code; ··· 477 474 binder_user_error("binder: %d RLIMIT_NICE not set\n", current->pid); 478 475 } 479 476 480 - static size_t binder_buffer_size( 481 - struct binder_proc *proc, struct binder_buffer *buffer) 477 + static size_t binder_buffer_size(struct binder_proc *proc, 478 + struct binder_buffer *buffer) 482 479 { 483 480 if (list_is_last(&buffer->entry, &proc->buffers)) 484 481 return proc->buffer + proc->buffer_size - (void *)buffer->data; ··· 487 484 struct binder_buffer, entry) - (size_t)buffer->data; 488 485 } 489 486 490 - static void binder_insert_free_buffer( 491 - struct binder_proc *proc, struct binder_buffer *new_buffer) 487 + static void binder_insert_free_buffer(struct binder_proc *proc, 488 + struct binder_buffer *new_buffer) 492 489 { 493 490 struct rb_node **p = &proc->free_buffers.rb_node; 494 491 struct rb_node *parent = NULL; ··· 520 517 rb_insert_color(&new_buffer->rb_node, &proc->free_buffers); 521 518 } 522 519 523 - static void binder_insert_allocated_buffer( 524 - struct binder_proc *proc, struct binder_buffer *new_buffer) 520 + static void binder_insert_allocated_buffer(struct binder_proc *proc, 521 + struct binder_buffer *new_buffer) 525 522 { 526 523 struct rb_node **p = &proc->allocated_buffers.rb_node; 527 524 struct rb_node *parent = NULL; ··· 545 542 rb_insert_color(&new_buffer->rb_node, &proc->allocated_buffers); 546 543 } 547 544 548 - static struct binder_buffer *binder_buffer_lookup( 549 - struct binder_proc *proc, void __user *user_ptr) 545 + static struct binder_buffer *binder_buffer_lookup(struct binder_proc *proc, 546 + void __user *user_ptr) 550 547 { 551 548 struct rb_node *n = proc->allocated_buffers.rb_node; 552 549 struct binder_buffer *buffer; ··· 570 567 } 571 568 572 569 static int binder_update_page_range(struct binder_proc *proc, int allocate, 573 - void *start, void *end, struct vm_area_struct *vma) 570 + void *start, void *end, 571 + struct vm_area_struct *vma) 574 572 { 575 573 void *page_addr; 576 574 unsigned long user_page_addr; ··· 668 664 } 669 665 670 666 static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, 671 - size_t data_size, size_t offsets_size, int is_async) 667 + size_t data_size, 668 + size_t offsets_size, int is_async) 672 669 { 673 670 struct rb_node *n = proc->free_buffers.rb_node; 674 671 struct binder_buffer *buffer; ··· 697 692 if (is_async && 698 693 proc->free_async_space < size + sizeof(struct binder_buffer)) { 699 694 if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC) 700 - printk(KERN_ERR "binder: %d: binder_alloc_buf size %zd f" 701 - "ailed, no async space left\n", proc->pid, size); 695 + printk(KERN_ERR 696 + "binder: %d: binder_alloc_buf size %zd failed, " 697 + "no async space left\n", proc->pid, size); 702 698 return NULL; 703 699 } 704 700 ··· 783 777 return (void *)(((uintptr_t)(buffer + 1) - 1) & PAGE_MASK); 784 778 } 785 779 786 - static void binder_delete_free_buffer( 787 - struct binder_proc *proc, struct binder_buffer *buffer) 780 + static void binder_delete_free_buffer(struct binder_proc *proc, 781 + struct binder_buffer *buffer) 788 782 { 789 783 struct binder_buffer *prev, *next = NULL; 790 784 int free_page_end = 1; ··· 830 824 } 831 825 } 832 826 833 - static void binder_free_buf( 834 - struct binder_proc *proc, struct binder_buffer *buffer) 827 + static void binder_free_buf(struct binder_proc *proc, 828 + struct binder_buffer *buffer) 835 829 { 836 830 size_t size, buffer_size; 837 831 ··· 883 877 binder_insert_free_buffer(proc, buffer); 884 878 } 885 879 886 - static struct binder_node * 887 - binder_get_node(struct binder_proc *proc, void __user *ptr) 880 + static struct binder_node *binder_get_node(struct binder_proc *proc, 881 + void __user *ptr) 888 882 { 889 883 struct rb_node *n = proc->nodes.rb_node; 890 884 struct binder_node *node; ··· 902 896 return NULL; 903 897 } 904 898 905 - static struct binder_node * 906 - binder_new_node(struct binder_proc *proc, void __user *ptr, void __user *cookie) 899 + static struct binder_node *binder_new_node(struct binder_proc *proc, 900 + void __user *ptr, 901 + void __user *cookie) 907 902 { 908 903 struct rb_node **p = &proc->nodes.rb_node; 909 904 struct rb_node *parent = NULL; ··· 942 935 return node; 943 936 } 944 937 945 - static int 946 - binder_inc_node(struct binder_node *node, int strong, int internal, 947 - struct list_head *target_list) 938 + static int binder_inc_node(struct binder_node *node, int strong, int internal, 939 + struct list_head *target_list) 948 940 { 949 941 if (strong) { 950 942 if (internal) { ··· 977 971 return 0; 978 972 } 979 973 980 - static int 981 - binder_dec_node(struct binder_node *node, int strong, int internal) 974 + static int binder_dec_node(struct binder_node *node, int strong, int internal) 982 975 { 983 976 if (strong) { 984 977 if (internal) ··· 1019 1014 } 1020 1015 1021 1016 1022 - static struct binder_ref * 1023 - binder_get_ref(struct binder_proc *proc, uint32_t desc) 1017 + static struct binder_ref *binder_get_ref(struct binder_proc *proc, 1018 + uint32_t desc) 1024 1019 { 1025 1020 struct rb_node *n = proc->refs_by_desc.rb_node; 1026 1021 struct binder_ref *ref; ··· 1038 1033 return NULL; 1039 1034 } 1040 1035 1041 - static struct binder_ref * 1042 - binder_get_ref_for_node(struct binder_proc *proc, struct binder_node *node) 1036 + static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc, 1037 + struct binder_node *node) 1043 1038 { 1044 1039 struct rb_node *n; 1045 1040 struct rb_node **p = &proc->refs_by_node.rb_node; ··· 1104 1099 return new_ref; 1105 1100 } 1106 1101 1107 - static void 1108 - binder_delete_ref(struct binder_ref *ref) 1102 + static void binder_delete_ref(struct binder_ref *ref) 1109 1103 { 1110 1104 if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS) 1111 1105 printk(KERN_INFO "binder: %d delete ref %d desc %d for " ··· 1129 1125 binder_stats.obj_deleted[BINDER_STAT_REF]++; 1130 1126 } 1131 1127 1132 - static int 1133 - binder_inc_ref( 1134 - struct binder_ref *ref, int strong, struct list_head *target_list) 1128 + static int binder_inc_ref(struct binder_ref *ref, int strong, 1129 + struct list_head *target_list) 1135 1130 { 1136 1131 int ret; 1137 1132 if (strong) { ··· 1152 1149 } 1153 1150 1154 1151 1155 - static int 1156 - binder_dec_ref(struct binder_ref *ref, int strong) 1152 + static int binder_dec_ref(struct binder_ref *ref, int strong) 1157 1153 { 1158 1154 if (strong) { 1159 1155 if (ref->strong == 0) { ··· 1184 1182 return 0; 1185 1183 } 1186 1184 1187 - static void 1188 - binder_pop_transaction( 1189 - struct binder_thread *target_thread, struct binder_transaction *t) 1185 + static void binder_pop_transaction(struct binder_thread *target_thread, 1186 + struct binder_transaction *t) 1190 1187 { 1191 1188 if (target_thread) { 1192 1189 BUG_ON(target_thread->transaction_stack != t); ··· 1201 1200 binder_stats.obj_deleted[BINDER_STAT_TRANSACTION]++; 1202 1201 } 1203 1202 1204 - static void 1205 - binder_send_failed_reply(struct binder_transaction *t, uint32_t error_code) 1203 + static void binder_send_failed_reply(struct binder_transaction *t, 1204 + uint32_t error_code) 1206 1205 { 1207 1206 struct binder_thread *target_thread; 1208 1207 BUG_ON(t->flags & TF_ONE_WAY); ··· 1254 1253 } 1255 1254 } 1256 1255 1257 - static void 1258 - binder_transaction_buffer_release(struct binder_proc *proc, 1259 - struct binder_buffer *buffer, size_t *failed_at); 1256 + static void binder_transaction_buffer_release(struct binder_proc *proc, 1257 + struct binder_buffer *buffer, 1258 + size_t *failed_at); 1260 1259 1261 - static void 1262 - binder_transaction(struct binder_proc *proc, struct binder_thread *thread, 1263 - struct binder_transaction_data *tr, int reply) 1260 + static void binder_transaction(struct binder_proc *proc, 1261 + struct binder_thread *thread, 1262 + struct binder_transaction_data *tr, int reply) 1264 1263 { 1265 1264 struct binder_transaction *t; 1266 1265 struct binder_work *tcomplete; ··· 1662 1661 thread->return_error = return_error; 1663 1662 } 1664 1663 1665 - static void 1666 - binder_transaction_buffer_release(struct binder_proc *proc, struct binder_buffer *buffer, size_t *failed_at) 1664 + static void binder_transaction_buffer_release(struct binder_proc *proc, 1665 + struct binder_buffer *buffer, 1666 + size_t *failed_at) 1667 1667 { 1668 1668 size_t *offp, *off_end; 1669 1669 int debug_id = buffer->debug_id; ··· 1732 1730 } 1733 1731 } 1734 1732 1735 - int 1736 - binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, 1737 - void __user *buffer, int size, signed long *consumed) 1733 + int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, 1734 + void __user *buffer, int size, signed long *consumed) 1738 1735 { 1739 1736 uint32_t cmd; 1740 1737 void __user *ptr = buffer + *consumed; ··· 2105 2104 } break; 2106 2105 2107 2106 default: 2108 - printk(KERN_ERR "binder: %d:%d unknown command %d\n", proc->pid, thread->pid, cmd); 2107 + printk(KERN_ERR "binder: %d:%d unknown command %d\n", 2108 + proc->pid, thread->pid, cmd); 2109 2109 return -EINVAL; 2110 2110 } 2111 2111 *consumed = ptr - buffer; ··· 2114 2112 return 0; 2115 2113 } 2116 2114 2117 - void 2118 - binder_stat_br(struct binder_proc *proc, struct binder_thread *thread, uint32_t cmd) 2115 + void binder_stat_br(struct binder_proc *proc, struct binder_thread *thread, 2116 + uint32_t cmd) 2119 2117 { 2120 2118 if (_IOC_NR(cmd) < ARRAY_SIZE(binder_stats.br)) { 2121 2119 binder_stats.br[_IOC_NR(cmd)]++; ··· 2124 2122 } 2125 2123 } 2126 2124 2127 - static int 2128 - binder_has_proc_work(struct binder_proc *proc, struct binder_thread *thread) 2125 + static int binder_has_proc_work(struct binder_proc *proc, 2126 + struct binder_thread *thread) 2129 2127 { 2130 - return !list_empty(&proc->todo) || (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); 2128 + return !list_empty(&proc->todo) || 2129 + (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); 2131 2130 } 2132 2131 2133 - static int 2134 - binder_has_thread_work(struct binder_thread *thread) 2132 + static int binder_has_thread_work(struct binder_thread *thread) 2135 2133 { 2136 2134 return !list_empty(&thread->todo) || thread->return_error != BR_OK || 2137 2135 (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); 2138 2136 } 2139 2137 2140 - static int 2141 - binder_thread_read(struct binder_proc *proc, struct binder_thread *thread, 2142 - void __user *buffer, int size, signed long *consumed, int non_block) 2138 + static int binder_thread_read(struct binder_proc *proc, 2139 + struct binder_thread *thread, 2140 + void __user *buffer, int size, 2141 + signed long *consumed, int non_block) 2143 2142 { 2144 2143 void __user *ptr = buffer + *consumed; 2145 2144 void __user *end = buffer + size; ··· 2155 2152 } 2156 2153 2157 2154 retry: 2158 - wait_for_proc_work = thread->transaction_stack == NULL && list_empty(&thread->todo); 2155 + wait_for_proc_work = thread->transaction_stack == NULL && 2156 + list_empty(&thread->todo); 2159 2157 2160 2158 if (thread->return_error != BR_OK && ptr < end) { 2161 2159 if (thread->return_error2 != BR_OK) { ··· 2186 2182 "for process work before calling BC_REGISTER_" 2187 2183 "LOOPER or BC_ENTER_LOOPER (state %x)\n", 2188 2184 proc->pid, thread->pid, thread->looper); 2189 - wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); 2185 + wait_event_interruptible(binder_user_error_wait, 2186 + binder_stop_on_user_error < 2); 2190 2187 } 2191 2188 binder_set_nice(proc->default_priority); 2192 2189 if (non_block) { ··· 2309 2304 case BINDER_WORK_DEAD_BINDER: 2310 2305 case BINDER_WORK_DEAD_BINDER_AND_CLEAR: 2311 2306 case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: { 2312 - struct binder_ref_death *death = container_of(w, struct binder_ref_death, work); 2307 + struct binder_ref_death *death; 2313 2308 uint32_t cmd; 2309 + 2310 + death = container_of(w, struct binder_ref_death, work); 2314 2311 if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION) 2315 2312 cmd = BR_CLEAR_DEATH_NOTIFICATION_DONE; 2316 2313 else ··· 2369 2362 2370 2363 if (t->from) { 2371 2364 struct task_struct *sender = t->from->proc->tsk; 2372 - tr.sender_pid = task_tgid_nr_ns(sender, current->nsproxy->pid_ns); 2365 + tr.sender_pid = task_tgid_nr_ns(sender, 2366 + current->nsproxy->pid_ns); 2373 2367 } else { 2374 2368 tr.sender_pid = 0; 2375 2369 } 2376 2370 2377 2371 tr.data_size = t->buffer->data_size; 2378 2372 tr.offsets_size = t->buffer->offsets_size; 2379 - tr.data.ptr.buffer = (void *)t->buffer->data + proc->user_buffer_offset; 2380 - tr.data.ptr.offsets = tr.data.ptr.buffer + ALIGN(t->buffer->data_size, sizeof(void *)); 2373 + tr.data.ptr.buffer = (void *)t->buffer->data + 2374 + proc->user_buffer_offset; 2375 + tr.data.ptr.offsets = tr.data.ptr.buffer + 2376 + ALIGN(t->buffer->data_size, 2377 + sizeof(void *)); 2381 2378 2382 2379 if (put_user(cmd, (uint32_t __user *)ptr)) 2383 2380 return -EFAULT; ··· 2395 2384 printk(KERN_INFO "binder: %d:%d %s %d %d:%d, cmd %d" 2396 2385 "size %zd-%zd ptr %p-%p\n", 2397 2386 proc->pid, thread->pid, 2398 - (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : "BR_REPLY", 2387 + (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : 2388 + "BR_REPLY", 2399 2389 t->debug_id, t->from ? t->from->proc->pid : 0, 2400 2390 t->from ? t->from->pid : 0, cmd, 2401 2391 t->buffer->data_size, t->buffer->offsets_size, ··· 2442 2430 list_del_init(&w->entry); 2443 2431 switch (w->type) { 2444 2432 case BINDER_WORK_TRANSACTION: { 2445 - struct binder_transaction *t = container_of(w, struct binder_transaction, work); 2433 + struct binder_transaction *t; 2434 + 2435 + t = container_of(w, struct binder_transaction, work); 2446 2436 if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) 2447 2437 binder_send_failed_reply(t, BR_DEAD_REPLY); 2448 2438 } break; ··· 2494 2480 return thread; 2495 2481 } 2496 2482 2497 - static int binder_free_thread(struct binder_proc *proc, struct binder_thread *thread) 2483 + static int binder_free_thread(struct binder_proc *proc, 2484 + struct binder_thread *thread) 2498 2485 { 2499 2486 struct binder_transaction *t; 2500 2487 struct binder_transaction *send_reply = NULL; ··· 2508 2493 while (t) { 2509 2494 active_transactions++; 2510 2495 if (binder_debug_mask & BINDER_DEBUG_DEAD_TRANSACTION) 2511 - printk(KERN_INFO "binder: release %d:%d transaction %d %s, still active\n", 2512 - proc->pid, thread->pid, t->debug_id, (t->to_thread == thread) ? "in" : "out"); 2496 + printk(KERN_INFO "binder: release %d:%d transaction %d " 2497 + "%s, still active\n", proc->pid, thread->pid, 2498 + t->debug_id, 2499 + (t->to_thread == thread) ? "in" : "out"); 2513 2500 if (t->to_thread == thread) { 2514 2501 t->to_proc = NULL; 2515 2502 t->to_thread = NULL; ··· 2534 2517 return active_transactions; 2535 2518 } 2536 2519 2537 - static unsigned int binder_poll(struct file *filp, struct poll_table_struct *wait) 2520 + static unsigned int binder_poll(struct file *filp, 2521 + struct poll_table_struct *wait) 2538 2522 { 2539 2523 struct binder_proc *proc = filp->private_data; 2540 2524 struct binder_thread *thread = NULL; ··· 2796 2778 proc->files = get_files_struct(current); 2797 2779 proc->vma = vma; 2798 2780 2799 - /*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/ 2781 + /*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n", 2782 + proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/ 2800 2783 return 0; 2801 2784 2802 2785 err_alloc_small_buf_failed: ··· 2809 2790 err_get_vm_area_failed: 2810 2791 err_already_mapped: 2811 2792 err_bad_arg: 2812 - printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n", proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); 2793 + printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n", 2794 + proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); 2813 2795 return ret; 2814 2796 } 2815 2797 ··· 2819 2799 struct binder_proc *proc; 2820 2800 2821 2801 if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE) 2822 - printk(KERN_INFO "binder_open: %d:%d\n", current->group_leader->pid, current->pid); 2802 + printk(KERN_INFO "binder_open: %d:%d\n", 2803 + current->group_leader->pid, current->pid); 2823 2804 2824 2805 proc = kzalloc(sizeof(*proc), GFP_KERNEL); 2825 2806 if (proc == NULL) ··· 2842 2821 char strbuf[11]; 2843 2822 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); 2844 2823 remove_proc_entry(strbuf, binder_proc_dir_entry_proc); 2845 - create_proc_read_entry(strbuf, S_IRUGO, binder_proc_dir_entry_proc, binder_read_proc_proc, proc); 2824 + create_proc_read_entry(strbuf, S_IRUGO, 2825 + binder_proc_dir_entry_proc, 2826 + binder_read_proc_proc, proc); 2846 2827 } 2847 2828 2848 2829 return 0; ··· 2948 2925 } 2949 2926 } 2950 2927 if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER) 2951 - printk(KERN_INFO "binder: node %d now dead, refs %d, death %d\n", node->debug_id, incoming_refs, death); 2928 + printk(KERN_INFO "binder: node %d now dead, " 2929 + "refs %d, death %d\n", node->debug_id, 2930 + incoming_refs, death); 2952 2931 } 2953 2932 } 2954 2933 outgoing_refs = 0; 2955 2934 while ((n = rb_first(&proc->refs_by_desc))) { 2956 - struct binder_ref *ref = rb_entry(n, struct binder_ref, rb_node_desc); 2935 + struct binder_ref *ref = rb_entry(n, struct binder_ref, 2936 + rb_node_desc); 2957 2937 outgoing_refs++; 2958 2938 binder_delete_ref(ref); 2959 2939 } ··· 2964 2938 buffers = 0; 2965 2939 2966 2940 while ((n = rb_first(&proc->allocated_buffers))) { 2967 - struct binder_buffer *buffer = rb_entry(n, struct binder_buffer, rb_node); 2941 + struct binder_buffer *buffer = rb_entry(n, struct binder_buffer, 2942 + rb_node); 2968 2943 t = buffer->transaction; 2969 2944 if (t) { 2970 2945 t->buffer = NULL; 2971 2946 buffer->transaction = NULL; 2972 - printk(KERN_ERR "binder: release proc %d, transaction %d, not freed\n", proc->pid, t->debug_id); 2947 + printk(KERN_ERR "binder: release proc %d, " 2948 + "transaction %d, not freed\n", 2949 + proc->pid, t->debug_id); 2973 2950 /*BUG();*/ 2974 2951 } 2975 2952 binder_free_buf(proc, buffer); ··· 2986 2957 int i; 2987 2958 for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) { 2988 2959 if (proc->pages[i]) { 2989 - if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC) 2990 - printk(KERN_INFO "binder_release: %d: page %d at %p not freed\n", proc->pid, i, proc->buffer + i * PAGE_SIZE); 2960 + if (binder_debug_mask & 2961 + BINDER_DEBUG_BUFFER_ALLOC) 2962 + printk(KERN_INFO 2963 + "binder_release: %d: " 2964 + "page %d at %p not freed\n", 2965 + proc->pid, i, 2966 + proc->buffer + i * PAGE_SIZE); 2991 2967 __free_page(proc->pages[i]); 2992 2968 page_count++; 2993 2969 } ··· 3004 2970 put_task_struct(proc->tsk); 3005 2971 3006 2972 if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE) 3007 - printk(KERN_INFO "binder_release: %d threads %d, nodes %d (ref %d), refs %d, active transactions %d, buffers %d, pages %d\n", 3008 - proc->pid, threads, nodes, incoming_refs, outgoing_refs, active_transactions, buffers, page_count); 2973 + printk(KERN_INFO 2974 + "binder_release: %d threads %d, nodes %d (ref %d), " 2975 + "refs %d, active transactions %d, buffers %d, " 2976 + "pages %d\n", 2977 + proc->pid, threads, nodes, incoming_refs, outgoing_refs, 2978 + active_transactions, buffers, page_count); 3009 2979 3010 2980 kfree(proc); 3011 2981 } ··· 3036 2998 mutex_unlock(&binder_deferred_lock); 3037 2999 3038 3000 files = NULL; 3039 - if (defer & BINDER_DEFERRED_PUT_FILES) 3040 - if ((files = proc->files)) 3001 + if (defer & BINDER_DEFERRED_PUT_FILES) { 3002 + files = proc->files; 3003 + if (files) 3041 3004 proc->files = NULL; 3005 + } 3042 3006 3043 3007 if (defer & BINDER_DEFERRED_FLUSH) 3044 3008 binder_deferred_flush(proc); ··· 3067 3027 mutex_unlock(&binder_deferred_lock); 3068 3028 } 3069 3029 3070 - static char *print_binder_transaction(char *buf, char *end, const char *prefix, struct binder_transaction *t) 3030 + static char *print_binder_transaction(char *buf, char *end, const char *prefix, 3031 + struct binder_transaction *t) 3071 3032 { 3072 - buf += snprintf(buf, end - buf, "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d", 3073 - prefix, t->debug_id, t, t->from ? t->from->proc->pid : 0, 3033 + buf += snprintf(buf, end - buf, 3034 + "%s %d: %p from %d:%d to %d:%d code %x " 3035 + "flags %x pri %ld r%d", 3036 + prefix, t->debug_id, t, 3037 + t->from ? t->from->proc->pid : 0, 3074 3038 t->from ? t->from->pid : 0, 3075 3039 t->to_proc ? t->to_proc->pid : 0, 3076 3040 t->to_thread ? t->to_thread->pid : 0, ··· 3097 3053 return buf; 3098 3054 } 3099 3055 3100 - static char *print_binder_buffer(char *buf, char *end, const char *prefix, struct binder_buffer *buffer) 3056 + static char *print_binder_buffer(char *buf, char *end, const char *prefix, 3057 + struct binder_buffer *buffer) 3101 3058 { 3102 3059 buf += snprintf(buf, end - buf, "%s %d: %p size %zd:%zd %s\n", 3103 3060 prefix, buffer->debug_id, buffer->data, ··· 3108 3063 } 3109 3064 3110 3065 static char *print_binder_work(char *buf, char *end, const char *prefix, 3111 - const char *transaction_prefix, struct binder_work *w) 3066 + const char *transaction_prefix, 3067 + struct binder_work *w) 3112 3068 { 3113 3069 struct binder_node *node; 3114 3070 struct binder_transaction *t; ··· 3126 3080 case BINDER_WORK_NODE: 3127 3081 node = container_of(w, struct binder_node, work); 3128 3082 buf += snprintf(buf, end - buf, "%snode work %d: u%p c%p\n", 3129 - prefix, node->debug_id, node->ptr, node->cookie); 3083 + prefix, node->debug_id, node->ptr, 3084 + node->cookie); 3130 3085 break; 3131 3086 case BINDER_WORK_DEAD_BINDER: 3132 3087 buf += snprintf(buf, end - buf, "%shas dead binder\n", prefix); ··· 3148 3101 return buf; 3149 3102 } 3150 3103 3151 - static char *print_binder_thread(char *buf, char *end, struct binder_thread *thread, int print_always) 3104 + static char *print_binder_thread(char *buf, char *end, 3105 + struct binder_thread *thread, 3106 + int print_always) 3152 3107 { 3153 3108 struct binder_transaction *t; 3154 3109 struct binder_work *w; 3155 3110 char *start_buf = buf; 3156 3111 char *header_buf; 3157 3112 3158 - buf += snprintf(buf, end - buf, " thread %d: l %02x\n", thread->pid, thread->looper); 3113 + buf += snprintf(buf, end - buf, " thread %d: l %02x\n", 3114 + thread->pid, thread->looper); 3159 3115 header_buf = buf; 3160 3116 t = thread->transaction_stack; 3161 3117 while (t) { 3162 3118 if (buf >= end) 3163 3119 break; 3164 3120 if (t->from == thread) { 3165 - buf = print_binder_transaction(buf, end, " outgoing transaction", t); 3121 + buf = print_binder_transaction(buf, end, 3122 + " outgoing transaction", t); 3166 3123 t = t->from_parent; 3167 3124 } else if (t->to_thread == thread) { 3168 - buf = print_binder_transaction(buf, end, " incoming transaction", t); 3125 + buf = print_binder_transaction(buf, end, 3126 + " incoming transaction", t); 3169 3127 t = t->to_parent; 3170 3128 } else { 3171 - buf = print_binder_transaction(buf, end, " bad transaction", t); 3129 + buf = print_binder_transaction(buf, end, 3130 + " bad transaction", t); 3172 3131 t = NULL; 3173 3132 } 3174 3133 } ··· 3195 3142 struct hlist_node *pos; 3196 3143 struct binder_work *w; 3197 3144 int count; 3145 + 3198 3146 count = 0; 3199 3147 hlist_for_each_entry(ref, pos, &node->refs, node_entry) 3200 3148 count++; 3201 3149 3202 - buf += snprintf(buf, end - buf, " node %d: u%p c%p hs %d hw %d ls %d lw %d is %d iw %d", 3150 + buf += snprintf(buf, end - buf, 3151 + " node %d: u%p c%p hs %d hw %d ls %d lw %d " 3152 + "is %d iw %d", 3203 3153 node->debug_id, node->ptr, node->cookie, 3204 3154 node->has_strong_ref, node->has_weak_ref, 3205 3155 node->local_strong_refs, node->local_weak_refs, ··· 3231 3175 3232 3176 static char *print_binder_ref(char *buf, char *end, struct binder_ref *ref) 3233 3177 { 3234 - buf += snprintf(buf, end - buf, " ref %d: desc %d %snode %d s %d w %d d %p\n", 3235 - ref->debug_id, ref->desc, ref->node->proc ? "" : "dead ", 3236 - ref->node->debug_id, ref->strong, ref->weak, ref->death); 3178 + buf += snprintf(buf, end - buf, 3179 + " ref %d: desc %d %snode %d s %d w %d d %p\n", 3180 + ref->debug_id, ref->desc, 3181 + ref->node->proc ? "" : "dead ", ref->node->debug_id, 3182 + ref->strong, ref->weak, ref->death); 3237 3183 return buf; 3238 3184 } 3239 3185 3240 - static char *print_binder_proc(char *buf, char *end, struct binder_proc *proc, int print_all) 3186 + static char *print_binder_proc(char *buf, char *end, 3187 + struct binder_proc *proc, int print_all) 3241 3188 { 3242 3189 struct binder_work *w; 3243 3190 struct rb_node *n; ··· 3250 3191 buf += snprintf(buf, end - buf, "proc %d\n", proc->pid); 3251 3192 header_buf = buf; 3252 3193 3253 - for (n = rb_first(&proc->threads); n != NULL && buf < end; n = rb_next(n)) 3254 - buf = print_binder_thread(buf, end, rb_entry(n, struct binder_thread, rb_node), print_all); 3255 - for (n = rb_first(&proc->nodes); n != NULL && buf < end; n = rb_next(n)) { 3256 - struct binder_node *node = rb_entry(n, struct binder_node, rb_node); 3194 + for (n = rb_first(&proc->threads); 3195 + n != NULL && buf < end; 3196 + n = rb_next(n)) 3197 + buf = print_binder_thread(buf, end, 3198 + rb_entry(n, struct binder_thread, 3199 + rb_node), print_all); 3200 + for (n = rb_first(&proc->nodes); 3201 + n != NULL && buf < end; 3202 + n = rb_next(n)) { 3203 + struct binder_node *node = rb_entry(n, struct binder_node, 3204 + rb_node); 3257 3205 if (print_all || node->has_async_transaction) 3258 3206 buf = print_binder_node(buf, end, node); 3259 3207 } 3260 3208 if (print_all) { 3261 - for (n = rb_first(&proc->refs_by_desc); n != NULL && buf < end; n = rb_next(n)) 3262 - buf = print_binder_ref(buf, end, rb_entry(n, struct binder_ref, rb_node_desc)); 3209 + for (n = rb_first(&proc->refs_by_desc); 3210 + n != NULL && buf < end; 3211 + n = rb_next(n)) 3212 + buf = print_binder_ref(buf, end, 3213 + rb_entry(n, struct binder_ref, 3214 + rb_node_desc)); 3263 3215 } 3264 - for (n = rb_first(&proc->allocated_buffers); n != NULL && buf < end; n = rb_next(n)) 3265 - buf = print_binder_buffer(buf, end, " buffer", rb_entry(n, struct binder_buffer, rb_node)); 3216 + for (n = rb_first(&proc->allocated_buffers); 3217 + n != NULL && buf < end; 3218 + n = rb_next(n)) 3219 + buf = print_binder_buffer(buf, end, " buffer", 3220 + rb_entry(n, struct binder_buffer, 3221 + rb_node)); 3266 3222 list_for_each_entry(w, &proc->todo, entry) { 3267 3223 if (buf >= end) 3268 3224 break; ··· 3287 3213 list_for_each_entry(w, &proc->delivered_death, entry) { 3288 3214 if (buf >= end) 3289 3215 break; 3290 - buf += snprintf(buf, end - buf, " has delivered dead binder\n"); 3216 + buf += snprintf(buf, end - buf, 3217 + " has delivered dead binder\n"); 3291 3218 break; 3292 3219 } 3293 3220 if (!print_all && buf == header_buf) ··· 3347 3272 "transaction_complete" 3348 3273 }; 3349 3274 3350 - static char *print_binder_stats(char *buf, char *end, const char *prefix, struct binder_stats *stats) 3275 + static char *print_binder_stats(char *buf, char *end, const char *prefix, 3276 + struct binder_stats *stats) 3351 3277 { 3352 3278 int i; 3353 3279 3354 - BUILD_BUG_ON(ARRAY_SIZE(stats->bc) != ARRAY_SIZE(binder_command_strings)); 3280 + BUILD_BUG_ON(ARRAY_SIZE(stats->bc) != 3281 + ARRAY_SIZE(binder_command_strings)); 3355 3282 for (i = 0; i < ARRAY_SIZE(stats->bc); i++) { 3356 3283 if (stats->bc[i]) 3357 3284 buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix, 3358 - binder_command_strings[i], stats->bc[i]); 3285 + binder_command_strings[i], 3286 + stats->bc[i]); 3359 3287 if (buf >= end) 3360 3288 return buf; 3361 3289 } 3362 3290 3363 - BUILD_BUG_ON(ARRAY_SIZE(stats->br) != ARRAY_SIZE(binder_return_strings)); 3291 + BUILD_BUG_ON(ARRAY_SIZE(stats->br) != 3292 + ARRAY_SIZE(binder_return_strings)); 3364 3293 for (i = 0; i < ARRAY_SIZE(stats->br); i++) { 3365 3294 if (stats->br[i]) 3366 3295 buf += snprintf(buf, end - buf, "%s%s: %d\n", prefix, ··· 3373 3294 return buf; 3374 3295 } 3375 3296 3376 - BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != ARRAY_SIZE(binder_objstat_strings)); 3377 - BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != ARRAY_SIZE(stats->obj_deleted)); 3297 + BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != 3298 + ARRAY_SIZE(binder_objstat_strings)); 3299 + BUILD_BUG_ON(ARRAY_SIZE(stats->obj_created) != 3300 + ARRAY_SIZE(stats->obj_deleted)); 3378 3301 for (i = 0; i < ARRAY_SIZE(stats->obj_created); i++) { 3379 3302 if (stats->obj_created[i] || stats->obj_deleted[i]) 3380 - buf += snprintf(buf, end - buf, "%s%s: active %d total %d\n", prefix, 3303 + buf += snprintf(buf, end - buf, 3304 + "%s%s: active %d total %d\n", prefix, 3381 3305 binder_objstat_strings[i], 3382 - stats->obj_created[i] - stats->obj_deleted[i], 3306 + stats->obj_created[i] - 3307 + stats->obj_deleted[i], 3383 3308 stats->obj_created[i]); 3384 3309 if (buf >= end) 3385 3310 return buf; ··· 3391 3308 return buf; 3392 3309 } 3393 3310 3394 - static char *print_binder_proc_stats(char *buf, char *end, struct binder_proc *proc) 3311 + static char *print_binder_proc_stats(char *buf, char *end, 3312 + struct binder_proc *proc) 3395 3313 { 3396 3314 struct binder_work *w; 3397 3315 struct rb_node *n; ··· 3424 3340 strong = 0; 3425 3341 weak = 0; 3426 3342 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { 3427 - struct binder_ref *ref = rb_entry(n, struct binder_ref, rb_node_desc); 3343 + struct binder_ref *ref = rb_entry(n, struct binder_ref, 3344 + rb_node_desc); 3428 3345 count++; 3429 3346 strong += ref->strong; 3430 3347 weak += ref->weak; 3431 3348 } 3432 - buf += snprintf(buf, end - buf, " refs: %d s %d w %d\n", count, strong, weak); 3349 + buf += snprintf(buf, end - buf, " refs: %d s %d w %d\n", 3350 + count, strong, weak); 3433 3351 if (buf >= end) 3434 3352 return buf; 3435 3353 ··· 3462 3376 } 3463 3377 3464 3378 3465 - static int binder_read_proc_state( 3466 - char *page, char **start, off_t off, int count, int *eof, void *data) 3379 + static int binder_read_proc_state(char *page, char **start, off_t off, 3380 + int count, int *eof, void *data) 3467 3381 { 3468 3382 struct binder_proc *proc; 3469 3383 struct hlist_node *pos; ··· 3510 3424 return len < count ? len : count; 3511 3425 } 3512 3426 3513 - static int binder_read_proc_stats( 3514 - char *page, char **start, off_t off, int count, int *eof, void *data) 3427 + static int binder_read_proc_stats(char *page, char **start, off_t off, 3428 + int count, int *eof, void *data) 3515 3429 { 3516 3430 struct binder_proc *proc; 3517 3431 struct hlist_node *pos; ··· 3550 3464 return len < count ? len : count; 3551 3465 } 3552 3466 3553 - static int binder_read_proc_transactions( 3554 - char *page, char **start, off_t off, int count, int *eof, void *data) 3467 + static int binder_read_proc_transactions(char *page, char **start, off_t off, 3468 + int count, int *eof, void *data) 3555 3469 { 3556 3470 struct binder_proc *proc; 3557 3471 struct hlist_node *pos; ··· 3588 3502 return len < count ? len : count; 3589 3503 } 3590 3504 3591 - static int binder_read_proc_proc( 3592 - char *page, char **start, off_t off, int count, int *eof, void *data) 3505 + static int binder_read_proc_proc(char *page, char **start, off_t off, 3506 + int count, int *eof, void *data) 3593 3507 { 3594 3508 struct binder_proc *proc = data; 3595 3509 int len = 0; ··· 3619 3533 return len < count ? len : count; 3620 3534 } 3621 3535 3622 - static char *print_binder_transaction_log_entry(char *buf, char *end, struct binder_transaction_log_entry *e) 3536 + static char *print_binder_transaction_log_entry(char *buf, char *end, 3537 + struct binder_transaction_log_entry *e) 3623 3538 { 3624 - buf += snprintf(buf, end - buf, "%d: %s from %d:%d to %d:%d node %d handle %d size %d:%d\n", 3539 + buf += snprintf(buf, end - buf, 3540 + "%d: %s from %d:%d to %d:%d node %d handle %d " 3541 + "size %d:%d\n", 3625 3542 e->debug_id, (e->call_type == 2) ? "reply" : 3626 3543 ((e->call_type == 1) ? "async" : "call "), e->from_proc, 3627 3544 e->from_thread, e->to_proc, e->to_thread, e->to_node, ··· 3648 3559 for (i = log->next; i < ARRAY_SIZE(log->entry); i++) { 3649 3560 if (buf >= end) 3650 3561 break; 3651 - buf = print_binder_transaction_log_entry(buf, end, &log->entry[i]); 3562 + buf = print_binder_transaction_log_entry(buf, end, 3563 + &log->entry[i]); 3652 3564 } 3653 3565 } 3654 3566 for (i = 0; i < log->next; i++) { 3655 3567 if (buf >= end) 3656 3568 break; 3657 - buf = print_binder_transaction_log_entry(buf, end, &log->entry[i]); 3569 + buf = print_binder_transaction_log_entry(buf, end, 3570 + &log->entry[i]); 3658 3571 } 3659 3572 3660 3573 *start = page + off; ··· 3670 3579 return len < count ? len : count; 3671 3580 } 3672 3581 3673 - static struct file_operations binder_fops = { 3582 + static const struct file_operations binder_fops = { 3674 3583 .owner = THIS_MODULE, 3675 3584 .poll = binder_poll, 3676 3585 .unlocked_ioctl = binder_ioctl, ··· 3692 3601 3693 3602 binder_proc_dir_entry_root = proc_mkdir("binder", NULL); 3694 3603 if (binder_proc_dir_entry_root) 3695 - binder_proc_dir_entry_proc = proc_mkdir("proc", binder_proc_dir_entry_root); 3604 + binder_proc_dir_entry_proc = proc_mkdir("proc", 3605 + binder_proc_dir_entry_root); 3696 3606 ret = misc_register(&binder_miscdev); 3697 3607 if (binder_proc_dir_entry_root) { 3698 - create_proc_read_entry("state", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_state, NULL); 3699 - create_proc_read_entry("stats", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_stats, NULL); 3700 - create_proc_read_entry("transactions", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_transactions, NULL); 3701 - create_proc_read_entry("transaction_log", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_transaction_log, &binder_transaction_log); 3702 - create_proc_read_entry("failed_transaction_log", S_IRUGO, binder_proc_dir_entry_root, binder_read_proc_transaction_log, &binder_transaction_log_failed); 3608 + create_proc_read_entry("state", 3609 + S_IRUGO, 3610 + binder_proc_dir_entry_root, 3611 + binder_read_proc_state, 3612 + NULL); 3613 + create_proc_read_entry("stats", 3614 + S_IRUGO, 3615 + binder_proc_dir_entry_root, 3616 + binder_read_proc_stats, 3617 + NULL); 3618 + create_proc_read_entry("transactions", 3619 + S_IRUGO, 3620 + binder_proc_dir_entry_root, 3621 + binder_read_proc_transactions, 3622 + NULL); 3623 + create_proc_read_entry("transaction_log", 3624 + S_IRUGO, 3625 + binder_proc_dir_entry_root, 3626 + binder_read_proc_transaction_log, 3627 + &binder_transaction_log); 3628 + create_proc_read_entry("failed_transaction_log", 3629 + S_IRUGO, 3630 + binder_proc_dir_entry_root, 3631 + binder_read_proc_transaction_log, 3632 + &binder_transaction_log_failed); 3703 3633 } 3704 3634 return ret; 3705 3635 }