[svn-commits] sruffell: tools/trunk r7494 - /tools/trunk/dahdi.init

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 6 10:15:37 CST 2009


Author: sruffell
Date: Fri Nov  6 10:15:33 2009
New Revision: 7494

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7494
Log:
dahdi.init: Unload the dahdi_echocan modules last.

If the echocan factory is associated with a channel, the reference on the
echocan module will not be released until after the board driver is unloaded.

Modified:
    tools/trunk/dahdi.init

Modified: tools/trunk/dahdi.init
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/dahdi.init?view=diff&rev=7494&r1=7493&r2=7494
==============================================================================
--- tools/trunk/dahdi.init (original)
+++ tools/trunk/dahdi.init Fri Nov  6 10:15:33 2009
@@ -74,14 +74,26 @@
 	set -- $line
 	# $1: the original module, $2: size, $3: refcount, $4: deps list
 	mods=`echo $4 | tr , ' '`
+	ec_modules=""
 	# xpp_usb keeps the xpds below busy if an xpp hardware is
 	# connected. Hence must be removed before them:
 	case "$module" in xpd_*) mods="xpp_usb $mods";; esac
 	for mod in $mods; do
-		# run in a subshell, so it won't step over our vars:
+		(echo $mod | grep dahdi_echocan) > /dev/null 2>&1
+		if [ $? != 0 ]; then
+			# run in a subshell, so it won't step over our vars:
+			(unload_module $mod)
+		else
+			ec_modules="$mod $ec_modules"
+		fi
+                # TODO: the following is probably the error handling we want:
+                # if [ $? != 0 ]; then return 1; fi
+	done
+	# Now that all the other dependencies are unloaded, we can unload the
+	# dahdi_echocan modules.  The drivers that register spans may keep
+	# references on the echocan modules before they are unloaded.
+	for mod in $ec_modules; do
 		(unload_module $mod)
-		# TODO: the following is probably the error handling we want:
-		# if [ $? != 0 ]; then return 1; fi
 	done
 	rmmod $module
 }




More information about the svn-commits mailing list