selftests/cpufreq: Remove unused local variables from switch_show_governor()
Subsystems (2)
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
@@ -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
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
@@ -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
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.Signed-off-by Jinseok Kim <[email protected]>--- tools/testing/selftests/cpufreq/special-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
viresh
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()andrestore_governor()already handle state preservation elsewhere.
Quoted 4 lines
Signed-off-by Jinseok Kim <[email protected]>--- tools/testing/selftests/cpufreq/governor.sh | 5 ----- 1 file changed, 5 deletions(-)
Signature · 1 line
viresh
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()andrestore_governor()already handle state preservation elsewhere.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Jinseok Kim <[email protected]>--- tools/testing/selftests/cpufreq/governor.sh | 5 ----- 1 file changed, 5 deletions(-)Acked-by Viresh Kumar <[email protected]>
Applied as 7.3 material along with the [2/2], thanks!