From 64fa454e9d4dc650553eaf1bfb2d8ef75c6a3ee6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Thu, 22 Apr 2010 15:53:23 -0700 Subject: [PATCH] Staging: android: binder: Create dedicated workqueue for binder deferred work MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some drivers flush the global workqueue when closed. This would deadlock if the last reference to the file was released from the binder. Change-Id: Ifdabc0b383fecb20836d1bbb9786c632402a14e1 Signed-off-by: Arve Hjønnevåg --- drivers/staging/android/binder.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 99010d4b3044..cd53c64f7395 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -46,6 +46,7 @@ static struct proc_dir_entry *binder_proc_dir_entry_proc; static struct binder_node *binder_context_mgr_node; static uid_t binder_context_mgr_uid = -1; static int binder_last_id; +static struct workqueue_struct *binder_deferred_workqueue; static int binder_read_proc_proc(char *page, char **start, off_t off, int count, int *eof, void *data); @@ -3099,7 +3100,7 @@ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) if (hlist_unhashed(&proc->deferred_work_node)) { hlist_add_head(&proc->deferred_work_node, &binder_deferred_list); - schedule_work(&binder_deferred_work); + queue_work(binder_deferred_workqueue, &binder_deferred_work); } mutex_unlock(&binder_deferred_lock); } @@ -3727,6 +3728,10 @@ static int __init binder_init(void) { int ret; + binder_deferred_workqueue = create_singlethread_workqueue("binder"); + if (!binder_deferred_workqueue) + return -ENOMEM; + binder_proc_dir_entry_root = proc_mkdir("binder", NULL); if (binder_proc_dir_entry_root) binder_proc_dir_entry_proc = proc_mkdir("proc", -- 2.34.1