From 2136804d4a5c49bd61a877e5e761f85211016786 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Sat, 3 Apr 2010 00:03:58 +0000 Subject: wcte12xp: Use our own workqueue for the timer and maint events. When the latency is large and register reads can take 100s of milliseconds, the alarm polling function could tie up one of the global workqueue threads long enough to interfere with other system operations. Most noticeably the console. DAHDI-573 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8455 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wcte12xp/base.c | 13 ++++++++++--- drivers/dahdi/wcte12xp/wcte12xp.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 294a0f8..a1f1c42 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -696,6 +696,7 @@ static void free_wc(struct t1 *wc) list_del_init(&cmd->node); free_cmd(wc, cmd); } + destroy_workqueue(wc->wq); kfree(wc); } @@ -1263,7 +1264,7 @@ static int t1xxp_maint(struct dahdi_span *span, int cmd) #else INIT_WORK(&work->work, t1xxp_maint_work); #endif - schedule_work(&work->work); + queue_work(wc->wq, &work->work); return 0; } @@ -1924,7 +1925,7 @@ static void te12xp_timer(unsigned long data) { struct t1 *wc = (struct t1 *)data; - schedule_work(&wc->timer_work); + queue_work(wc->wq, &wc->timer_work); return; } @@ -1995,6 +1996,12 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi return res; } + wc->wq = create_singlethread_workqueue(wc->name); + if (!wc->wq) { + kfree(wc); + return -ENOMEM; + } + if (VOICEBUS_DEFAULT_LATENCY != latency) { voicebus_set_minlatency(&wc->vb, latency); voicebus_set_maxlatency(&wc->vb, max_latency); @@ -2049,7 +2056,7 @@ static void __devexit te12xp_remove_one(struct pci_dev *pdev) #endif clear_bit(INITIALIZED, &wc->bit_flags); del_timer_sync(&wc->timer); - flush_scheduled_work(); + flush_workqueue(wc->wq); del_timer_sync(&wc->timer); voicebus_release(&wc->vb); diff --git a/drivers/dahdi/wcte12xp/wcte12xp.h b/drivers/dahdi/wcte12xp/wcte12xp.h index 0ec3c3a..f7cae2f 100644 --- a/drivers/dahdi/wcte12xp/wcte12xp.h +++ b/drivers/dahdi/wcte12xp/wcte12xp.h @@ -135,6 +135,7 @@ struct t1 { struct list_head active_cmds; struct timer_list timer; struct work_struct timer_work; + struct workqueue_struct *wq; }; #define t1_info(t1, format, arg...) \ -- cgit v1.2.3