summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2009-11-06 16:15:33 +0000
committerShaun Ruffell <sruffell@digium.com>2009-11-06 16:15:33 +0000
commit338650f9339903c8eab373c16408b6d5a6f910ef (patch)
tree685a72e751a59b6c23bef6e87aeb96d0228687e6
parent11666be08bf60209c50cd505a78c1bfbc23cb423 (diff)
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. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7494 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rwxr-xr-xdahdi.init18
1 files changed, 15 insertions, 3 deletions
diff --git a/dahdi.init b/dahdi.init
index 297fb6d..7fb16cc 100755
--- a/dahdi.init
+++ b/dahdi.init
@@ -74,14 +74,26 @@ unload_module() {
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
}