summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-07 19:39:05 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-07 19:39:05 +0000
commit859ac8f1259c493d2e935c4dcdaf2b62bba7e6bc (patch)
tree32c7b75cf190c5b5b4147d76171f9a413dab78d0
parenta4d177fa6d89c5cd8cb9ef2339302a6d0a860d3f (diff)
as suggested by tzafrir on asterisk-dev, remove some code duplication when handling ZT_SPANCONFIG
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3343 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--tor2.c7
-rw-r--r--torisa.c7
-rw-r--r--wct1xxp.c6
-rw-r--r--wct4xxp/base.c6
-rw-r--r--wcte11xp.c6
-rw-r--r--wcte12xp.c4
-rw-r--r--zaptel-base.c8
7 files changed, 16 insertions, 28 deletions
diff --git a/tor2.c b/tor2.c
index 4e10b12..ef2cf05 100644
--- a/tor2.c
+++ b/tor2.c
@@ -202,11 +202,7 @@ static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
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 @@ static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
/* If we're already running, then go ahead and apply the changes */
if (span->flags & ZT_FLAG_RUNNING)
return tor2_startup(span);
+
return 0;
}
diff --git a/torisa.c b/torisa.c
index aee3758..a8fb9d3 100644
--- a/torisa.c
+++ b/torisa.c
@@ -603,11 +603,7 @@ static int torisa_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
{
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 @@ static int torisa_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
/* If we're already running, then go ahead and apply the changes */
if (span->flags & ZT_FLAG_RUNNING)
return torisa_startup(span);
+
return 0;
}
diff --git a/wct1xxp.c b/wct1xxp.c
index 145893e..ce76ad9 100644
--- a/wct1xxp.c
+++ b/wct1xxp.c
@@ -737,15 +737,13 @@ static int t1xxp_chanconfig(struct zt_chan *chan, int sigtype)
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)
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 9f0a3f1..45a8d32 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -1414,11 +1414,7 @@ static int t4_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
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)
diff --git a/wcte11xp.c b/wcte11xp.c
index f63f725..d5720a1 100644
--- a/wcte11xp.c
+++ b/wcte11xp.c
@@ -945,15 +945,13 @@ static int t1xxp_chanconfig(struct zt_chan *chan, int sigtype)
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;
}
diff --git a/wcte12xp.c b/wcte12xp.c
index db4fb78..d993d76 100644
--- a/wcte12xp.c
+++ b/wcte12xp.c
@@ -1041,10 +1041,6 @@ 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 (wc->sync)
diff --git a/zaptel-base.c b/zaptel-base.c
index b1fb873..007e073 100644
--- a/zaptel-base.c
+++ b/zaptel-base.c
@@ -3312,8 +3312,14 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd
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);