perf tools: Declare syscalltbl_*[] as const for all archs

syscalltbl_*[] should never be changing, let us declare it as const.

Suggested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: loongarch@lists.linux.dev
Link: https://lore.kernel.org/r/1685441401-8709-2-git-send-email-yangtiezhu@loongson.cn
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Tiezhu Yang 2023-05-30 18:09:57 +08:00 коммит произвёл Arnaldo Carvalho de Melo
Родитель 16203e9cd0
Коммит 49f3806d89
7 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -34,7 +34,7 @@ create_table_from_c()
create_table() create_table()
{ {
echo "#include \"$input\"" echo "#include \"$input\""
echo "static const char *syscalltbl_arm64[] = {" echo "static const char *const syscalltbl_arm64[] = {"
create_table_from_c create_table_from_c
echo "};" echo "};"
} }

Просмотреть файл

@ -50,7 +50,7 @@ create_table_from_c()
create_table() create_table()
{ {
echo "static const char *syscalltbl_loongarch[] = {" echo "static const char *const syscalltbl_loongarch[] = {"
create_table_from_c create_table_from_c
echo "};" echo "};"
} }

Просмотреть файл

@ -18,7 +18,7 @@ create_table()
{ {
local max_nr nr abi sc discard local max_nr nr abi sc discard
echo 'static const char *syscalltbl_mips_n64[] = {' echo 'static const char *const syscalltbl_mips_n64[] = {'
while read nr abi sc discard; do while read nr abi sc discard; do
printf '\t[%d] = "%s",\n' $nr $sc printf '\t[%d] = "%s",\n' $nr $sc
max_nr=$nr max_nr=$nr

Просмотреть файл

@ -23,7 +23,7 @@ create_table()
max_nr=-1 max_nr=-1
nr=0 nr=0
echo "static const char *syscalltbl_powerpc_${wordsize}[] = {" echo "static const char *const syscalltbl_powerpc_${wordsize}[] = {"
while read nr abi sc discard; do while read nr abi sc discard; do
if [ "$max_nr" -lt "$nr" ]; then if [ "$max_nr" -lt "$nr" ]; then
printf '\t[%d] = "%s",\n' $nr $sc printf '\t[%d] = "%s",\n' $nr $sc

Просмотреть файл

@ -18,7 +18,7 @@ create_table()
{ {
local max_nr nr abi sc discard local max_nr nr abi sc discard
echo 'static const char *syscalltbl_s390_64[] = {' echo 'static const char *const syscalltbl_s390_64[] = {'
while read nr abi sc discard; do while read nr abi sc discard; do
printf '\t[%d] = "%s",\n' $nr $sc printf '\t[%d] = "%s",\n' $nr $sc
max_nr=$nr max_nr=$nr

Просмотреть файл

@ -18,7 +18,7 @@ emit() {
syscall_macro "$nr" "$entry" syscall_macro "$nr" "$entry"
} }
echo "static const char *syscalltbl_${arch}[] = {" echo "static const char *const syscalltbl_${arch}[] = {"
sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX) sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX)
grep '^[0-9]' "$in" | sort -n > $sorted_table grep '^[0-9]' "$in" | sort -n > $sorted_table

Просмотреть файл

@ -17,31 +17,31 @@
#if defined(__x86_64__) #if defined(__x86_64__)
#include <asm/syscalls_64.c> #include <asm/syscalls_64.c>
const int syscalltbl_native_max_id = SYSCALLTBL_x86_64_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_x86_64_MAX_ID;
static const char **syscalltbl_native = syscalltbl_x86_64; static const char *const *syscalltbl_native = syscalltbl_x86_64;
#elif defined(__s390x__) #elif defined(__s390x__)
#include <asm/syscalls_64.c> #include <asm/syscalls_64.c>
const int syscalltbl_native_max_id = SYSCALLTBL_S390_64_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_S390_64_MAX_ID;
static const char **syscalltbl_native = syscalltbl_s390_64; static const char *const *syscalltbl_native = syscalltbl_s390_64;
#elif defined(__powerpc64__) #elif defined(__powerpc64__)
#include <asm/syscalls_64.c> #include <asm/syscalls_64.c>
const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_64_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_64_MAX_ID;
static const char **syscalltbl_native = syscalltbl_powerpc_64; static const char *const *syscalltbl_native = syscalltbl_powerpc_64;
#elif defined(__powerpc__) #elif defined(__powerpc__)
#include <asm/syscalls_32.c> #include <asm/syscalls_32.c>
const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_32_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_32_MAX_ID;
static const char **syscalltbl_native = syscalltbl_powerpc_32; static const char *const *syscalltbl_native = syscalltbl_powerpc_32;
#elif defined(__aarch64__) #elif defined(__aarch64__)
#include <asm/syscalls.c> #include <asm/syscalls.c>
const int syscalltbl_native_max_id = SYSCALLTBL_ARM64_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_ARM64_MAX_ID;
static const char **syscalltbl_native = syscalltbl_arm64; static const char *const *syscalltbl_native = syscalltbl_arm64;
#elif defined(__mips__) #elif defined(__mips__)
#include <asm/syscalls_n64.c> #include <asm/syscalls_n64.c>
const int syscalltbl_native_max_id = SYSCALLTBL_MIPS_N64_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_MIPS_N64_MAX_ID;
static const char **syscalltbl_native = syscalltbl_mips_n64; static const char *const *syscalltbl_native = syscalltbl_mips_n64;
#elif defined(__loongarch__) #elif defined(__loongarch__)
#include <asm/syscalls.c> #include <asm/syscalls.c>
const int syscalltbl_native_max_id = SYSCALLTBL_LOONGARCH_MAX_ID; const int syscalltbl_native_max_id = SYSCALLTBL_LOONGARCH_MAX_ID;
static const char **syscalltbl_native = syscalltbl_loongarch; static const char *const *syscalltbl_native = syscalltbl_loongarch;
#endif #endif
struct syscall { struct syscall {