1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

shutils.in: Simplify the dispatcher

Check that the function exists and then run it, to avoid endless
copy-pasting.

Also call it with "$@", which will achieve proper CLI params forwarding
unlike "$*" which will not.
This commit is contained in:
Douglas Raillard 2022-04-13 12:15:56 +01:00 committed by Marc Bonnici
parent 00a5bcb377
commit ff599dfbb6

View File

@ -335,76 +335,14 @@ get_fs_mount_point() {
# Main Function Dispatcher # Main Function Dispatcher
################################################################################ ################################################################################
case $CMD in # Use a function instead of a subshell so "exit 1" works as expected
cpufreq_set_all_frequencies) _command_not_found() {
cpufreq_set_all_frequencies $*
;;
cpufreq_get_all_frequencies)
cpufreq_get_all_frequencies
;;
cpufreq_set_all_governors)
cpufreq_set_all_governors $*
;;
cpufreq_get_all_governors)
cpufreq_get_all_governors
;;
cpufreq_trace_all_frequencies)
cpufreq_trace_all_frequencies $*
;;
devfreq_set_all_frequencies)
devfreq_set_all_frequencies $*
;;
devfreq_get_all_frequencies)
devfreq_get_all_frequencies
;;
devfreq_set_all_governors)
devfreq_set_all_governors $*
;;
devfreq_get_all_governors)
devfreq_get_all_governors
;;
cpuidle_wake_all_cpus)
cpuidle_wake_all_cpus $*
;;
cgroups_get_attributes)
cgroups_get_attributes $*
;;
cgroups_run_into)
cgroups_run_into $*
;;
cgroups_tasks_move)
cgroups_tasks_move $*
;;
cgroups_tasks_in)
cgroups_tasks_in $*
;;
cgroups_freezer_set_state)
cgroups_freezer_set_state $*
;;
ftrace_get_function_stats)
ftrace_get_function_stats
;;
hotplug_online_all)
hotplug_online_all
;;
read_tree_values)
read_tree_values $*
;;
read_tree_tgz_b64)
read_tree_tgz_b64 $*
;;
get_linux_system_id)
get_linux_system_id $*
;;
get_android_system_id)
get_android_system_id $*
;;
sched_get_kernel_attributes)
sched_get_kernel_attributes $*
;;
*)
echo "Command [$CMD] not supported" echo "Command [$CMD] not supported"
exit -1 exit 1
esac }
# Check the command exists
type "$CMD" 2>&1 >/dev/null || _command_not_found
"$CMD" "$@"
# vim: tabstop=4 shiftwidth=4 # vim: tabstop=4 shiftwidth=4