[LTP] [PATCH 1/2] runpwtests03.sh: Replace modprobe -l to lsmod

Petr Vorel pvorel@suse.cz
Wed Mar 18 14:26:38 CET 2026


modprobe does not have -l option. And 'busybox modprobe -l'
would require busybox as a dependency. List modules with find.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/power_management/runpwtests03.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/power_management/runpwtests03.sh b/testcases/kernel/power_management/runpwtests03.sh
index 72ad2ad687..ebd0957e64 100755
--- a/testcases/kernel/power_management/runpwtests03.sh
+++ b/testcases/kernel/power_management/runpwtests03.sh
@@ -115,9 +115,11 @@ pwkm_load_unload() {
 	RC=0
 	loaded_governor=`cat \
 		/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
-	for module in `modprobe -l | grep cpufreq_ | \
-		cut -f8 -d"/" | cut -f1 -d"."`
-	do
+
+	modules=$(find /lib/modules/$(uname -r) -type f -name '*.ko*' |
+		grep cpufreq_ | cut -f8 -d"/"  | cut -f1 -d".")
+
+	for module in $modules; do
 		#echo -n "Loading $module ... "
 		if [ $module != "cpufreq_$loaded_governor" ]; then
 			modprobe $module >/dev/null
@@ -128,9 +130,8 @@ pwkm_load_unload() {
 			fi
 		fi
 	done
-	for module in `modprobe -l | grep cpufreq_ | \
-		cut -f8 -d"/" | cut -f1 -d"."`
-		do
+
+	for module in $modules; do
 		#echo -n "Unloading $module ... "
 		if [ $module != "cpufreq_$loaded_governor" ]; then
 			modprobe -r $module >/dev/null
-- 
2.51.0



More information about the ltp mailing list