Lines Matching refs:ref

1009 	struct binder_ref *ref;  in binder_get_ref()  local
1012 ref = rb_entry(n, struct binder_ref, rb_node_desc); in binder_get_ref()
1014 if (desc < ref->desc) in binder_get_ref()
1016 else if (desc > ref->desc) in binder_get_ref()
1019 return ref; in binder_get_ref()
1030 struct binder_ref *ref, *new_ref; in binder_get_ref_for_node() local
1034 ref = rb_entry(parent, struct binder_ref, rb_node_node); in binder_get_ref_for_node()
1036 if (node < ref->node) in binder_get_ref_for_node()
1038 else if (node > ref->node) in binder_get_ref_for_node()
1041 return ref; in binder_get_ref_for_node()
1043 new_ref = kzalloc(sizeof(*ref), GFP_KERNEL); in binder_get_ref_for_node()
1055 ref = rb_entry(n, struct binder_ref, rb_node_desc); in binder_get_ref_for_node()
1056 if (ref->desc > new_ref->desc) in binder_get_ref_for_node()
1058 new_ref->desc = ref->desc + 1; in binder_get_ref_for_node()
1064 ref = rb_entry(parent, struct binder_ref, rb_node_desc); in binder_get_ref_for_node()
1066 if (new_ref->desc < ref->desc) in binder_get_ref_for_node()
1068 else if (new_ref->desc > ref->desc) in binder_get_ref_for_node()
1090 static void binder_delete_ref(struct binder_ref *ref) in binder_delete_ref() argument
1094 ref->proc->pid, ref->debug_id, ref->desc, in binder_delete_ref()
1095 ref->node->debug_id); in binder_delete_ref()
1097 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_delete_ref()
1098 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_delete_ref()
1099 if (ref->strong) in binder_delete_ref()
1100 binder_dec_node(ref->node, 1, 1); in binder_delete_ref()
1101 hlist_del(&ref->node_entry); in binder_delete_ref()
1102 binder_dec_node(ref->node, 0, 1); in binder_delete_ref()
1103 if (ref->death) { in binder_delete_ref()
1106 ref->proc->pid, ref->debug_id, ref->desc); in binder_delete_ref()
1107 list_del(&ref->death->work.entry); in binder_delete_ref()
1108 kfree(ref->death); in binder_delete_ref()
1111 kfree(ref); in binder_delete_ref()
1115 static int binder_inc_ref(struct binder_ref *ref, int strong, in binder_inc_ref() argument
1121 if (ref->strong == 0) { in binder_inc_ref()
1122 ret = binder_inc_node(ref->node, 1, 1, target_list); in binder_inc_ref()
1126 ref->strong++; in binder_inc_ref()
1128 if (ref->weak == 0) { in binder_inc_ref()
1129 ret = binder_inc_node(ref->node, 0, 1, target_list); in binder_inc_ref()
1133 ref->weak++; in binder_inc_ref()
1139 static int binder_dec_ref(struct binder_ref *ref, int strong) in binder_dec_ref() argument
1142 if (ref->strong == 0) { in binder_dec_ref()
1144 ref->proc->pid, ref->debug_id, in binder_dec_ref()
1145 ref->desc, ref->strong, ref->weak); in binder_dec_ref()
1148 ref->strong--; in binder_dec_ref()
1149 if (ref->strong == 0) { in binder_dec_ref()
1152 ret = binder_dec_node(ref->node, strong, 1); in binder_dec_ref()
1157 if (ref->weak == 0) { in binder_dec_ref()
1159 ref->proc->pid, ref->debug_id, in binder_dec_ref()
1160 ref->desc, ref->strong, ref->weak); in binder_dec_ref()
1163 ref->weak--; in binder_dec_ref()
1165 if (ref->strong == 0 && ref->weak == 0) in binder_dec_ref()
1166 binder_delete_ref(ref); in binder_dec_ref()
1289 struct binder_ref *ref = binder_get_ref(proc, fp->handle); in binder_transaction_buffer_release() local
1291 if (ref == NULL) { in binder_transaction_buffer_release()
1298 ref->debug_id, ref->desc, ref->node->debug_id); in binder_transaction_buffer_release()
1299 binder_dec_ref(ref, fp->type == BINDER_TYPE_HANDLE); in binder_transaction_buffer_release()
1381 struct binder_ref *ref; in binder_transaction() local
1383 ref = binder_get_ref(proc, tr->target.handle); in binder_transaction()
1384 if (ref == NULL) { in binder_transaction()
1390 target_node = ref->node; in binder_transaction()
1540 struct binder_ref *ref; in binder_transaction() local
1565 ref = binder_get_ref_for_node(target_proc, node); in binder_transaction()
1566 if (ref == NULL) { in binder_transaction()
1574 fp->handle = ref->desc; in binder_transaction()
1575 binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE, in binder_transaction()
1578 trace_binder_transaction_node_to_ref(t, node, ref); in binder_transaction()
1582 ref->debug_id, ref->desc); in binder_transaction()
1586 struct binder_ref *ref = binder_get_ref(proc, fp->handle); in binder_transaction() local
1588 if (ref == NULL) { in binder_transaction()
1600 if (ref->node->proc == target_proc) { in binder_transaction()
1605 fp->binder = ref->node->ptr; in binder_transaction()
1606 fp->cookie = ref->node->cookie; in binder_transaction()
1607 binder_inc_node(ref->node, fp->type == BINDER_TYPE_BINDER, 0, NULL); in binder_transaction()
1608 trace_binder_transaction_ref_to_node(t, ref); in binder_transaction()
1611 ref->debug_id, ref->desc, ref->node->debug_id, in binder_transaction()
1612 (u64)ref->node->ptr); in binder_transaction()
1616 new_ref = binder_get_ref_for_node(target_proc, ref->node); in binder_transaction()
1623 trace_binder_transaction_ref_to_ref(t, ref, in binder_transaction()
1627 ref->debug_id, ref->desc, new_ref->debug_id, in binder_transaction()
1628 new_ref->desc, ref->node->debug_id); in binder_transaction()
1781 struct binder_ref *ref; in binder_thread_write() local
1789 ref = binder_get_ref_for_node(proc, in binder_thread_write()
1791 if (ref->desc != target) { in binder_thread_write()
1794 ref->desc); in binder_thread_write()
1797 ref = binder_get_ref(proc, target); in binder_thread_write()
1798 if (ref == NULL) { in binder_thread_write()
1806 binder_inc_ref(ref, 0, NULL); in binder_thread_write()
1810 binder_inc_ref(ref, 1, NULL); in binder_thread_write()
1814 binder_dec_ref(ref, 1); in binder_thread_write()
1819 binder_dec_ref(ref, 0); in binder_thread_write()
1824 proc->pid, thread->pid, debug_string, ref->debug_id, in binder_thread_write()
1825 ref->desc, ref->strong, ref->weak, ref->node->debug_id); in binder_thread_write()
1984 struct binder_ref *ref; in binder_thread_write() local
1993 ref = binder_get_ref(proc, target); in binder_thread_write()
1994 if (ref == NULL) { in binder_thread_write()
2010 (u64)cookie, ref->debug_id, ref->desc, in binder_thread_write()
2011 ref->strong, ref->weak, ref->node->debug_id); in binder_thread_write()
2014 if (ref->death) { in binder_thread_write()
2030 ref->death = death; in binder_thread_write()
2031 if (ref->node->proc == NULL) { in binder_thread_write()
2032 ref->death->work.type = BINDER_WORK_DEAD_BINDER; in binder_thread_write()
2034 list_add_tail(&ref->death->work.entry, &thread->todo); in binder_thread_write()
2036 list_add_tail(&ref->death->work.entry, &proc->todo); in binder_thread_write()
2041 if (ref->death == NULL) { in binder_thread_write()
2046 death = ref->death; in binder_thread_write()
2054 ref->death = NULL; in binder_thread_write()
3021 struct binder_ref *ref; in binder_node_release() local
3039 hlist_for_each_entry(ref, &node->refs, node_entry) { in binder_node_release()
3042 if (!ref->death) in binder_node_release()
3047 if (list_empty(&ref->death->work.entry)) { in binder_node_release()
3048 ref->death->work.type = BINDER_WORK_DEAD_BINDER; in binder_node_release()
3049 list_add_tail(&ref->death->work.entry, in binder_node_release()
3050 &ref->proc->todo); in binder_node_release()
3051 wake_up_interruptible(&ref->proc->wait); in binder_node_release()
3105 struct binder_ref *ref; in binder_deferred_release() local
3107 ref = rb_entry(n, struct binder_ref, rb_node_desc); in binder_deferred_release()
3109 binder_delete_ref(ref); in binder_deferred_release()
3326 struct binder_ref *ref; in print_binder_node() local
3331 hlist_for_each_entry(ref, &node->refs, node_entry) in print_binder_node()
3341 hlist_for_each_entry(ref, &node->refs, node_entry) in print_binder_node()
3342 seq_printf(m, " %d", ref->proc->pid); in print_binder_node()
3350 static void print_binder_ref(struct seq_file *m, struct binder_ref *ref) in print_binder_ref() argument
3353 ref->debug_id, ref->desc, ref->node->proc ? "" : "dead ", in print_binder_ref()
3354 ref->node->debug_id, ref->strong, ref->weak, ref->death); in print_binder_ref()
3507 struct binder_ref *ref = rb_entry(n, struct binder_ref, in print_binder_proc_stats() local
3510 strong += ref->strong; in print_binder_proc_stats()
3511 weak += ref->weak; in print_binder_proc_stats()