--- wct4xxp.c 2007-04-18 09:53:02.429418300 +0300 +++ zaptel-1.0.10/wct4xxp.c 2007-04-18 09:55:11.616091500 +0300 @@ -296,7 +296,7 @@ volatile unsigned int *membase; /* Base address of card */ int spansstarted; /* number of spans started */ /* spinlock_t lock; */ /* lock context */ - spinlock_t reglock; /* lock register access */ + spinlock_t reglock; /* lock register access */ volatile unsigned int *writechunk; /* Double-word aligned write memory */ volatile unsigned int *readchunk; /* Double-word aligned read memory */ unsigned short canary; @@ -1705,13 +1705,19 @@ /* Get high channel in low bits */ rxs = (a & 0xf); if (!(ts->span.chans[i+16].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+16].rxsig != rxs) + if (ts->span.chans[i+16].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i+16], rxs); + spin_lock(&wc->reglock); + } } rxs = (a >> 4) & 0xf; if (!(ts->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i].rxsig != rxs) + if (ts->span.chans[i].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i], rxs); + spin_lock(&wc->reglock); + } } } } else if (ts->span.lineconfig & ZT_CONFIG_D4) { @@ -1720,23 +1726,35 @@ /* Get high channel in low bits */ rxs = (a & 0x3) << 2; if (!(ts->span.chans[i+3].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+3].rxsig != rxs) + if (ts->span.chans[i+3].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i+3], rxs); + spin_lock(&wc->reglock); + } } rxs = (a & 0xc); if (!(ts->span.chans[i+2].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+2].rxsig != rxs) + if (ts->span.chans[i+2].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i+2], rxs); + spin_lock(&wc->reglock); + } } rxs = (a >> 2) & 0xc; if (!(ts->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+1].rxsig != rxs) + if (ts->span.chans[i+1].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i+1], rxs); + spin_lock(&wc->reglock); + } } rxs = (a >> 4) & 0xc; if (!(ts->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i].rxsig != rxs) + if (ts->span.chans[i].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i], rxs); + spin_lock(&wc->reglock); + } } } } else { @@ -1747,14 +1765,18 @@ if (!(ts->span.chans[i+1].sig & ZT_SIG_CLEAR)) { /* XXX Not really reset on every trans! XXX */ if (ts->span.chans[i+1].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i+1], rxs); + spin_lock(&wc->reglock); } } rxs = (a >> 4) & 0xf; if (!(ts->span.chans[i].sig & ZT_SIG_CLEAR)) { /* XXX Not really reset on every trans! XXX */ if (ts->span.chans[i].rxsig != rxs) { + spin_unlock(&wc->reglock); zt_rbsbits(&ts->span.chans[i], rxs); + spin_lock(&wc->reglock); } } } @@ -1880,7 +1902,9 @@ if (ts->span.mainttimer || ts->span.maintstat) alarms |= ZT_ALARM_LOOPBACK; ts->span.alarms = alarms; + spin_unlock(&wc->reglock); zt_alarm_notify(&ts->span); + spin_lock(&wc->reglock); } static void __t4_do_counters(struct t4 *wc) @@ -1893,7 +1917,9 @@ ts->span.alarms &= ~(ZT_ALARM_RECOVER); if (!polling) __t4_check_alarms(wc, span); + spin_unlock(&wc->reglock); zt_alarm_notify(&ts->span); + spin_lock(&wc->reglock); } } } @@ -1963,7 +1989,7 @@ #ifdef SUPPORT_GEN1 #ifdef LINUX26 -static irqreturn_t t4_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t t4_interrupt(int irq, void *dev_id) #else static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs) #endif @@ -2120,7 +2146,7 @@ } #ifdef LINUX26 -static irqreturn_t t4_interrupt_gen2(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t t4_interrupt_gen2(int irq, void *dev_id) #else static void t4_interrupt_gen2(int irq, void *dev_id, struct pt_regs *regs) #endif