From: Christoph Hellwig Date: Wed, 1 Jun 2022 06:48:33 +0000 (+0200) Subject: common: fix _have_module_param_value to work with built-in drivers X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bc4538c961e6588d343ad38c99bfa6e510abee68;p=users%2Fhch%2Fblktests.git common: fix _have_module_param_value to work with built-in drivers 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 Signed-off-by: Shin'ichiro Kawasaki --- diff --git a/common/rc b/common/rc index 1a69728..eb794a2 100644 --- 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