]> www.infradead.org Git - users/hch/blktests.git/commitdiff
common: fix _have_module_param_value to work with built-in drivers
authorChristoph Hellwig <hch@lst.de>
Wed, 1 Jun 2022 06:48:33 +0000 (08:48 +0200)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 2 Jun 2022 04:24:13 +0000 (13:24 +0900)
Don't bother to call modprobe directly and just check the /sys/module/
directory.  Also switch to using descriptive variable names for the
parameters.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
common/rc

index 1a69728ac29cb90d11449c788fe1aa86250d341e..eb794a29fccd52b415724fd190129b13f8827405 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -74,17 +74,22 @@ _have_module_param() {
 }
 
 _have_module_param_value() {
+       local modname="${1/-/_}"
+       local param="$2"
+       local expected_value="$3"
        local value
 
-       modprobe "$1"
+       if ! _have_driver "$modname"; then
+               return 1;
+       fi
 
-       if ! _have_module_param "$1" "$2"; then
+       if ! _have_module_param "$modname" "$param"; then
                return 1
        fi
 
-       value=$(cat "/sys/module/$1/parameters/$2")
-       if [[ "${value}" != "$3" ]]; then
-               SKIP_REASON="$1 module parameter $2 must be set to $3"
+       value=$(cat "/sys/module/$modname/parameters/$param")
+       if [[ "${value}" != "$expected_value" ]]; then
+               SKIP_REASON="$modname module parameter $param must be set to $expected_value"
                return 1
        fi