summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tdm/xivo_tdm.c21
-rw-r--r--xhfc/base.c13
2 files changed, 24 insertions, 10 deletions
diff --git a/tdm/xivo_tdm.c b/tdm/xivo_tdm.c
index c814a4b..ba8d711 100644
--- a/tdm/xivo_tdm.c
+++ b/tdm/xivo_tdm.c
@@ -81,7 +81,8 @@ MODULE_PARM_DESC(dump_count, "number of traces to emit "
"(can be reset at runtime via /sys)");
#define DBG_TRACE(...) \
do { \
- if (dump_count-- > 0) { \
+ if (dump_count > 0) { \
+ dump_count--; \
printk(KERN_ERR __VA_ARGS__); \
} \
} while (0)
@@ -1568,14 +1569,26 @@ static int __init xivo_tdm_init(void)
return 0;
}
-static void __exit xivo_tdm_exit(void)
+static void xivo_tdm_pre_exit(void)
{
- printk(KERN_ERR "BUGBUG WARNING MEMORY LEAK YOU'LL DIE and probably "
- "crash too (triggered by module unload)\n");
+ static int pre_exit_done;
+
+ if (pre_exit_done) return;
+ pre_exit_done = 1; // race condition
tdm_register_trigger_hardirq_handler(NULL);
msleep(10); // BUGBUG racy hack
xivo_internal_cleanup();
+}
+EXPORT_SYMBOL(xivo_tdm_pre_exit);
+
+static void __exit xivo_tdm_exit(void)
+{
+ printk(KERN_ERR "BUGBUG WARNING MEMORY LEAK YOU'LL DIE and probably "
+ "crash too (triggered by module unload)\n");
+
+ xivo_tdm_pre_exit();
+
#ifdef DEBUGFS_MY_STUFF
hrtimer_cancel(&debug_timer);
diff --git a/xhfc/base.c b/xhfc/base.c
index b8c2ade..3455d4d 100644
--- a/xhfc/base.c
+++ b/xhfc/base.c
@@ -478,12 +478,6 @@ static int hdlc_tx_frame(struct xhfc_span *xhfc_span)
char debugbuf[MAX(256, HDLC_BUF_LEN * 3 + 1)];
int dbglen;
- /* ignoring TE red alarms: if TE and we are in alarm, restart the
- * S/T state machine... */
- if (!xhfc_span->nt && (xhfc_span->span.alarms != 0)) {
- activate_request(xhfc_span);
- }
-
fifo = dchan_fifo(xhfc_span);
res = dahdi_hdlc_getbuf(xhfc_span->sigchan, buf, &size);
@@ -557,6 +551,11 @@ static void xhfc_hdlc_hard_xmit(struct dahdi_chan *chan)
/* Increment the hdlc_pending counter and trigger hdlc_tx_frame */
if (xhfc_span->sigchan == chan)
atomic_inc(&xhfc_span->hdlc_pending);
+
+ /* If there is an alarm, try to activate layer1 before sending out
+ * anything (xref7) */
+ if (xhfc_span->span.alarms != 0)
+ activate_request(xhfc_span);
}
/*****************************************************************************
@@ -602,6 +601,8 @@ static irqreturn_t xhfc_interrupt(int irq, void *dev_id)
for (i = 0; i < SPANS_PER_CHIP; i++) {
struct xhfc_span* s = &xhfc->spans[i];
+ /* If there is an alarm, wait for the port to go up before transmission
+ * (xref7) */
if ((s->span.flags & DAHDI_FLAG_RUNNING) &&
s->sigchan &&
s->span.alarms == DAHDI_ALARM_NONE) {