summaryrefslogtreecommitdiff
path: root/build_tools
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-06-29 09:41:22 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-06-29 09:41:22 +0000
commit655e1a6617fae46dda085df9d160260ba498e6fa (patch)
treebd951b4de51f2c967d44697273a14b672a795b5e /build_tools
parent32a645fba40e73c43d1cdadaa8a587ecd52aa58a (diff)
live_dahdi: properly unload EC modules
Copy sruffel's fix to the init.d script from -tools. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8818 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/live_dahdi21
1 files changed, 17 insertions, 4 deletions
diff --git a/build_tools/live_dahdi b/build_tools/live_dahdi
index 19a437c..f31cb7f 100755
--- a/build_tools/live_dahdi
+++ b/build_tools/live_dahdi
@@ -132,14 +132,27 @@ 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:
- (unload_module $mod)
- # TODO: the following is probably the error handling we want:
- # if [ $? != 0 ]; then return 1; fi
+ case "$mod" in
+ dahdi_echocan_*)
+ ec_modules="$mod $ec_modules"
+ ;;
+ *)
+ # run in a subshell, so it won't step over our vars:
+ (unload_module $mod)
+ ;;
+ esac
+ 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)
done
rmmod $module
}