summaryrefslogtreecommitdiff
path: root/xpp/xpp_zap.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-09-04 22:51:19 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-09-04 22:51:19 +0000
commit393ca276af8b3f2610ae82b1971fa0b5d2abb336 (patch)
tree5bea87c21db1086eb6c8644c47bfb05a1497e55c /xpp/xpp_zap.c
parent9a69492b7a4fb3840bff33b59b81fac1d0b46f93 (diff)
Move all zt_hooksig(...{OFF,ON}HOOK) calls into update_line_status()
in xpp_zap.c git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1390 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r--xpp/xpp_zap.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c
index 02604f5..b805075 100644
--- a/xpp/xpp_zap.c
+++ b/xpp/xpp_zap.c
@@ -619,7 +619,7 @@ void update_xpd_status(xpd_t *xpd, int alarm_flag)
DBG("Update XPD alarms: %s -> %02X\n", xpd->span.name, alarm_flag);
}
-void update_line_status(xpd_t *xpd, int pos, bool good)
+void update_line_status(xpd_t *xpd, int pos, bool to_offhook)
{
struct zt_chan *chan;
@@ -627,14 +627,20 @@ void update_line_status(xpd_t *xpd, int pos, bool good)
if(!SPAN_REGISTERED(xpd))
return;
chan = &xpd->chans[pos];
- if(good)
+ /*
+ * We should not spinlock before calling zt_hooksig() as
+ * it may call back into our xpp_hooksig() and cause
+ * a nested spinlock scenario
+ */
+ if(to_offhook) {
+ BIT_SET(xpd->hookstate, pos);
zt_hooksig(chan, ZT_RXSIG_OFFHOOK);
- else
+ } else {
+ BIT_CLR(xpd->hookstate, pos);
zt_hooksig(chan, ZT_RXSIG_ONHOOK);
+ }
}
-#define RING_TIME 15 /* in ticks */
-
void update_zap_ring(xpd_t *xpd, int pos, bool on)
{
struct zt_chan *chan;
@@ -643,6 +649,11 @@ void update_zap_ring(xpd_t *xpd, int pos, bool on)
if(!SPAN_REGISTERED(xpd))
return;
chan = &xpd->chans[pos];
+ /*
+ * We should not spinlock before calling zt_hooksig() as
+ * it may call back into our xpp_hooksig() and cause
+ * a nested spinlock scenario
+ */
if(on)
zt_hooksig(chan, ZT_RXSIG_RING);
else