[dahdi-commits] kpfleming: branch linux/kpfleming/modular_ec r4425 - /linux/team/kpfleming/mo...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Jun 20 10:42:44 CDT 2008


Author: kpfleming
Date: Fri Jun 20 10:42:43 2008
New Revision: 4425

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4425
Log:
fix some very broken code

Modified:
    linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c

Modified: linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c?view=diff&rev=4425&r1=4424&r2=4425
==============================================================================
--- linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/kpfleming/modular_ec/drivers/dahdi/dahdi-base.c Fri Jun 20 10:42:43 2008
@@ -3607,6 +3607,34 @@
 			res =  spans[j]->shutdown(spans[j]);
 		spans[j]->flags &= ~DAHDI_FLAG_RUNNING;
 		return 0;
+	case DAHDI_ATTACH_ECHOCAN:
+	{
+		struct dahdi_attach_echocan ae;
+		const struct dahdi_echocan *new = NULL, *old;
+
+		if (copy_from_user(&ae, (struct dahdi_attach_echocan *) data, sizeof(ae))) {
+			return -EFAULT;
+		}
+
+		VALID_CHANNEL(ae.chan);
+
+		if (ae.echocan[0]) {
+			if (!(new = find_echocan(ae.echocan))) {
+				return -EINVAL;
+			}
+		}
+
+		spin_lock_irqsave(&chans[ae.chan]->lock, flags);
+		old = chans[ae.chan]->ec_factory;
+		chans[ae.chan]->ec_factory = new;
+		spin_unlock_irqrestore(&chans[ae.chan]->lock, flags);
+
+		if (old) {
+			release_echocan(old);
+		}
+
+		break;
+	}
 	case DAHDI_CHANCONFIG:
 	{
 		struct dahdi_chanconfig ch;
@@ -4638,7 +4666,7 @@
 			ret = chan->span->echocan(chan, ecp->tap_length);
 	}
 	
-	if (ret == -ENODEV) {
+	if ((ret == -ENODEV) && chan->ec_factory) {
 		const struct dahdi_echocan *ec_current;
 
 		switch (ecp->tap_length) {
@@ -4865,38 +4893,6 @@
 			fasthdlc_init(&chan->txhdlc);
 		}
 		break;
-	case DAHDI_ATTACH_ECHOCAN:
-	{
-		struct dahdi_attach_echocan ae;
-		const struct dahdi_echocan *new = NULL, *old;
-
-		if (!(chan->flags & DAHDI_FLAG_AUDIO)) {
-			return -EINVAL;
-		}
-
-		if (copy_from_user(&ae, (struct dahdi_attach_echocan *) data, sizeof(ae))) {
-			return -EFAULT;
-		}
-
-		VALID_CHANNEL(ae.chan);
-
-		if (ae.echocan[0]) {
-			if (!(new = find_echocan(ae.echocan))) {
-				return -EINVAL;
-			}
-		}
-
-		spin_lock_irqsave(&chan->lock, flags);
-		old = chan->ec_factory;
-		chan->ec_factory = new;
-		spin_unlock_irqrestore(&chan->lock, flags);
-
-		if (old) {
-			release_echocan(old);
-		}
-
-		break;
-	}
 	case DAHDI_ECHOCANCEL_PARAMS:
 	{
 		struct dahdi_echocanparams ecp;




More information about the dahdi-commits mailing list