Skip to contentSkip to conversation

selftests/cpufreq: Remove unused local variables from switch_show_governor()

PATCH Applied Jinseok Kim 3 participants 5 messages Jul 6 – Jul 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 selftests/cpufreq: Remove unused local variables from switch_show_governor()

switch_show_governor() assigns the current governor and frequency to local variables before switching governors.

However, these variables are never referenced afterwards. The function does not restore the previous governor or use the saved frequency, as backup_governor() and restore_governor() already handle state preservation elsewhere.

---
 tools/testing/selftests/cpufreq/governor.sh | 5 -----
 1 file changed, 5 deletions(-)
tools/testing/selftests/cpufreq/governor.sh +0 -5
index fe37df79c087..212ef1cf43d5 100755
@@ -100,11 +100,6 @@ switch_governor()
 # $1: policy, $2: governor
 switch_show_governor()
 {
-	cur_gov=find_current_governor
-	if [ $cur_gov == "userspace" ]; then
-		cur_freq=find_current_freq
-	fi
-
 	# switch governor
 	__switch_governor $1 $2
 

--
2.43.0

#1 lore raw

PATCH 2/2 selftests/cpufreq: Remove unnecessary sudo from quick_shuffle()

The cpufreq selftests are always executed through main.sh, which verifies that the test is run as root before dispatching any test case.

Therefore, invoking sudo inside quick_shuffle() is redundant and may cause failures in environments where sudo is unavailable.

---
 tools/testing/selftests/cpufreq/special-tests.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/cpufreq/special-tests.sh +2 -2
index 8d40505dc468..f45eb525f3b1 100755
@@ -65,8 +65,8 @@ quick_shuffle()
 	# this is called concurrently from governor_race
 	for I in `seq 1000`
 	do
-		echo ondemand | sudo tee $CPUFREQROOT/policy*/scaling_governor &
-		echo userspace | sudo tee $CPUFREQROOT/policy*/scaling_governor &
+		echo ondemand | tee $CPUFREQROOT/policy*/scaling_governor &
+		echo userspace | tee $CPUFREQROOT/policy*/scaling_governor &
 	done
 }
 

--
2.43.0

maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] selftests/cpufreq: Remove unnecessary sudo from quick_shuffle()

Quoted 10 lines · Jinseok Kim

The cpufreq selftests are always executed through main.sh, which verifies that the test is run as root before dispatching any test case.

Therefore, invoking sudo inside quick_shuffle() is redundant and may cause failures in environments where sudo is unavailable.

---
 tools/testing/selftests/cpufreq/special-tests.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
viresh
maintainer Acked-by on v1 1/2
#3 lore raw
In reply to Jinseok Kim
Quoted 8 lines · Jinseok Kim

switch_show_governor() assigns the current governor and frequency to local variables before switching governors.

However, these variables are never referenced afterwards. The function does not restore the previous governor or use the saved frequency, as backup_governor() and restore_governor() already handle state preservation elsewhere.

Quoted 4 lines
---
 tools/testing/selftests/cpufreq/governor.sh | 5 -----
 1 file changed, 5 deletions(-)
Signature · 1 line
viresh
maintainer Applied
#4 lore raw
Quoted 10 lines · Viresh Kumar
Quoted 8 lines · Jinseok Kim

switch_show_governor() assigns the current governor and frequency to local variables before switching governors.

However, these variables are never referenced afterwards. The function does not restore the previous governor or use the saved frequency, as backup_governor() and restore_governor() already handle state preservation elsewhere.

Quoted 6 lines
Quoted 4 lines
---
 tools/testing/selftests/cpufreq/governor.sh | 5 -----
 1 file changed, 5 deletions(-)

Applied as 7.3 material along with the [2/2], thanks!