[dahdi-commits] rmeyerriecks: linux/trunk r9168 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Aug 19 20:12:47 CDT 2010


Author: rmeyerriecks
Date: Thu Aug 19 20:12:43 2010
New Revision: 9168

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9168
Log:
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'"

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9168&r1=9167&r2=9168
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Thu Aug 19 20:12:43 2010
@@ -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 @@
 	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 @@
  *		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;
 }
 




More information about the dahdi-commits mailing list