#include "binder_alloc.h"
#include "binder_trace.h"
-static DEFINE_MUTEX(binder_main_lock);
-
static HLIST_HEAD(binder_deferred_list);
static DEFINE_MUTEX(binder_deferred_lock);
return retval;
}
-static inline void binder_lock(const char *tag)
-{
- trace_binder_lock(tag);
- mutex_lock(&binder_main_lock);
- trace_binder_locked(tag);
-}
-
-static inline void binder_unlock(const char *tag)
-{
- trace_binder_unlock(tag);
- mutex_unlock(&binder_main_lock);
-}
-
static void binder_set_nice(long nice)
{
long min_nice;
thread->looper |= BINDER_LOOPER_STATE_WAITING;
- binder_unlock(__func__);
-
trace_binder_wait_for_work(wait_for_proc_work,
!!thread->transaction_stack,
!binder_worklist_empty(proc, &thread->todo));
ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread));
}
- binder_lock(__func__);
-
binder_inner_proc_lock(proc);
if (wait_for_proc_work)
proc->ready_threads--;
struct binder_thread *thread = NULL;
int wait_for_proc_work;
- binder_lock(__func__);
-
thread = binder_get_thread(proc);
binder_inner_proc_lock(thread->proc);
binder_worklist_empty_ilocked(&thread->todo);
binder_inner_proc_unlock(thread->proc);
- binder_unlock(__func__);
-
if (wait_for_proc_work) {
if (binder_has_proc_work(proc, thread))
return POLLIN;
if (ret)
goto err_unlocked;
- binder_lock(__func__);
thread = binder_get_thread(proc);
if (thread == NULL) {
ret = -ENOMEM;
err:
if (thread)
thread->looper_need_return = false;
- binder_unlock(__func__);
wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
if (ret && ret != -ERESTARTSYS)
pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret);
proc->context = &binder_dev->context;
binder_alloc_init(&proc->alloc);
- binder_lock(__func__);
-
binder_stats_created(BINDER_STAT_PROC);
proc->pid = current->group_leader->pid;
INIT_LIST_HEAD(&proc->delivered_death);
filp->private_data = proc;
- binder_unlock(__func__);
-
mutex_lock(&binder_procs_lock);
hlist_add_head(&proc->proc_node, &binder_procs);
mutex_unlock(&binder_procs_lock);
int defer;
do {
- binder_lock(__func__);
mutex_lock(&binder_deferred_lock);
if (!hlist_empty(&binder_deferred_list)) {
proc = hlist_entry(binder_deferred_list.first,
if (defer & BINDER_DEFERRED_RELEASE)
binder_deferred_release(proc); /* frees proc */
- binder_unlock(__func__);
if (files)
put_files_struct(files);
} while (proc);
struct binder_node *node;
struct binder_node *last_node = NULL;
- binder_lock(__func__);
-
seq_puts(m, "binder state:\n");
spin_lock(&binder_dead_nodes_lock);
hlist_for_each_entry(proc, &binder_procs, proc_node)
print_binder_proc(m, proc, 1);
mutex_unlock(&binder_procs_lock);
- binder_unlock(__func__);
+
return 0;
}
{
struct binder_proc *proc;
- binder_lock(__func__);
-
seq_puts(m, "binder stats:\n");
print_binder_stats(m, "", &binder_stats);
hlist_for_each_entry(proc, &binder_procs, proc_node)
print_binder_proc_stats(m, proc);
mutex_unlock(&binder_procs_lock);
- binder_unlock(__func__);
+
return 0;
}
{
struct binder_proc *proc;
- binder_lock(__func__);
-
seq_puts(m, "binder transactions:\n");
mutex_lock(&binder_procs_lock);
hlist_for_each_entry(proc, &binder_procs, proc_node)
print_binder_proc(m, proc, 0);
mutex_unlock(&binder_procs_lock);
- binder_unlock(__func__);
+
return 0;
}
struct binder_proc *itr;
int pid = (unsigned long)m->private;
- binder_lock(__func__);
-
mutex_lock(&binder_procs_lock);
hlist_for_each_entry(itr, &binder_procs, proc_node) {
if (itr->pid == pid) {
}
mutex_unlock(&binder_procs_lock);
- binder_unlock(__func__);
return 0;
}