staging: android: binder: move debugging mask into a macro
authorDaniel Walker <dwalker@fifo99.com>
Fri, 12 Jun 2009 18:51:14 +0000 (11:51 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:01:25 +0000 (12:01 -0700)
I moved the continual,

if (binder_debug_mask & mask)
printk()

into a single macro so it's all in one place. It could be refined further
from there.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: Brian Swetland <swetland@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/android/binder.c

index 17d89a8124ad4c1d2e1163a8ac1424ff938080cf..89213933e4d43997dd96c83251f2d841c0793ab7 100644 (file)
@@ -100,6 +100,12 @@ static int binder_set_stop_on_user_error(const char *val,
 module_param_call(stop_on_user_error, binder_set_stop_on_user_error,
        param_get_int, &binder_stop_on_user_error, S_IWUSR | S_IRUGO);
 
+#define binder_debug(mask, x...) \
+       do { \
+               if (binder_debug_mask & mask) \
+                       printk(KERN_INFO x); \
+       } while (0)
+
 #define binder_user_error(x...) \
        do { \
                if (binder_debug_mask & BINDER_DEBUG_USER_ERROR) \
@@ -468,9 +474,9 @@ static void binder_set_nice(long nice)
                return;
        }
        min_nice = 20 - current->signal->rlim[RLIMIT_NICE].rlim_cur;
-       if (binder_debug_mask & BINDER_DEBUG_PRIORITY_CAP)
-               printk(KERN_INFO "binder: %d: nice value %ld not allowed use "
-                      "%ld instead\n", current->pid, nice, min_nice);
+       binder_debug(BINDER_DEBUG_PRIORITY_CAP,
+                    "binder: %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)
                return;
@@ -500,9 +506,9 @@ static void binder_insert_free_buffer(struct binder_proc *proc,
 
        new_buffer_size = binder_buffer_size(proc, new_buffer);
 
-       if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-               printk(KERN_INFO "binder: %d: add free buffer, size %zd, "
-                      "at %p\n", proc->pid, new_buffer_size, new_buffer);
+       binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                    "binder: %d: add free buffer, size %zd, "
+                    "at %p\n", proc->pid, new_buffer_size, new_buffer);
 
        while (*p) {
                parent = *p;
@@ -579,9 +585,9 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
        struct page **page;
        struct mm_struct *mm;
 
-       if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-               printk(KERN_INFO "binder: %d: %s pages %p-%p\n",
-                      proc->pid, allocate ? "allocate" : "free", start, end);
+       binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                    "binder: %d: %s pages %p-%p\n", proc->pid,
+                    allocate ? "allocate" : "free", start, end);
 
        if (end <= start)
                return 0;
@@ -696,10 +702,9 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
 
        if (is_async &&
            proc->free_async_space < size + sizeof(struct binder_buffer)) {
-               if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-                       printk(KERN_ERR
-                              "binder: %d: binder_alloc_buf size %zd failed, "
-                              "no async space left\n", proc->pid, size);
+               binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                            "binder: %d: binder_alloc_buf size %zd"
+                            "failed, no async space left\n", proc->pid, size);
                return NULL;
        }
 
@@ -727,9 +732,10 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
                buffer = rb_entry(best_fit, struct binder_buffer, rb_node);
                buffer_size = binder_buffer_size(proc, buffer);
        }
-       if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-               printk(KERN_INFO "binder: %d: binder_alloc_buf size %zd got buff"
-                      "er %p size %zd\n", proc->pid, size, buffer, buffer_size);
+
+       binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                    "binder: %d: binder_alloc_buf size %zd got buff"
+                    "er %p size %zd\n", proc->pid, size, buffer, buffer_size);
 
        has_page_addr =
                (void *)(((uintptr_t)buffer->data + buffer_size) & PAGE_MASK);
@@ -756,18 +762,18 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
                new_buffer->free = 1;
                binder_insert_free_buffer(proc, new_buffer);
        }
-       if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-               printk(KERN_INFO "binder: %d: binder_alloc_buf size %zd got "
-                      "%p\n", proc->pid, size, buffer);
+       binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                    "binder: %d: binder_alloc_buf size %zd got "
+                    "%p\n", proc->pid, size, buffer);
        buffer->data_size = data_size;
        buffer->offsets_size = offsets_size;
        buffer->async_transaction = is_async;
        if (is_async) {
                proc->free_async_space -= size + sizeof(struct binder_buffer);
-               if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC_ASYNC)
-                       printk(KERN_INFO "binder: %d: binder_alloc_buf size %zd "
-                              "async free %zd\n", proc->pid, size,
-                              proc->free_async_space);
+               binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
+                            "binder: %d: binder_alloc_buf size %zd "
+                            "async free %zd\n", proc->pid, size,
+                            proc->free_async_space);
        }
 
        return buffer;
@@ -797,9 +803,9 @@ static void binder_delete_free_buffer(struct binder_proc *proc,
                free_page_start = 0;
                if (buffer_end_page(prev) == buffer_end_page(buffer))
                        free_page_end = 0;
-               if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-                       printk(KERN_INFO "binder: %d: merge free, buffer %p "
-                              "share page with %p\n", proc->pid, buffer, prev);
+               binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                            "binder: %d: merge free, buffer %p "
+                            "share page with %p\n", proc->pid, buffer, prev);
        }
 
        if (!list_is_last(&buffer->entry, &proc->buffers)) {
@@ -810,19 +816,19 @@ static void binder_delete_free_buffer(struct binder_proc *proc,
                        if (buffer_start_page(next) ==
                            buffer_start_page(buffer))
                                free_page_start = 0;
-                       if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-                               printk(KERN_INFO "binder: %d: merge free, "
-                                      "buffer %p share page with %p\n",
-                                      proc->pid, buffer, prev);
+                       binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                                    "binder: %d: merge free, buffer"
+                                    " %p share page with %p\n", proc->pid,
+                                    buffer, prev);
                }
        }
        list_del(&buffer->entry);
        if (free_page_start || free_page_end) {
-               if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-                       printk(KERN_INFO "binder: %d: merge free, buffer %p do "
-                              "not share page%s%s with with %p or %p\n",
-                              proc->pid, buffer, free_page_start ? "" : " end",
-                              free_page_end ? "" : " start", prev, next);
+               binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                            "binder: %d: merge free, buffer %p do "
+                            "not share page%s%s with with %p or %p\n",
+                            proc->pid, buffer, free_page_start ? "" : " end",
+                            free_page_end ? "" : " start", prev, next);
                binder_update_page_range(proc, 0, free_page_start ?
                        buffer_start_page(buffer) : buffer_end_page(buffer),
                        (free_page_end ? buffer_end_page(buffer) :
@@ -839,9 +845,10 @@ static void binder_free_buf(struct binder_proc *proc,
 
        size = ALIGN(buffer->data_size, sizeof(void *)) +
                ALIGN(buffer->offsets_size, sizeof(void *));
-       if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC)
-               printk(KERN_INFO "binder: %d: binder_free_buf %p size %zd buffer"
-                      "_size %zd\n", proc->pid, buffer, size, buffer_size);
+
+       binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                    "binder: %d: binder_free_buf %p size %zd buffer"
+                    "_size %zd\n", proc->pid, buffer, size, buffer_size);
 
        BUG_ON(buffer->free);
        BUG_ON(size > buffer_size);
@@ -851,10 +858,11 @@ static void binder_free_buf(struct binder_proc *proc,
 
        if (buffer->async_transaction) {
                proc->free_async_space += size + sizeof(struct binder_buffer);
-               if (binder_debug_mask & BINDER_DEBUG_BUFFER_ALLOC_ASYNC)
-                       printk(KERN_INFO "binder: %d: binder_free_buf size %zd "
-                              "async free %zd\n", proc->pid, size,
-                              proc->free_async_space);
+
+               binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
+                            "binder: %d: binder_free_buf size %zd "
+                            "async free %zd\n", proc->pid, size,
+                            proc->free_async_space);
        }
 
        binder_update_page_range(proc, 0,
@@ -935,10 +943,10 @@ static struct binder_node *binder_new_node(struct binder_proc *proc,
        node->work.type = BINDER_WORK_NODE;
        INIT_LIST_HEAD(&node->work.entry);
        INIT_LIST_HEAD(&node->async_todo);
-       if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-               printk(KERN_INFO "binder: %d:%d node %d u%p c%p created\n",
-                      proc->pid, current->pid, node->debug_id,
-                      node->ptr, node->cookie);
+       binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                    "binder: %d:%d node %d u%p c%p created\n",
+                    proc->pid, current->pid, node->debug_id,
+                    node->ptr, node->cookie);
        return node;
 }
 
@@ -1003,12 +1011,14 @@ static int binder_dec_node(struct binder_node *node, int strong, int internal)
                        list_del_init(&node->work.entry);
                        if (node->proc) {
                                rb_erase(&node->rb_node, &node->proc->nodes);
-                               if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-                                       printk(KERN_INFO "binder: refless node %d deleted\n", node->debug_id);
+                               binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                                            "binder: refless node %d deleted\n",
+                                            node->debug_id);
                        } else {
                                hlist_del(&node->dead_node);
-                               if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-                                       printk(KERN_INFO "binder: dead node %d deleted\n", node->debug_id);
+                               binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                                            "binder: dead node %d deleted\n",
+                                            node->debug_id);
                        }
                        kfree(node);
                        binder_stats.obj_deleted[BINDER_STAT_NODE]++;
@@ -1091,25 +1101,27 @@ static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc,
        rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc);
        if (node) {
                hlist_add_head(&new_ref->node_entry, &node->refs);
-               if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-                       printk(KERN_INFO "binder: %d new ref %d desc %d for "
-                               "node %d\n", proc->pid, new_ref->debug_id,
-                               new_ref->desc, node->debug_id);
+
+               binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                            "binder: %d new ref %d desc %d for "
+                            "node %d\n", proc->pid, new_ref->debug_id,
+                            new_ref->desc, node->debug_id);
        } else {
-               if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-                       printk(KERN_INFO "binder: %d new ref %d desc %d for "
-                               "dead node\n", proc->pid, new_ref->debug_id,
-                               new_ref->desc);
+               binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                            "binder: %d new ref %d desc %d for "
+                            "dead node\n", proc->pid, new_ref->debug_id,
+                             new_ref->desc);
        }
        return new_ref;
 }
 
 static void binder_delete_ref(struct binder_ref *ref)
 {
-       if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-               printk(KERN_INFO "binder: %d delete ref %d desc %d for "
-                       "node %d\n", ref->proc->pid, ref->debug_id,
-                       ref->desc, ref->node->debug_id);
+       binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                    "binder: %d delete ref %d desc %d for "
+                    "node %d\n", ref->proc->pid, ref->debug_id,
+                    ref->desc, ref->node->debug_id);
+
        rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc);
        rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node);
        if (ref->strong)
@@ -1117,10 +1129,10 @@ static void binder_delete_ref(struct binder_ref *ref)
        hlist_del(&ref->node_entry);
        binder_dec_node(ref->node, 0, 1);
        if (ref->death) {
-               if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-                       printk(KERN_INFO "binder: %d delete ref %d desc %d "
-                               "has death notification\n", ref->proc->pid,
-                               ref->debug_id, ref->desc);
+               binder_debug(BINDER_DEBUG_DEAD_BINDER,
+                            "binder: %d delete ref %d desc %d "
+                            "has death notification\n", ref->proc->pid,
+                            ref->debug_id, ref->desc);
                list_del(&ref->death->work.entry);
                kfree(ref->death);
                binder_stats.obj_deleted[BINDER_STAT_DEATH]++;
@@ -1216,9 +1228,11 @@ static void binder_send_failed_reply(struct binder_transaction *t,
                                target_thread->return_error = BR_OK;
                        }
                        if (target_thread->return_error == BR_OK) {
-                               if (binder_debug_mask & BINDER_DEBUG_FAILED_TRANSACTION)
-                                       printk(KERN_INFO "binder: send failed reply for transaction %d to %d:%d\n",
-                                              t->debug_id, target_thread->proc->pid, target_thread->pid);
+                               binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
+                                            "binder: send failed reply for "
+                                            "transaction %d to %d:%d\n",
+                                             t->debug_id, target_thread->proc->pid,
+                                             target_thread->pid);
 
                                binder_pop_transaction(target_thread, t);
                                target_thread->return_error = error_code;
@@ -1234,22 +1248,22 @@ static void binder_send_failed_reply(struct binder_transaction *t,
                } else {
                        struct binder_transaction *next = t->from_parent;
 
-                       if (binder_debug_mask & BINDER_DEBUG_FAILED_TRANSACTION)
-                               printk(KERN_INFO "binder: send failed reply "
-                                       "for transaction %d, target dead\n",
-                                       t->debug_id);
+                       binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
+                                    "binder: send failed reply "
+                                    "for transaction %d, target dead\n",
+                                    t->debug_id);
 
                        binder_pop_transaction(target_thread, t);
                        if (next == NULL) {
-                               if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-                                       printk(KERN_INFO "binder: reply failed,"
-                                               " no target thread at root\n");
+                               binder_debug(BINDER_DEBUG_DEAD_BINDER,
+                                            "binder: reply failed,"
+                                            " no target thread at root\n");
                                return;
                        }
                        t = next;
-                       if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-                               printk(KERN_INFO "binder: reply failed, no targ"
-                                       "et thread -- retry %d\n", t->debug_id);
+                       binder_debug(BINDER_DEBUG_DEAD_BINDER,
+                                    "binder: reply failed, no target "
+                                    "thread -- retry %d\n", t->debug_id);
                }
        }
 }
@@ -1399,22 +1413,22 @@ static void binder_transaction(struct binder_proc *proc,
        t->debug_id = ++binder_last_id;
        e->debug_id = t->debug_id;
 
-       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION) {
-               if (reply)
-                       printk(KERN_INFO "binder: %d:%d BC_REPLY %d -> %d:%d, "
-                              "data %p-%p size %zd-%zd\n",
-                              proc->pid, thread->pid, t->debug_id,
-                              target_proc->pid, target_thread->pid,
-                              tr->data.ptr.buffer, tr->data.ptr.offsets,
-                              tr->data_size, tr->offsets_size);
-               else
-                       printk(KERN_INFO "binder: %d:%d BC_TRANSACTION %d -> "
-                              "%d - node %d, data %p-%p size %zd-%zd\n",
-                              proc->pid, thread->pid, t->debug_id,
-                              target_proc->pid, target_node->debug_id,
-                              tr->data.ptr.buffer, tr->data.ptr.offsets,
-                              tr->data_size, tr->offsets_size);
-       }
+       if (reply)
+               binder_debug(BINDER_DEBUG_TRANSACTION,
+                            "binder: %d:%d BC_REPLY %d -> %d:%d, "
+                            "data %p-%p size %zd-%zd\n",
+                            proc->pid, thread->pid, t->debug_id,
+                            target_proc->pid, target_thread->pid,
+                            tr->data.ptr.buffer, tr->data.ptr.offsets,
+                            tr->data_size, tr->offsets_size);
+       else
+               binder_debug(BINDER_DEBUG_TRANSACTION,
+                            "binder: %d:%d BC_TRANSACTION %d -> "
+                            "%d - node %d, data %p-%p size %zd-%zd\n",
+                            proc->pid, thread->pid, t->debug_id,
+                            target_proc->pid, target_node->debug_id,
+                            tr->data.ptr.buffer, tr->data.ptr.offsets,
+                            tr->data_size, tr->offsets_size);
 
        if (!reply && !(tr->flags & TF_ONE_WAY))
                t->from = thread;
@@ -1506,9 +1520,11 @@ static void binder_transaction(struct binder_proc *proc,
                                fp->type = BINDER_TYPE_WEAK_HANDLE;
                        fp->handle = ref->desc;
                        binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE, &thread->todo);
-                       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                               printk(KERN_INFO "        node %d u%p -> ref %d desc %d\n",
-                                      node->debug_id, node->ptr, ref->debug_id, ref->desc);
+
+                       binder_debug(BINDER_DEBUG_TRANSACTION,
+                                    "        node %d u%p -> ref %d desc %d\n",
+                                    node->debug_id, node->ptr, ref->debug_id,
+                                    ref->desc);
                } break;
                case BINDER_TYPE_HANDLE:
                case BINDER_TYPE_WEAK_HANDLE: {
@@ -1529,9 +1545,10 @@ static void binder_transaction(struct binder_proc *proc,
                                fp->binder = ref->node->ptr;
                                fp->cookie = ref->node->cookie;
                                binder_inc_node(ref->node, fp->type == BINDER_TYPE_BINDER, 0, NULL);
-                               if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                                       printk(KERN_INFO "        ref %d desc %d -> node %d u%p\n",
-                                              ref->debug_id, ref->desc, ref->node->debug_id, ref->node->ptr);
+                               binder_debug(BINDER_DEBUG_TRANSACTION,
+                                            "        ref %d desc %d -> node %d u%p\n",
+                                            ref->debug_id, ref->desc, ref->node->debug_id,
+                                            ref->node->ptr);
                        } else {
                                struct binder_ref *new_ref;
                                new_ref = binder_get_ref_for_node(target_proc, ref->node);
@@ -1541,9 +1558,10 @@ static void binder_transaction(struct binder_proc *proc,
                                }
                                fp->handle = new_ref->desc;
                                binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL);
-                               if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                                       printk(KERN_INFO "        ref %d desc %d -> ref %d desc %d (node %d)\n",
-                                              ref->debug_id, ref->desc, new_ref->debug_id, new_ref->desc, ref->node->debug_id);
+                               binder_debug(BINDER_DEBUG_TRANSACTION,
+                                            "        ref %d desc %d -> ref %d desc %d (node %d)\n",
+                                            ref->debug_id, ref->desc, new_ref->debug_id,
+                                            new_ref->desc, ref->node->debug_id);
                        }
                } break;
 
@@ -1579,8 +1597,8 @@ static void binder_transaction(struct binder_proc *proc,
                                goto err_get_unused_fd_failed;
                        }
                        task_fd_install(target_proc, target_fd, file);
-                       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                               printk(KERN_INFO "        fd %ld -> %d\n", fp->handle, target_fd);
+                       binder_debug(BINDER_DEBUG_TRANSACTION,
+                                    "        fd %ld -> %d\n", fp->handle, target_fd);
                        /* TODO: fput? */
                        fp->handle = target_fd;
                } break;
@@ -1642,11 +1660,10 @@ err_empty_call_stack:
 err_dead_binder:
 err_invalid_target_handle:
 err_no_context_mgr_node:
-       if (binder_debug_mask & BINDER_DEBUG_FAILED_TRANSACTION)
-               printk(KERN_INFO "binder: %d:%d transaction failed %d, size"
-                               "%zd-%zd\n",
-                          proc->pid, thread->pid, return_error,
-                          tr->data_size, tr->offsets_size);
+       binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
+                    "binder: %d:%d transaction failed %d, size %zd-%zd\n",
+                    proc->pid, thread->pid, return_error,
+                    tr->data_size, tr->offsets_size);
 
        {
                struct binder_transaction_log_entry *fe;
@@ -1669,10 +1686,10 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
        size_t *offp, *off_end;
        int debug_id = buffer->debug_id;
 
-       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-               printk(KERN_INFO "binder: %d buffer release %d, size %zd-%zd, failed at %p\n",
-                          proc->pid, buffer->debug_id,
-                          buffer->data_size, buffer->offsets_size, failed_at);
+       binder_debug(BINDER_DEBUG_TRANSACTION,
+                    "binder: %d buffer release %d, size %zd-%zd, failed at %p\n",
+                    proc->pid, buffer->debug_id,
+                    buffer->data_size, buffer->offsets_size, failed_at);
 
        if (buffer->target_node)
                binder_dec_node(buffer->target_node, 1, 0);
@@ -1700,9 +1717,9 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
                                printk(KERN_ERR "binder: transaction release %d bad node %p\n", debug_id, fp->binder);
                                break;
                        }
-                       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                               printk(KERN_INFO "        node %d u%p\n",
-                                      node->debug_id, node->ptr);
+                       binder_debug(BINDER_DEBUG_TRANSACTION,
+                                    "        node %d u%p\n",
+                                    node->debug_id, node->ptr);
                        binder_dec_node(node, fp->type == BINDER_TYPE_BINDER, 0);
                } break;
                case BINDER_TYPE_HANDLE:
@@ -1712,15 +1729,15 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
                                printk(KERN_ERR "binder: transaction release %d bad handle %ld\n", debug_id, fp->handle);
                                break;
                        }
-                       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                               printk(KERN_INFO "        ref %d desc %d (node %d)\n",
-                                      ref->debug_id, ref->desc, ref->node->debug_id);
+                       binder_debug(BINDER_DEBUG_TRANSACTION,
+                                    "        ref %d desc %d (node %d)\n",
+                                    ref->debug_id, ref->desc, ref->node->debug_id);
                        binder_dec_ref(ref, fp->type == BINDER_TYPE_HANDLE);
                } break;
 
                case BINDER_TYPE_FD:
-                       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                               printk(KERN_INFO "        fd %ld\n", fp->handle);
+                       binder_debug(BINDER_DEBUG_TRANSACTION,
+                                    "        fd %ld\n", fp->handle);
                        if (failed_at)
                                task_close_fd(proc, fp->handle);
                        break;
@@ -1799,9 +1816,10 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                                binder_dec_ref(ref, 0);
                                break;
                        }
-                       if (binder_debug_mask & BINDER_DEBUG_USER_REFS)
-                               printk(KERN_INFO "binder: %d:%d %s ref %d desc %d s %d w %d for node %d\n",
-                                      proc->pid, thread->pid, debug_string, ref->debug_id, ref->desc, ref->strong, ref->weak, ref->node->debug_id);
+                       binder_debug(BINDER_DEBUG_USER_REFS,
+                                    "binder: %d:%d %s ref %d desc %d s %d w %d for node %d\n",
+                                    proc->pid, thread->pid, debug_string, ref->debug_id,
+                                    ref->desc, ref->strong, ref->weak, ref->node->debug_id);
                        break;
                }
                case BC_INCREFS_DONE:
@@ -1859,9 +1877,11 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                                node->pending_weak_ref = 0;
                        }
                        binder_dec_node(node, cmd == BC_ACQUIRE_DONE, 0);
-                       if (binder_debug_mask & BINDER_DEBUG_USER_REFS)
-                               printk(KERN_INFO "binder: %d:%d %s node %d ls %d lw %d\n",
-                                      proc->pid, thread->pid, cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE", node->debug_id, node->local_strong_refs, node->local_weak_refs);
+                       binder_debug(BINDER_DEBUG_USER_REFS,
+                                    "binder: %d:%d %s node %d ls %d lw %d\n",
+                                    proc->pid, thread->pid,
+                                    cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE",
+                                    node->debug_id, node->local_strong_refs, node->local_weak_refs);
                        break;
                }
                case BC_ATTEMPT_ACQUIRE:
@@ -1893,10 +1913,10 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                                        proc->pid, thread->pid, data_ptr);
                                break;
                        }
-                       if (binder_debug_mask & BINDER_DEBUG_FREE_BUFFER)
-                               printk(KERN_INFO "binder: %d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n",
-                                      proc->pid, thread->pid, data_ptr, buffer->debug_id,
-                                      buffer->transaction ? "active" : "finished");
+                       binder_debug(BINDER_DEBUG_FREE_BUFFER,
+                                    "binder: %d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n",
+                                    proc->pid, thread->pid, data_ptr, buffer->debug_id,
+                                    buffer->transaction ? "active" : "finished");
 
                        if (buffer->transaction) {
                                buffer->transaction->buffer = NULL;
@@ -1926,9 +1946,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                }
 
                case BC_REGISTER_LOOPER:
-                       if (binder_debug_mask & BINDER_DEBUG_THREADS)
-                               printk(KERN_INFO "binder: %d:%d BC_REGISTER_LOOPER\n",
-                                      proc->pid, thread->pid);
+                       binder_debug(BINDER_DEBUG_THREADS,
+                                    "binder: %d:%d BC_REGISTER_LOOPER\n",
+                                    proc->pid, thread->pid);
                        if (thread->looper & BINDER_LOOPER_STATE_ENTERED) {
                                thread->looper |= BINDER_LOOPER_STATE_INVALID;
                                binder_user_error("binder: %d:%d ERROR:"
@@ -1948,9 +1968,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                        thread->looper |= BINDER_LOOPER_STATE_REGISTERED;
                        break;
                case BC_ENTER_LOOPER:
-                       if (binder_debug_mask & BINDER_DEBUG_THREADS)
-                               printk(KERN_INFO "binder: %d:%d BC_ENTER_LOOPER\n",
-                                      proc->pid, thread->pid);
+                       binder_debug(BINDER_DEBUG_THREADS,
+                                    "binder: %d:%d BC_ENTER_LOOPER\n",
+                                    proc->pid, thread->pid);
                        if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) {
                                thread->looper |= BINDER_LOOPER_STATE_INVALID;
                                binder_user_error("binder: %d:%d ERROR:"
@@ -1961,9 +1981,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                        thread->looper |= BINDER_LOOPER_STATE_ENTERED;
                        break;
                case BC_EXIT_LOOPER:
-                       if (binder_debug_mask & BINDER_DEBUG_THREADS)
-                               printk(KERN_INFO "binder: %d:%d BC_EXIT_LOOPER\n",
-                                      proc->pid, thread->pid);
+                       binder_debug(BINDER_DEBUG_THREADS,
+                                    "binder: %d:%d BC_EXIT_LOOPER\n",
+                                    proc->pid, thread->pid);
                        thread->looper |= BINDER_LOOPER_STATE_EXITED;
                        break;
 
@@ -1992,14 +2012,14 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                                break;
                        }
 
-                       if (binder_debug_mask & BINDER_DEBUG_DEATH_NOTIFICATION)
-                               printk(KERN_INFO "binder: %d:%d %s %p ref %d desc %d s %d w %d for node %d\n",
-                                      proc->pid, thread->pid,
-                                      cmd == BC_REQUEST_DEATH_NOTIFICATION ?
-                                      "BC_REQUEST_DEATH_NOTIFICATION" :
-                                      "BC_CLEAR_DEATH_NOTIFICATION",
-                                      cookie, ref->debug_id, ref->desc,
-                                      ref->strong, ref->weak, ref->node->debug_id);
+                       binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION,
+                                    "binder: %d:%d %s %p ref %d desc %d s %d w %d for node %d\n",
+                                    proc->pid, thread->pid,
+                                    cmd == BC_REQUEST_DEATH_NOTIFICATION ?
+                                    "BC_REQUEST_DEATH_NOTIFICATION" :
+                                    "BC_CLEAR_DEATH_NOTIFICATION",
+                                    cookie, ref->debug_id, ref->desc,
+                                    ref->strong, ref->weak, ref->node->debug_id);
 
                        if (cmd == BC_REQUEST_DEATH_NOTIFICATION) {
                                if (ref->death) {
@@ -2013,10 +2033,10 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                                death = kzalloc(sizeof(*death), GFP_KERNEL);
                                if (death == NULL) {
                                        thread->return_error = BR_ERROR;
-                                       if (binder_debug_mask & BINDER_DEBUG_FAILED_TRANSACTION)
-                                               printk(KERN_INFO "binder: %d:%d "
-                                                       "BC_REQUEST_DEATH_NOTIFICATION failed\n",
-                                                       proc->pid, thread->pid);
+                                       binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
+                                                    "binder: %d:%d "
+                                                    "BC_REQUEST_DEATH_NOTIFICATION failed\n",
+                                                    proc->pid, thread->pid);
                                        break;
                                }
                                binder_stats.obj_created[BINDER_STAT_DEATH]++;
@@ -2082,9 +2102,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
                                        break;
                                }
                        }
-                       if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-                               printk(KERN_INFO "binder: %d:%d BC_DEAD_BINDER_DONE %p found %p\n",
-                                      proc->pid, thread->pid, cookie, death);
+                       binder_debug(BINDER_DEBUG_DEAD_BINDER,
+                                    "binder: %d:%d BC_DEAD_BINDER_DONE %p found %p\n",
+                                    proc->pid, thread->pid, cookie, death);
                        if (death == NULL) {
                                binder_user_error("binder: %d:%d BC_DEAD"
                                        "_BINDER_DONE %p not found\n",
@@ -2240,9 +2260,9 @@ retry:
                        ptr += sizeof(uint32_t);
 
                        binder_stat_br(proc, thread, cmd);
-                       if (binder_debug_mask & BINDER_DEBUG_TRANSACTION_COMPLETE)
-                               printk(KERN_INFO "binder: %d:%d BR_TRANSACTION_COMPLETE\n",
-                                      proc->pid, thread->pid);
+                       binder_debug(BINDER_DEBUG_TRANSACTION_COMPLETE,
+                                    "binder: %d:%d BR_TRANSACTION_COMPLETE\n",
+                                    proc->pid, thread->pid);
 
                        list_del(&w->entry);
                        kfree(w);
@@ -2287,22 +2307,24 @@ retry:
                                ptr += sizeof(void *);
 
                                binder_stat_br(proc, thread, cmd);
-                               if (binder_debug_mask & BINDER_DEBUG_USER_REFS)
-                                       printk(KERN_INFO "binder: %d:%d %s %d u%p c%p\n",
-                                              proc->pid, thread->pid, cmd_name, node->debug_id, node->ptr, node->cookie);
+                               binder_debug(BINDER_DEBUG_USER_REFS,
+                                            "binder: %d:%d %s %d u%p c%p\n",
+                                            proc->pid, thread->pid, cmd_name, node->debug_id, node->ptr, node->cookie);
                        } else {
                                list_del_init(&w->entry);
                                if (!weak && !strong) {
-                                       if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-                                               printk(KERN_INFO "binder: %d:%d node %d u%p c%p deleted\n",
-                                                      proc->pid, thread->pid, node->debug_id, node->ptr, node->cookie);
+                                       binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                                                    "binder: %d:%d node %d u%p c%p deleted\n",
+                                                    proc->pid, thread->pid, node->debug_id,
+                                                    node->ptr, node->cookie);
                                        rb_erase(&node->rb_node, &proc->nodes);
                                        kfree(node);
                                        binder_stats.obj_deleted[BINDER_STAT_NODE]++;
                                } else {
-                                       if (binder_debug_mask & BINDER_DEBUG_INTERNAL_REFS)
-                                               printk(KERN_INFO "binder: %d:%d node %d u%p c%p state unchanged\n",
-                                                      proc->pid, thread->pid, node->debug_id, node->ptr, node->cookie);
+                                       binder_debug(BINDER_DEBUG_INTERNAL_REFS,
+                                                    "binder: %d:%d node %d u%p c%p state unchanged\n",
+                                                    proc->pid, thread->pid, node->debug_id, node->ptr,
+                                                    node->cookie);
                                }
                        }
                } break;
@@ -2323,13 +2345,13 @@ retry:
                        if (put_user(death->cookie, (void * __user *)ptr))
                                return -EFAULT;
                        ptr += sizeof(void *);
-                       if (binder_debug_mask & BINDER_DEBUG_DEATH_NOTIFICATION)
-                               printk(KERN_INFO "binder: %d:%d %s %p\n",
-                                      proc->pid, thread->pid,
-                                      cmd == BR_DEAD_BINDER ?
-                                      "BR_DEAD_BINDER" :
-                                      "BR_CLEAR_DEATH_NOTIFICATION_DONE",
-                                      death->cookie);
+                       binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION,
+                                    "binder: %d:%d %s %p\n",
+                                     proc->pid, thread->pid,
+                                     cmd == BR_DEAD_BINDER ?
+                                     "BR_DEAD_BINDER" :
+                                     "BR_CLEAR_DEATH_NOTIFICATION_DONE",
+                                     death->cookie);
 
                        if (w->type == BINDER_WORK_CLEAR_DEATH_NOTIFICATION) {
                                list_del(&w->entry);
@@ -2391,16 +2413,16 @@ retry:
                ptr += sizeof(tr);
 
                binder_stat_br(proc, thread, cmd);
-               if (binder_debug_mask & BINDER_DEBUG_TRANSACTION)
-                       printk(KERN_INFO "binder: %d:%d %s %d %d:%d, cmd %d"
-                               "size %zd-%zd ptr %p-%p\n",
-                              proc->pid, thread->pid,
-                              (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
-                                                        "BR_REPLY",
-                              t->debug_id, t->from ? t->from->proc->pid : 0,
-                              t->from ? t->from->pid : 0, cmd,
-                              t->buffer->data_size, t->buffer->offsets_size,
-                              tr.data.ptr.buffer, tr.data.ptr.offsets);
+               binder_debug(BINDER_DEBUG_TRANSACTION,
+                            "binder: %d:%d %s %d %d:%d, cmd %d"
+                            "size %zd-%zd ptr %p-%p\n",
+                            proc->pid, thread->pid,
+                            (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
+                            "BR_REPLY",
+                            t->debug_id, t->from ? t->from->proc->pid : 0,
+                            t->from ? t->from->pid : 0, cmd,
+                            t->buffer->data_size, t->buffer->offsets_size,
+                            tr.data.ptr.buffer, tr.data.ptr.offsets);
 
                list_del(&t->work.entry);
                t->buffer->allow_user_free = 1;
@@ -2425,9 +2447,9 @@ done:
             BINDER_LOOPER_STATE_ENTERED)) /* the user-space code fails to */
             /*spawn a new thread if we leave this out */) {
                proc->requested_threads++;
-               if (binder_debug_mask & BINDER_DEBUG_THREADS)
-                       printk(KERN_INFO "binder: %d:%d BR_SPAWN_LOOPER\n",
-                              proc->pid, thread->pid);
+               binder_debug(BINDER_DEBUG_THREADS,
+                            "binder: %d:%d BR_SPAWN_LOOPER\n",
+                            proc->pid, thread->pid);
                if (put_user(BR_SPAWN_LOOPER, (uint32_t __user *)buffer))
                        return -EFAULT;
        }
@@ -2507,11 +2529,12 @@ static int binder_free_thread(struct binder_proc *proc,
                send_reply = t;
        while (t) {
                active_transactions++;
-               if (binder_debug_mask & BINDER_DEBUG_DEAD_TRANSACTION)
-                       printk(KERN_INFO "binder: release %d:%d transaction %d "
-                              "%s, still active\n", proc->pid, thread->pid,
-                              t->debug_id,
-                              (t->to_thread == thread) ? "in" : "out");
+               binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
+                            "binder: release %d:%d transaction %d "
+                            "%s, still active\n", proc->pid, thread->pid,
+                            t->debug_id,
+                            (t->to_thread == thread) ? "in" : "out");
+
                if (t->to_thread == thread) {
                        t->to_proc = NULL;
                        t->to_thread = NULL;
@@ -2596,9 +2619,11 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                        ret = -EFAULT;
                        goto err;
                }
-               if (binder_debug_mask & BINDER_DEBUG_READ_WRITE)
-                       printk(KERN_INFO "binder: %d:%d write %ld at %08lx, read %ld at %08lx\n",
-                              proc->pid, thread->pid, bwr.write_size, bwr.write_buffer, bwr.read_size, bwr.read_buffer);
+               binder_debug(BINDER_DEBUG_READ_WRITE,
+                            "binder: %d:%d write %ld at %08lx, read %ld at %08lx\n",
+                            proc->pid, thread->pid, bwr.write_size, bwr.write_buffer,
+                            bwr.read_size, bwr.read_buffer);
+
                if (bwr.write_size > 0) {
                        ret = binder_thread_write(proc, thread, (void __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed);
                        if (ret < 0) {
@@ -2618,9 +2643,10 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                                goto err;
                        }
                }
-               if (binder_debug_mask & BINDER_DEBUG_READ_WRITE)
-                       printk(KERN_INFO "binder: %d:%d wrote %ld of %ld, read return %ld of %ld\n",
-                              proc->pid, thread->pid, bwr.write_consumed, bwr.write_size, bwr.read_consumed, bwr.read_size);
+               binder_debug(BINDER_DEBUG_READ_WRITE,
+                            "binder: %d:%d wrote %ld of %ld, read return %ld of %ld\n",
+                            proc->pid, thread->pid, bwr.write_consumed, bwr.write_size,
+                            bwr.read_consumed, bwr.read_size);
                if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
                        ret = -EFAULT;
                        goto err;
@@ -2661,9 +2687,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                binder_context_mgr_node->has_weak_ref = 1;
                break;
        case BINDER_THREAD_EXIT:
-               if (binder_debug_mask & BINDER_DEBUG_THREADS)
-                       printk(KERN_INFO "binder: %d:%d exit\n",
-                              proc->pid, thread->pid);
+               binder_debug(BINDER_DEBUG_THREADS, "binder: %d:%d exit\n",
+                            proc->pid, thread->pid);
                binder_free_thread(proc, thread);
                thread = NULL;
                break;
@@ -2695,24 +2720,22 @@ err:
 static void binder_vma_open(struct vm_area_struct *vma)
 {
        struct binder_proc *proc = vma->vm_private_data;
-       if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO
-                       "binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
-                       proc->pid, vma->vm_start, vma->vm_end,
-                       (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
-                       (unsigned long)pgprot_val(vma->vm_page_prot));
+       binder_debug(BINDER_DEBUG_OPEN_CLOSE,
+                    "binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
+                    proc->pid, vma->vm_start, vma->vm_end,
+                    (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
+                    (unsigned long)pgprot_val(vma->vm_page_prot));
        dump_stack();
 }
 
 static void binder_vma_close(struct vm_area_struct *vma)
 {
        struct binder_proc *proc = vma->vm_private_data;
-       if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO
-                       "binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
-                       proc->pid, vma->vm_start, vma->vm_end,
-                       (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
-                       (unsigned long)pgprot_val(vma->vm_page_prot));
+       binder_debug(BINDER_DEBUG_OPEN_CLOSE,
+                    "binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n",
+                    proc->pid, vma->vm_start, vma->vm_end,
+                    (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
+                    (unsigned long)pgprot_val(vma->vm_page_prot));
        proc->vma = NULL;
        binder_defer_work(proc, BINDER_DEFERRED_PUT_FILES);
 }
@@ -2733,12 +2756,11 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
        if ((vma->vm_end - vma->vm_start) > SZ_4M)
                vma->vm_end = vma->vm_start + SZ_4M;
 
-       if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO
-                       "binder_mmap: %d %lx-%lx (%ld K) vma %lx pagep %lx\n",
-                       proc->pid, vma->vm_start, vma->vm_end,
-                       (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
-                       (unsigned long)pgprot_val(vma->vm_page_prot));
+       binder_debug(BINDER_DEBUG_OPEN_CLOSE,
+                    "binder_mmap: %d %lx-%lx (%ld K) vma %lx pagep %lx\n",
+                    proc->pid, vma->vm_start, vma->vm_end,
+                    (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags,
+                    (unsigned long)pgprot_val(vma->vm_page_prot));
 
        if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) {
                ret = -EPERM;
@@ -2818,9 +2840,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
 {
        struct binder_proc *proc;
 
-       if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO "binder_open: %d:%d\n",
-                      current->group_leader->pid, current->pid);
+       binder_debug(BINDER_DEBUG_OPEN_CLOSE, "binder_open: %d:%d\n",
+                    current->group_leader->pid, current->pid);
 
        proc = kzalloc(sizeof(*proc), GFP_KERNEL);
        if (proc == NULL)
@@ -2873,8 +2894,9 @@ static void binder_deferred_flush(struct binder_proc *proc)
        }
        wake_up_interruptible_all(&proc->wait);
 
-       if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO "binder_flush: %d woke %d threads\n", proc->pid, wake_count);
+       binder_debug(BINDER_DEBUG_OPEN_CLOSE,
+                    "binder_flush: %d woke %d threads\n", proc->pid,
+                    wake_count);
 }
 
 static int binder_release(struct inode *nodp, struct file *filp)
@@ -2903,8 +2925,9 @@ static void binder_deferred_release(struct binder_proc *proc)
 
        hlist_del(&proc->proc_node);
        if (binder_context_mgr_node && binder_context_mgr_node->proc == proc) {
-               if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-                       printk(KERN_INFO "binder_release: %d context_mgr_node gone\n", proc->pid);
+               binder_debug(BINDER_DEBUG_DEAD_BINDER,
+                            "binder_release: %d context_mgr_node gone\n",
+                            proc->pid);
                binder_context_mgr_node = NULL;
        }
 
@@ -2947,10 +2970,10 @@ static void binder_deferred_release(struct binder_proc *proc)
                                                BUG();
                                }
                        }
-                       if (binder_debug_mask & BINDER_DEBUG_DEAD_BINDER)
-                               printk(KERN_INFO "binder: node %d now dead, "
-                                      "refs %d, death %d\n", node->debug_id,
-                                      incoming_refs, death);
+                       binder_debug(BINDER_DEBUG_DEAD_BINDER,
+                                    "binder: node %d now dead, "
+                                    "refs %d, death %d\n", node->debug_id,
+                                    incoming_refs, death);
                }
        }
        outgoing_refs = 0;
@@ -2986,13 +3009,11 @@ static void binder_deferred_release(struct binder_proc *proc)
                int i;
                for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) {
                        if (proc->pages[i]) {
-                               if (binder_debug_mask &
-                                   BINDER_DEBUG_BUFFER_ALLOC)
-                                       printk(KERN_INFO
-                                              "binder_release: %d: "
-                                              "page %d at %p not freed\n",
-                                              proc->pid, i,
-                                              proc->buffer + i * PAGE_SIZE);
+                               binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
+                                            "binder_release: %d: "
+                                            "page %d at %p not freed\n",
+                                            proc->pid, i,
+                                            proc->buffer + i * PAGE_SIZE);
                                __free_page(proc->pages[i]);
                                page_count++;
                        }
@@ -3003,13 +3024,12 @@ static void binder_deferred_release(struct binder_proc *proc)
 
        put_task_struct(proc->tsk);
 
-       if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO
-                      "binder_release: %d threads %d, nodes %d (ref %d), "
-                      "refs %d, active transactions %d, buffers %d, "
-                      "pages %d\n",
-                      proc->pid, threads, nodes, incoming_refs, outgoing_refs,
-                      active_transactions, buffers, page_count);
+       binder_debug(BINDER_DEBUG_OPEN_CLOSE,
+                    "binder_release: %d threads %d, nodes %d (ref %d), "
+                    "refs %d, active transactions %d, buffers %d, "
+                    "pages %d\n",
+                    proc->pid, threads, nodes, incoming_refs, outgoing_refs,
+                    active_transactions, buffers, page_count);
 
        kfree(proc);
 }