diff mbox series

[blktests,3/5] check,common/rc: move _unload_module() from common/rc to check

Message ID 20220902034516.223173-4-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series improve _have_driver() module load issue solution | expand

Commit Message

Shinichiro Kawasaki Sept. 2, 2022, 3:45 a.m. UTC
To use in the 'check' script in the following commit, move the helper
function _unload_module() from 'common/rc' to 'check'.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 check     | 13 +++++++++++++
 common/rc | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/check b/check
index 85e0569..5f57386 100755
--- a/check
+++ b/check
@@ -439,6 +439,19 @@  _test_dev_is_zoned() {
 	   $(cat "${TEST_DEV_SYSFS}/queue/zoned") != none ]]
 }
 
+# Arguments: module to unload ($1) and retry count ($2).
+_unload_module() {
+	local i m=$1 rc=${2:-1}
+
+	[ ! -e "/sys/module/$m" ] && return 0
+	for ((i=rc;i>0;i--)); do
+		modprobe -r "$m"
+		[ ! -e "/sys/module/$m" ] && return 0
+		sleep .1
+	done
+	return 1
+}
+
 _run_test() {
 	TEST_NAME="$1"
 	CAN_BE_ZONED=0
diff --git a/common/rc b/common/rc
index 738a32f..9bc0dbc 100644
--- a/common/rc
+++ b/common/rc
@@ -384,19 +384,6 @@  _uptime_s() {
 	awk '{ print int($1) }' /proc/uptime
 }
 
-# Arguments: module to unload ($1) and retry count ($2).
-_unload_module() {
-	local i m=$1 rc=${2:-1}
-
-	[ ! -e "/sys/module/$m" ] && return 0
-	for ((i=rc;i>0;i--)); do
-		modprobe -r "$m"
-		[ ! -e "/sys/module/$m" ] && return 0
-		sleep .1
-	done
-	return 1
-}
-
 _have_writeable_kmsg() {
 	if [[ ! -w /dev/kmsg ]]; then
 		SKIP_REASONS+=("cannot write to /dev/kmsg")