[zaptel-commits] tzafrir: trunk r1397 - in /trunk/xpp: xpd.h xpp_zap.c xpp_zap.h

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Sep 4 17:11:48 MST 2006


Author: tzafrir
Date: Mon Sep  4 19:11:47 2006
New Revision: 1397

URL: http://svn.digium.com/view/zaptel?rev=1397&view=rev
Log:
SPAN_REGISTERED() should not rely on zaptel ZT_FLAG_REGISTERED since
zaptel set it before registration is finished.
(right: xpp needs to replicate zaptel's bookkeeping here).

Modified:
    trunk/xpp/xpd.h
    trunk/xpp/xpp_zap.c
    trunk/xpp/xpp_zap.h

Modified: trunk/xpp/xpd.h
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xpd.h?rev=1397&r1=1396&r2=1397&view=diff
==============================================================================
--- trunk/xpp/xpd.h (original)
+++ trunk/xpp/xpd.h Mon Sep  4 19:11:47 2006
@@ -264,6 +264,7 @@
 	xbus_t *xbus;			/* The XBUS we are connected to */
 
 	spinlock_t	lock;
+	atomic_t	zt_registered;	/* Am I fully registered with zaptel */
 	atomic_t	open_counter;	/* Number of open channels */
 
 	int		flags;

Modified: trunk/xpp/xpp_zap.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xpp_zap.c?rev=1397&r1=1396&r2=1397&view=diff
==============================================================================
--- trunk/xpp/xpp_zap.c (original)
+++ trunk/xpp/xpp_zap.c Mon Sep  4 19:11:47 2006
@@ -523,6 +523,7 @@
 		xpd->idletxhookstate[i] = FXS_LINE_ENABLED;	/* By default, don't send on hook */
 	}
 
+	atomic_set(&xpd->zt_registered, 0);
 	atomic_set(&xpd->open_counter, 0);
 
 	xpd->chans = kmalloc(sizeof(struct zt_chan)*xpd->channels, GFP_KERNEL);
@@ -1295,6 +1296,7 @@
 		spin_unlock_irqrestore(&xpd->lock, flags);
 		return -EIDRM;
 	}
+	atomic_dec(&xpd->zt_registered);
 	if(sync_master == xpd)
 		sync_master_is(NULL);			// FIXME: it's better to elect a new prince
 	update_xpd_status(xpd, ZT_ALARM_NOTOPEN);
@@ -1370,6 +1372,7 @@
 		ERR("%s/%s: Failed to zt_register span\n", xbus->busname, xpd->xpdname);
 		return -ENODEV;
 	}
+	atomic_inc(&xpd->zt_registered);
 	xpd->xops->card_zaptel_postregistration(xpd, 1);
 	return 0;
 }

Modified: trunk/xpp/xpp_zap.h
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xpp_zap.h?rev=1397&r1=1396&r2=1397&view=diff
==============================================================================
--- trunk/xpp/xpp_zap.h (original)
+++ trunk/xpp/xpp_zap.h Mon Sep  4 19:11:47 2006
@@ -50,6 +50,6 @@
 extern struct proc_dir_entry	*xpp_proc_toplevel;
 #endif
 
-#define	SPAN_REGISTERED(xpd)	((xpd)->span.flags & ZT_FLAG_REGISTERED)
+#define	SPAN_REGISTERED(xpd)	atomic_read(&(xpd)->zt_registered)
 
 #endif	/* XPP_ZAP_H */



More information about the zaptel-commits mailing list