summaryrefslogtreecommitdiff
path: root/wct4xxp.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-24 18:59:30 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-24 18:59:30 +0000
commitc5b95f77b5ca4d802a252eaef278d8c4f4afa5c4 (patch)
tree9fd52680bbc53200c2374b52087c79796d8809b5 /wct4xxp.c
parentfac8009465dc826829fb2590a1002288154d6c8a (diff)
Don't double lock reglock
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@372 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp.c')
-rwxr-xr-xwct4xxp.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/wct4xxp.c b/wct4xxp.c
index 9785c53..2bbef11 100755
--- a/wct4xxp.c
+++ b/wct4xxp.c
@@ -392,8 +392,8 @@ static int t4_rbsbits(struct zt_chan *chan, int bits)
struct t4 *wc = chan->pvt;
unsigned long flags;
- spin_lock_irqsave(&wc->reglock, flags);
if(debug) printk("Setting bits to %d on channel %s\n", bits, chan->name);
+ spin_lock_irqsave(&wc->reglock, flags);
k = chan->span->offset;
if (wc->spantype[k] == TYPE_E1) { /* do it E1 way */
if (chan->chanpos == 16) {
@@ -432,9 +432,9 @@ static int t4_rbsbits(struct zt_chan *chan, int bits)
/* output them to the chip */
__t4_framer_out(wc,k,0x70 + b,c);
}
+ spin_unlock_irqrestore(&wc->reglock, flags);
if (debug)
printk("Finished setting RBS bits\n");
- spin_unlock_irqrestore(&wc->reglock, flags);
return 0;
}
@@ -487,10 +487,13 @@ static int t4_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
span->lineconfig = lc->lineconfig;
span->txlevel = lc->lbo;
span->rxlevel = 0;
- span->syncsrc = wc->syncsrc;
+ if (lc->sync < 0)
+ lc->sync = 0;
+ if (lc->sync > 4)
+ lc->sync = 0;
/* remove this span number from the current sync sources, if there */
- for(i = 0; i < 3; i++) {
+ for(i = 0; i < 4; i++) {
if (wc->syncs[i] == span->spanno) {
wc->syncs[i] = 0;
wc->psyncs[i] = 0;
@@ -502,6 +505,7 @@ static int t4_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
wc->syncs[lc->sync - 1] = span->spanno;
wc->psyncs[lc->sync - 1] = span->offset + 1;
}
+ wc->checktiming = 1;
/* If we're already running, then go ahead and apply the changes */
if (span->flags & ZT_FLAG_RUNNING)
return t4_startup(span);
@@ -637,12 +641,12 @@ static void __t4_set_timing_source(struct t4 *wc, int unit)
if ((unit > -1) && (unit < 4)) {
timing |= (unit << 6);
for (x=0;x<4;x++) /* set all 4 receive reference clocks to unit */
- t4_framer_out(wc, x, 0x44, timing);
- t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
+ __t4_framer_out(wc, x, 0x44, timing);
+ __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl | (1 << 29));
} else {
for (x=0;x<4;x++) /* set each receive reference clock to itself */
- t4_framer_out(wc, x, 0x44, timing | (x << 6));
- t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
+ __t4_framer_out(wc, x, 0x44, timing | (x << 6));
+ __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl);
}
#if 0
printk("wct4xxp: Timing source set to %d\n",unit);
@@ -1420,6 +1424,7 @@ static int t4_hardware_init(struct t4 *wc)
static int __devinit t4_launch(struct t4 *wc)
{
int x;
+ unsigned long flags;
if (wc->spans[0].flags & ZT_FLAG_REGISTERED)
return 0;
printk("TE410P: Launching card: %d\n", wc->order);
@@ -1455,7 +1460,9 @@ static int __devinit t4_launch(struct t4 *wc)
if (debug)
printk("Timing source selected\n");
wc->checktiming = 1;
+ spin_lock_irqsave(&wc->reglock, flags);
__t4_set_timing_source(wc,4);
+ spin_unlock_irqrestore(&wc->reglock, flags);
#ifdef ENABLE_TASKLETS
tasklet_init(&wc->t4_tlet, t4_tasklet, (unsigned long)wc);
#endif