diff options
author | Shaun Ruffell <sruffell@digium.com> | 2009-11-06 16:15:33 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2009-11-06 16:15:33 +0000 |
commit | 338650f9339903c8eab373c16408b6d5a6f910ef (patch) | |
tree | 685a72e751a59b6c23bef6e87aeb96d0228687e6 | |
parent | 11666be08bf60209c50cd505a78c1bfbc23cb423 (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-x | dahdi.init | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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 } |