From 11f0e72cb7cc4bc0db2a816668c8e07399e26b28 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 20 Jun 2011 16:01:59 +0000 Subject: wcte12xp: Start alarm timer after marking board initialized. r9946, "wcte12xp: Move the VPMADT032 test/configuration to module load time." introduced a race condition where it was possible for the timer that initiates the check for the alarms to fire before the board was marked initialized. This would result in a board that would never again check it's alarm state since the first time the timer runs INITIALIZED may not be set and it will not reschedule a check since it believes the driver is unloading. This happened because the check for the VPM was moved between when the timer was first setup and when INITIALIZED was then set. Now we make sure INITIALIZED is set before the timer is first setup, and move those two operations together. Signed-off-by: Shaun Ruffell Acked-by: Russ Meyerriecks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9981 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wcte12xp/base.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/dahdi/wcte12xp') diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 3139484..a524482 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -1666,8 +1666,6 @@ static int t1_software_init(struct t1 *wc) return -1; } - set_bit(INITIALIZED, &wc->bit_flags); - return 0; } @@ -2454,8 +2452,16 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi } } + res = t1_software_init(wc); + if (res) { + voicebus_release(&wc->vb); + free_wc(wc); + return res; + } + + set_bit(INITIALIZED, &wc->bit_flags); mod_timer(&wc->timer, jiffies + HZ/5); - t1_software_init(wc); + t1_info(wc, "Found a %s\n", wc->variety); voicebus_unlock_latency(&wc->vb); -- cgit v1.2.3