diff options
author | Russ Meyerriecks <rmeyerreicks@digium.com> | 2010-08-20 01:12:43 +0000 |
---|---|---|
committer | Russ Meyerriecks <rmeyerreicks@digium.com> | 2010-08-20 01:12:43 +0000 |
commit | f901a64f1d92615bf81fd43d85961cbe452240ed (patch) | |
tree | 413546140d355655b99c4f169aab64f8b43a3f2b | |
parent | 5dfe38a35ae56e3d58eb09bbc32a68f674c1aae2 (diff) |
dahdi: Uncross dest if dacs is not supported between two different chans.
This removes a confusing message introduced in 9120 when bridging channels on
two differnt cards. i.e.
"dahdi: unable to cross connect 'TE4/0/2/2' with 'WCTDM/0/0'"
"dahdi: unable to cross connect 'WCTDM/0/0' with 'TE4/0/2/2'"
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9168 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 8d4516c..8945841 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -82,6 +82,8 @@ #include "hpec/hpec_user.h" +#include <stdbool.h> + #if defined(EMPULSE) && defined(EMFLASH) #error "You cannot define both EMPULSE and EMFLASH" #endif @@ -507,6 +509,22 @@ static inline void rotate_sums(void) pos = (pos + 1) % 3; memset(conf_sums_next, 0, maxconfs * sizeof(sumtype)); } + + +/** + * can_dacs_chans() - Returns true if it may be possible to dacs two channels. + * + */ +static bool can_dacs_chans(struct dahdi_chan *dst, struct dahdi_chan *src) +{ + if (src && dst && src->span && dst->span && src->span->ops && + dst->span->ops && src->span->ops->dacs && + (src->span->ops->dacs == dst->span->ops->dacs)) + return true; + else + return false; +} + /** * dahdi_chan_dacs() - Cross (or uncross) connect two channels. * @dst: Channel on which to transmit the src data. @@ -514,25 +532,17 @@ static inline void rotate_sums(void) * data. * * This allows those boards that support it to cross connect one channel to - * another in hardware. + * another in hardware. If the cards cannot be crossed, uncross the + * destination channel by default.. * */ static int dahdi_chan_dacs(struct dahdi_chan *dst, struct dahdi_chan *src) { int ret = 0; - if (src) { - if (dst->span && src->span && dst->span->ops->dacs && - (dst->span->ops->dacs == src->span->ops->dacs)) { - ret = dst->span->ops->dacs(dst, src); - } else { - module_printk(KERN_ERR, "Unable to cross connect '%s' " - "with '%s'\n", src->name, dst->name); - ret = -ENOSYS; - } - } else { - if (dst->span && dst->span->ops->dacs) - ret = dst->span->ops->dacs(dst, NULL); - } + if (can_dacs_chans(dst, src)) + ret = dst->span->ops->dacs(dst, src); + else if (dst->span && dst->span->ops->dacs) + ret = dst->span->ops->dacs(dst, NULL); return ret; } |