perf tools: Declare syscalltbl_*[] as const for all archs
authorTiezhu Yang <yangtiezhu@loongson.cn>
Tue, 30 May 2023 10:09:57 +0000 (18:09 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 5 Jun 2023 14:36:17 +0000 (11:36 -0300)
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>
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
tools/perf/arch/loongarch/entry/syscalls/mksyscalltbl
tools/perf/arch/mips/entry/syscalls/mksyscalltbl
tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl
tools/perf/arch/s390/entry/syscalls/mksyscalltbl
tools/perf/arch/x86/entry/syscalls/syscalltbl.sh
tools/perf/util/syscalltbl.c

index 22cdf911dd9aa344347578d9a02beab318a7c21c..4edcdf6eb8aeae83a1d3a8dc97fc6c5cd76255e9 100755 (executable)
@@ -34,7 +34,7 @@ create_table_from_c()
 create_table()
 {
        echo "#include \"$input\""
-       echo "static const char *syscalltbl_arm64[] = {"
+       echo "static const char *const syscalltbl_arm64[] = {"
        create_table_from_c
        echo "};"
 }
index c52156f7204d45b8ab31a15486b9cc386c4e6049..5fb83bd87503a57cd733231f41e9357978a0bb54 100755 (executable)
@@ -50,7 +50,7 @@ create_table_from_c()
 
 create_table()
 {
-       echo "static const char *syscalltbl_loongarch[] = {"
+       echo "static const char *const syscalltbl_loongarch[] = {"
        create_table_from_c
        echo "};"
 }
index fb1f49451af62c0ffb6c276f01123b3241b88fc4..c0d93f959c4e1b8c12edcb5624bbc131231df7e3 100644 (file)
@@ -18,7 +18,7 @@ create_table()
 {
        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
                printf '\t[%d] = "%s",\n' $nr $sc
                max_nr=$nr
index 6c58060aa03beae7456e4f7cb0588e70207314be..0eb316fe6dd1175a86035f76f9f3cf7501c376bd 100755 (executable)
@@ -23,7 +23,7 @@ create_table()
        max_nr=-1
        nr=0
 
-       echo "static const char *syscalltbl_powerpc_${wordsize}[] = {"
+       echo "static const char *const syscalltbl_powerpc_${wordsize}[] = {"
        while read nr abi sc discard; do
                if [ "$max_nr" -lt "$nr" ]; then
                        printf '\t[%d] = "%s",\n' $nr $sc
index 72ecbb67637079f709262298981162b6cbb12c9f..52eb88a77c94727aeb8c15427cdd43dfe5f9f2bd 100755 (executable)
@@ -18,7 +18,7 @@ create_table()
 {
        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
                printf '\t[%d] = "%s",\n' $nr $sc
                max_nr=$nr
index 029a72c20b1970ad94ced82458aa36ea630efd15..fa526a9938455dc0084631b2475f6a01bf62b94f 100755 (executable)
@@ -18,7 +18,7 @@ emit() {
     syscall_macro "$nr" "$entry"
 }
 
-echo "static const char *syscalltbl_${arch}[] = {"
+echo "static const char *const syscalltbl_${arch}[] = {"
 
 sorted_table=$(mktemp /tmp/syscalltbl.XXXXXX)
 grep '^[0-9]' "$in" | sort -n > $sorted_table
index 313eccef6cb4c166027a8a2bb1e7f28a7352bb2b..63be7b58761d2f33d03344dc0e58f370a4cdc48d 100644 (file)
 #if defined(__x86_64__)
 #include <asm/syscalls_64.c>
 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__)
 #include <asm/syscalls_64.c>
 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__)
 #include <asm/syscalls_64.c>
 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__)
 #include <asm/syscalls_32.c>
 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__)
 #include <asm/syscalls.c>
 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__)
 #include <asm/syscalls_n64.c>
 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__)
 #include <asm/syscalls.c>
 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
 
 struct syscall {