summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2008-10-14 22:11:45 +0000
committerShaun Ruffell <sruffell@digium.com>2008-10-14 22:11:45 +0000
commitfdaba144813046745154ec3425705a80e2ca5eb6 (patch)
treec7061c14d644a3fdc3aa12978fbf92df1d535238
parentbec5a7d023adf009bcb996f068e2cf743dfabfa6 (diff)
If the vpmad032 firmware needs to be reloaded, make sure we use the same slot
in the ifaces array. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@5090 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wcte12xp/base.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 086c3f2..ee65acc 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -1582,11 +1582,16 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
unsigned int x;
int res;
int startinglatency;
+ unsigned int index = -1;
- for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++)
- if (!ifaces[x]) break;
+ for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) {
+ if (!ifaces[x]) {
+ index = x;
+ break;
+ }
+ }
- if (x >= sizeof(ifaces) / sizeof(ifaces[0])) {
+ if (-1 == index) {
module_printk("Too many interfaces\n");
return -EIO;
}
@@ -1596,18 +1601,19 @@ retry:
return -ENOMEM;
}
- ifaces[x] = wc;
+ ifaces[index] = wc;
memset(wc, 0, sizeof(*wc));
spin_lock_init(&wc->reglock);
wc->variety = d->name;
wc->txident = 1;
init_waitqueue_head(&wc->regq);
- snprintf(wc->name, sizeof(wc->name)-1, "wcte12xp%d", x);
+ snprintf(wc->name, sizeof(wc->name)-1, "wcte12xp%d", index);
if ((res = voicebus_init(pdev, SFRAME_SIZE, wc->name,
t1_handle_receive, t1_handle_transmit, wc, &wc->vb))) {
WARN_ON(1);
kfree(wc);
+ ifaces[index] = NULL;
return res;
}
@@ -1627,6 +1633,7 @@ retry:
}
kfree(wc);
+ ifaces[index] = NULL;
return -ENOMEM;
}
memset(wc->chans[x], 0, sizeof(*wc->chans[x]));