From 655e1a6617fae46dda085df9d160260ba498e6fa Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 29 Jun 2010 09:41:22 +0000 Subject: 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 --- build_tools/live_dahdi | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'build_tools') 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 } -- cgit v1.2.3