[zaptel-commits] kpfleming: branch 1.4 r3343 - in /branches/1.4: ./ wct4xxp/

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Fri Dec 7 13:39:06 CST 2007


Author: kpfleming
Date: Fri Dec  7 13:39:05 2007
New Revision: 3343

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3343
Log:
as suggested by tzafrir on asterisk-dev, remove some code duplication when handling ZT_SPANCONFIG

Modified:
    branches/1.4/tor2.c
    branches/1.4/torisa.c
    branches/1.4/wct1xxp.c
    branches/1.4/wct4xxp/base.c
    branches/1.4/wcte11xp.c
    branches/1.4/wcte12xp.c
    branches/1.4/zaptel-base.c

Modified: branches/1.4/tor2.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/tor2.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/tor2.c (original)
+++ branches/1.4/tor2.c Fri Dec  7 13:39:05 2007
@@ -202,11 +202,7 @@
 
 	if (debug)
 		printk("Tor2: Configuring span %d\n", span->spanno);
-	/* XXX We assume lineconfig is okay and shouldn't XXX */	
-	span->lineconfig = lc->lineconfig;
-	span->lbo = lc->lbo;
-	span->txlevel = lc->lbo;
-	span->rxlevel = 0;
+
 	span->syncsrc = p->tor->syncsrc;
 	
 	/* remove this span number from the current sync sources, if there */
@@ -225,6 +221,7 @@
 	/* If we're already running, then go ahead and apply the changes */
 	if (span->flags & ZT_FLAG_RUNNING)
 		return tor2_startup(span);
+
 	return 0;
 }
 

Modified: branches/1.4/torisa.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/torisa.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/torisa.c (original)
+++ branches/1.4/torisa.c Fri Dec  7 13:39:05 2007
@@ -603,11 +603,7 @@
 {
 	if (debug)
 		printk("TorISA: Configuring span %d\n", span->spanno);
-	/* XXX We assume lineconfig is okay and shouldn't XXX */	
-	span->lineconfig = lc->lineconfig;
-	span->lbo = lc->lbo;
-	span->txlevel = lc->lbo;
-	span->rxlevel = 0;
+
 	span->syncsrc = syncsrc;
 	
 	/* remove this span number from the current sync sources, if there */
@@ -619,6 +615,7 @@
 	/* If we're already running, then go ahead and apply the changes */
 	if (span->flags & ZT_FLAG_RUNNING)
 		return torisa_startup(span);
+
 	return 0;
 }
 

Modified: branches/1.4/wct1xxp.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wct1xxp.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/wct1xxp.c (original)
+++ branches/1.4/wct1xxp.c Fri Dec  7 13:39:05 2007
@@ -737,15 +737,13 @@
 static int t1xxp_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
 {
 	struct t1xxp *wc = span->pvt;
-	span->lineconfig = lc->lineconfig;
-	span->lbo = lc->lbo;
-	span->txlevel = lc->lbo;
-	span->rxlevel = 0;
+
 	/* Do we want to SYNC on receive or not */
 	wc->sync = lc->sync;
 	/* If already running, apply changes immediately */
 	if (span->flags & ZT_FLAG_RUNNING)
 		return t1xxp_startup(span);
+
 	return 0;
 }
 static int t1xxp_software_init(struct t1xxp *wc)

Modified: branches/1.4/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wct4xxp/base.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/wct4xxp/base.c (original)
+++ branches/1.4/wct4xxp/base.c Fri Dec  7 13:39:05 2007
@@ -1414,11 +1414,7 @@
 	printk("About to enter spanconfig!\n");
 	if (debug & DEBUG_MAIN)
 		printk("TE%dXXP: Configuring span %d\n", wc->numspans, span->spanno);
-	/* XXX We assume lineconfig is okay and shouldn't XXX */	
-	span->lineconfig = lc->lineconfig;
-	span->lbo = lc->lbo;
-	span->txlevel = lc->lbo;
-	span->rxlevel = 0;
+
 	if (lc->sync < 0)
 		lc->sync = 0;
 	if (lc->sync > 4)

Modified: branches/1.4/wcte11xp.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcte11xp.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/wcte11xp.c (original)
+++ branches/1.4/wcte11xp.c Fri Dec  7 13:39:05 2007
@@ -945,15 +945,13 @@
 static int t1xxp_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
 {
 	struct t1 *wc = span->pvt;
-	span->lineconfig = lc->lineconfig;
-	span->lbo = lc->lbo;
-	span->txlevel = lc->lbo;
-	span->rxlevel = 0;
+
 	/* Do we want to SYNC on receive or not */
 	wc->sync = lc->sync;
 	/* If already running, apply changes immediately */
 	if (span->flags & ZT_FLAG_RUNNING)
 		return t1xxp_startup(span);
+
 	return 0;
 }
 

Modified: branches/1.4/wcte12xp.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wcte12xp.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/wcte12xp.c (original)
+++ branches/1.4/wcte12xp.c Fri Dec  7 13:39:05 2007
@@ -1041,10 +1041,6 @@
 {
 	struct t1 *wc = span->pvt;
 
-	span->lineconfig = lc->lineconfig;
-	span->lbo = lc->lbo;
-	span->txlevel = lc->lbo;
-	span->rxlevel = 0;
 	/* Do we want to SYNC on receive or not */
 	wc->sync = lc->sync;
 	if (wc->sync)

Modified: branches/1.4/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel-base.c?view=diff&rev=3343&r1=3342&r2=3343
==============================================================================
--- branches/1.4/zaptel-base.c (original)
+++ branches/1.4/zaptel-base.c Fri Dec  7 13:39:05 2007
@@ -3312,8 +3312,14 @@
 		VALID_SPAN(lc.span);
 		if ((lc.lineconfig & 0x07f0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0x07f0))
 			return -EINVAL;
-		if (spans[lc.span]->spanconfig)
+		if (spans[lc.span]->spanconfig) {
+			spans[lc.span]->lineconfig = lc.lineconfig;
+			spans[lc.span]->lbo = lc.lbo;
+			spans[lc.span]->txlevel = lc.lbo;
+			spans[lc.span]->rxlevel = 0;
+
 			return spans[lc.span]->spanconfig(spans[lc.span], &lc);
+		}
 		return 0;
 	case ZT_STARTUP:
 		CHECK_VALID_SPAN(j);




More information about the zaptel-commits mailing list