[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-spancleanup r7037 - in /linux/tea...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Aug 18 10:01:46 CDT 2009
Author: sruffell
Date: Tue Aug 18 10:01:42 2009
New Revision: 7037
URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=7037
Log:
dahdi_span_ops: Move the echocan_create callback into the ops structure.
Modified:
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c
linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c
linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c?view=diff&rev=7037&r1=7036&r2=7037
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/dahdi-base.c Tue Aug 18 10:01:42 2009
@@ -513,6 +513,17 @@
else
return -ENOSYS;
}
+}
+
+static int dahdi_chan_echocan_create(struct dahdi_chan *chan,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p,
+ struct dahdi_echocan_state **ec)
+{
+ if (chan->span && chan->span->ops->echocan_create)
+ return chan->span->ops->echocan_create(chan, ecp, p, ec);
+ else
+ return -ENODEV;
}
/*!
@@ -5017,13 +5028,11 @@
ecp->tap_length = deftaps;
}
- ret = -ENODEV;
ec_current = NULL;
/* attempt to use the span's echo canceler; fall back to built-in
if it fails (but not if an error occurs) */
- if (chan->span && chan->span->echocan_create)
- ret = chan->span->echocan_create(chan, ecp, params, &ec);
+ ret = dahdi_chan_echocan_create(chan, ecp, params, &ec);
if ((ret == -ENODEV) && chan->ec_factory) {
/* try to get another reference to the module providing
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=7037&r1=7036&r2=7037
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcb4xxp/base.c Tue Aug 18 10:01:42 2009
@@ -140,8 +140,6 @@
#define CARD_HAS_EC(card) ((card)->card_type == B410P)
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static const struct dahdi_echocan_features my_ec_features = {
@@ -2070,11 +2068,16 @@
}
}
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
+static int b4xxp_echocan_create(struct dahdi_chan *chan,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p,
+ struct dahdi_echocan_state **ec)
{
struct b4xxp_span *bspan = container_of(chan->span, struct b4xxp_span, span);
int channel;
+
+ if (!vpmsupport || !CARD_HAS_EC(bspan->parent))
+ return -ENODEV;
if (chan->chanpos == 3) {
printk(KERN_WARNING "Cannot enable echo canceller on D channel of span %d; failing request\n", chan->span->offset);
@@ -2303,6 +2306,7 @@
.close = b4xxp_close,
.ioctl = b4xxp_ioctl,
.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit,
+ .echocan_create = b4xxp_echocan_create,
};
/* initialize the span/chan structures. Doesn't touch hardware, although the callbacks might. */
@@ -2340,9 +2344,6 @@
bspan->span.owner = THIS_MODULE;
bspan->span.ops = &b4xxp_span_ops;
- if (vpmsupport && CARD_HAS_EC(b4))
- bspan->span.echocan_create = echocan_create;
-
/* HDLC stuff */
bspan->sigchan = NULL;
bspan->sigactive = 0;
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c?view=diff&rev=7037&r1=7036&r2=7037
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wct4xxp/base.c Tue Aug 18 10:01:42 2009
@@ -351,8 +351,6 @@
static void t4_vpm450_init(struct t4 *wc);
static void t4_vpm_set_dtmf_threshold(struct t4 *wc, unsigned int threshold);
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static const struct dahdi_echocan_features vpm400m_ec_features = {
@@ -1116,8 +1114,10 @@
return unit;
}
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
+static int t4_echocan_create(struct dahdi_chan *chan,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p,
+ struct dahdi_echocan_state **ec)
{
struct t4 *wc = chan->pvt;
struct t4_span *tspan = container_of(chan->span, struct t4_span, span);
@@ -1125,7 +1125,7 @@
const struct dahdi_echocan_ops *ops;
const struct dahdi_echocan_features *features;
- if (!wc->vpm)
+ if (!vpmsupport || !wc->vpm)
return -ENODEV;
if (chan->span->offset >= vpmspans)
@@ -1611,6 +1611,9 @@
.ioctl = t4_ioctl,
.hdlc_hard_xmit = t4_hdlc_hard_xmit,
.dacs = t4_dacs,
+#ifdef VPM_SUPPORT
+ .echocan_create = t4_echocan_create,
+#endif
};
static void init_spans(struct t4 *wc)
@@ -1681,10 +1684,6 @@
init_waitqueue_head(&ts->span.maintq);
if (gen2) {
-#ifdef VPM_SUPPORT
- if (vpmsupport)
- ts->span.echocan_create = echocan_create;
-#endif
ts->span.ops = &t4_gen2_span_ops;
} else {
ts->span.ops = &t4_gen1_span_ops;
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7037&r1=7036&r2=7037
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wctdm24xxp/base.c Tue Aug 18 10:01:42 2009
@@ -217,8 +217,6 @@
static int vpmnlpthresh = DEFAULT_NLPTHRESH;
static int vpmnlpmaxsupp = DEFAULT_NLPMAXSUPP;
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static const struct dahdi_echocan_features vpm100m_ec_features = {
@@ -1676,13 +1674,19 @@
}
}
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
+static int wctdm_echocan_create(struct dahdi_chan *chan,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p,
+ struct dahdi_echocan_state **ec)
{
struct wctdm *wc = chan->pvt;
const struct dahdi_echocan_ops *ops;
const struct dahdi_echocan_features *features;
+#ifdef VPM_SUPPORT
+ if (!vpmsupport)
+ return -ENODEV;
+#endif
if (!wc->vpm100 && !wc->vpmadt032)
return -ENODEV;
@@ -3271,6 +3275,9 @@
.ioctl = wctdm_ioctl,
.watchdog = wctdm_watchdog,
.dacs = wctdm_dacs,
+#ifdef VPM_SUPPORT
+ .echocan_create = wctdm_echocan_create,
+#endif
};
static int wctdm_initialize(struct wctdm *wc)
@@ -3307,10 +3314,6 @@
wc->span.irq = pdev->irq;
wc->span.flags = DAHDI_FLAG_RBS;
wc->span.ops = &wctdm24xxp_span_ops;
-#ifdef VPM_SUPPORT
- if (vpmsupport)
- wc->span.echocan_create = echocan_create;
-#endif
init_waitqueue_head(&wc->span.maintq);
return 0;
Modified: linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7037&r1=7036&r2=7037
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/drivers/dahdi/wcte12xp/base.c Tue Aug 18 10:01:42 2009
@@ -65,8 +65,6 @@
int vpmnlpthresh = DEFAULT_NLPTHRESH;
int vpmnlpmaxsupp = DEFAULT_NLPMAXSUPP;
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
static const struct dahdi_echocan_features vpm150m_ec_features = {
@@ -1149,11 +1147,13 @@
return 0;
}
-static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
+static int t1xxp_echocan_create(struct dahdi_chan *chan,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p,
+ struct dahdi_echocan_state **ec)
{
struct t1 *wc = chan->pvt;
- if (!wc->vpmadt032) {
+ if (!vpmsupport || !wc->vpmadt032) {
return -ENODEV;
}
return vpmadt032_echocan_create(wc->vpmadt032, chan->chanpos - 1,
@@ -1179,6 +1179,9 @@
.open = t1xxp_open,
.close = t1xxp_close,
.ioctl = t1xxp_ioctl,
+#ifdef VPM_SUPPORT
+ .echocan_create = t1xxp_echocan_create,
+#endif
};
static int t1_software_init(struct t1 *wc)
@@ -1218,10 +1221,6 @@
wc->span.owner = THIS_MODULE;
wc->span.irq = dev->irq;
-#ifdef VPM_SUPPORT
- if (vpmsupport)
- wc->span.echocan_create = echocan_create;
-#endif
if (wc->spantype == TYPE_E1) {
if (unchannelized)
Modified: linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h?view=diff&rev=7037&r1=7036&r2=7037
==============================================================================
--- linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-spancleanup/include/dahdi/kernel.h Tue Aug 18 10:01:42 2009
@@ -797,6 +797,12 @@
/*! Opt: Dacs the contents of chan2 into chan1 if possible */
int (*dacs)(struct dahdi_chan *chan1, struct dahdi_chan *chan2);
+
+ /*! Opt: Provide echo cancellation on a channel */
+ int (*echocan_create)(struct dahdi_chan *chan,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p,
+ struct dahdi_echocan_state **ec);
};
@@ -835,10 +841,6 @@
struct dahdi_chan **chans; /*!< Member channel structures */
const struct dahdi_span_ops *ops; /*!< span callbacks. */
-
- /*! Opt: Provide echo cancellation on a channel */
- int (*echocan_create)(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
- struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
/* Used by DAHDI only -- no user servicable parts inside */
int spanno; /*!< Span number for DAHDI */
More information about the dahdi-commits
mailing list