Skip to contentSkip to conversation

csky: Fixup -Wmissing-prototypes warning

PATCH In review [email protected] 3 participants 5 messages Aug 11, 2023 – Aug 30, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 csky: Fixup -Wmissing-prototypes warning

From: Guo Ren <[email protected]>

Cleanup the warnings:

arch/csky/kernel/ptrace.c:320:16: error: no previous prototype for 'syscall_trace_enter' [-Werror=missing-prototypes] arch/csky/kernel/ptrace.c:336:17: error: no previous prototype for 'syscall_trace_exit' [-Werror=missing-prototypes] arch/csky/kernel/setup.c:116:34: error: no previous prototype for 'csky_start' [-Werror=missing-prototypes] arch/csky/kernel/signal.c:255:17: error: no previous prototype for 'do_notify_resume' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:150:15: error: no previous prototype for 'do_trap_unknown' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:152:15: error: no previous prototype for 'do_trap_zdiv' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:154:15: error: no previous prototype for 'do_trap_buserr' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:157:17: error: no previous prototype for 'do_trap_misaligned' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:168:17: error: no previous prototype for 'do_trap_bkpt' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:187:17: error: no previous prototype for 'do_trap_illinsn' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:210:17: error: no previous prototype for 'do_trap_fpe' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:220:17: error: no previous prototype for 'do_trap_priv' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:230:17: error: no previous prototype for 'trap_c' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:57:13: error: no previous prototype for 'trap_init' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:12:5: error: no previous prototype for '__vdso_clock_gettime64' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:18:5: error: no previous prototype for '__vdso_gettimeofday' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:24:5: error: no previous prototype for '__vdso_clock_getres' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:6:5: error: no previous prototype for '__vdso_clock_gettime' [-Werror=missing-prototypes] arch/csky/mm/fault.c:187:17: error: no previous prototype for 'do_page_fault' [-Werror=missing-prototypes]

---
 arch/csky/include/asm/ptrace.h        |  2 ++
 arch/csky/include/asm/sections.h      |  2 ++
 arch/csky/include/asm/traps.h         | 15 +++++++++++++++
 arch/csky/kernel/vdso/vgettimeofday.c | 11 +++++++++++
 4 files changed, 30 insertions(+)
arch/csky/include/asm/ptrace.h +2 -0
index 4202aab6df42..0634b7895d81 100644
@@ -96,5 +96,7 @@ static inline unsigned long regs_get_register(struct pt_regs *regs,
 	return *(unsigned long *)((unsigned long)regs + offset);
 }
 
+asmlinkage int syscall_trace_enter(struct pt_regs *regs);
+asmlinkage void syscall_trace_exit(struct pt_regs *regs);
 #endif /* __ASSEMBLY__ */
 #endif /* __ASM_CSKY_PTRACE_H */
arch/csky/include/asm/sections.h +2 -0
index 4192cba8445d..83e82b7c0f6c 100644
@@ -7,4 +7,6 @@
 
 extern char _start[];
 
+asmlinkage void csky_start(unsigned int unused, void *dtb_start);
+
 #endif /* __ASM_SECTIONS_H */
arch/csky/include/asm/traps.h +15 -0
index 421a4195e2fe..1e7d303b91e9 100644
@@ -40,4 +40,19 @@ do { \
 
 void csky_alignment(struct pt_regs *regs);
 
+asmlinkage void do_trap_unknown(struct pt_regs *regs);
+asmlinkage void do_trap_zdiv(struct pt_regs *regs);
+asmlinkage void do_trap_buserr(struct pt_regs *regs);
+asmlinkage void do_trap_misaligned(struct pt_regs *regs);
+asmlinkage void do_trap_bkpt(struct pt_regs *regs);
+asmlinkage void do_trap_illinsn(struct pt_regs *regs);
+asmlinkage void do_trap_fpe(struct pt_regs *regs);
+asmlinkage void do_trap_priv(struct pt_regs *regs);
+asmlinkage void trap_c(struct pt_regs *regs);
+
+asmlinkage void do_notify_resume(struct pt_regs *regs,
+			unsigned long thread_info_flags);
+
+void trap_init(void);
+
 #endif /* __ASM_CSKY_TRAPS_H */
arch/csky/kernel/vdso/vgettimeofday.c +11 -0
index da491832c098..c4831145eed5 100644
@@ -3,24 +3,35 @@
 #include <linux/time.h>
 #include <linux/types.h>
 
+extern
+int __vdso_clock_gettime(clockid_t clock,
+			 struct old_timespec32 *ts);
 int __vdso_clock_gettime(clockid_t clock,
 			 struct old_timespec32 *ts)
 {
 	return __cvdso_clock_gettime32(clock, ts);
 }
 
+int __vdso_clock_gettime64(clockid_t clock,
+			   struct __kernel_timespec *ts);
 int __vdso_clock_gettime64(clockid_t clock,
 			   struct __kernel_timespec *ts)
 {
 	return __cvdso_clock_gettime(clock, ts);
 }
 
+extern
+int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
+			struct timezone *tz);
 int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
 			struct timezone *tz)
 {
 	return __cvdso_gettimeofday(tv, tz);
 }
 
+extern
+int __vdso_clock_getres(clockid_t clock_id,
+			struct old_timespec32 *res);
 int __vdso_clock_getres(clockid_t clock_id,
 			struct old_timespec32 *res)
 {
Signature · 1 line
2.36.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Fri, Aug 11, 2023, at 05:07, [email protected] wrote:

Thanks for addressing these!

Quoted 5 lines
arch/csky/kernel/vdso/vgettimeofday.c +0 -0
@@ -3,24 +3,35 @@
 #include <linux/time.h>
 #include <linux/types.h>

arch/csky/kernel/vdso/vgettimeofday.c line 14

Quoted 10 lines
arch/csky/kernel/vdso/vgettimeofday.c +3 -0
 
+extern
+int __vdso_clock_gettime(clockid_t clock,
+			 struct old_timespec32 *ts);
 int __vdso_clock_gettime(clockid_t clock,
 			 struct old_timespec32 *ts)
 {
 	return __cvdso_clock_gettime32(clock, ts);
 }
 

This works, but it would be a bit nicer to move the declarations into a header. I see that we already handle this in three different ways across x86, arm and arm64, and you picked method from x86 (and loongarch) here, so I can't really complain.

What we should probably have instead is a new header in include/vdso/ that declares the functions for every architecture.

Arnd

author maintainer
#2 lore raw
Quoted 18 lines · Arnd Bergmann
Quoted 5 lines · On Fri, Aug 11, 2023, at 05:07, [email protected] wrote:

Thanks for addressing these!

Quoted 6 lines
arch/csky/kernel/vdso/vgettimeofday.c +0 -0
@@ -3,24 +3,35 @@
 #include <linux/time.h>
 #include <linux/types.h>
 
Quoted 12 lines

arch/csky/kernel/vdso/vgettimeofday.c line 14

Quoted 9 lines
arch/csky/kernel/vdso/vgettimeofday.c +3 -0
+extern
+int __vdso_clock_gettime(clockid_t clock,
+                      struct old_timespec32 *ts);
 int __vdso_clock_gettime(clockid_t clock,
                       struct old_timespec32 *ts)
 {
      return __cvdso_clock_gettime32(clock, ts);
 }
 

This works, but it would be a bit nicer to move the declarations into a header. I see that we already handle

I know you concern, but I didn't find a proper header file. So I copied riscv solution, let's solve that in riscv first, then csky would follow up. Thx.

Quoted 9 lines

this in three different ways across x86, arm and arm64, and you picked method from x86 (and loongarch) here, so I can't really complain.

What we should probably have instead is a new header in include/vdso/ that declares the functions for every architecture.

Arnd

Signature · 2 lines
Best Regards
 Guo Ren
#3 lore raw
In reply to [email protected]
Quoted 24 lines · On Thu, Aug 10, 2023 at 11:07:50PM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Cleanup the warnings:

arch/csky/kernel/ptrace.c:320:16: error: no previous prototype for 'syscall_trace_enter' [-Werror=missing-prototypes] arch/csky/kernel/ptrace.c:336:17: error: no previous prototype for 'syscall_trace_exit' [-Werror=missing-prototypes] arch/csky/kernel/setup.c:116:34: error: no previous prototype for 'csky_start' [-Werror=missing-prototypes] arch/csky/kernel/signal.c:255:17: error: no previous prototype for 'do_notify_resume' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:150:15: error: no previous prototype for 'do_trap_unknown' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:152:15: error: no previous prototype for 'do_trap_zdiv' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:154:15: error: no previous prototype for 'do_trap_buserr' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:157:17: error: no previous prototype for 'do_trap_misaligned' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:168:17: error: no previous prototype for 'do_trap_bkpt' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:187:17: error: no previous prototype for 'do_trap_illinsn' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:210:17: error: no previous prototype for 'do_trap_fpe' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:220:17: error: no previous prototype for 'do_trap_priv' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:230:17: error: no previous prototype for 'trap_c' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:57:13: error: no previous prototype for 'trap_init' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:12:5: error: no previous prototype for '__vdso_clock_gettime64' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:18:5: error: no previous prototype for '__vdso_gettimeofday' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:24:5: error: no previous prototype for '__vdso_clock_getres' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:6:5: error: no previous prototype for '__vdso_clock_gettime' [-Werror=missing-prototypes] arch/csky/mm/fault.c:187:17: error: no previous prototype for 'do_page_fault' [-Werror=missing-prototypes]

Quoted 4 lines

I get the following build errors in linux-next. Bisect points to this patch.

Building csky:defconfig ... failed
--------------
Error log:
In file included from arch/csky/include/asm/ptrace.h:7,
from arch/csky/include/asm/elf.h:6,
from include/linux/elf.h:6,
from kernel/extable.c:6:
arch/csky/include/asm/traps.h:43:11: error: expected ';' before 'void'

   43 | asmlinkage void do_trap_unknown(struct pt_regs *regs);
      |           ^~~~~

[ and many more similar errors ]

Guenter

---
# bad: [56585460cc2ec44fc5d66924f0a116f57080f0dc] Add linux-next specific files for 20230830
# good: [2dde18cd1d8fac735875f2e4987f11817cc0bc2c] Linux 6.5
git bisect start 'HEAD' 'v6.5'
# bad: [17582b16f00f2ca3f84f1c9dadef1529895ddd9a] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
git bisect bad 17582b16f00f2ca3f84f1c9dadef1529895ddd9a
# good: [bd6c11bc43c496cddfc6cf603b5d45365606dbd5] Merge tag 'net-next-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
git bisect good bd6c11bc43c496cddfc6cf603b5d45365606dbd5
# bad: [b22935905f9c5830bfd1c66ad3638ffdf6f80da7] Merge branch 'for-linux-next-fixes' of git://anongit.freedesktop.org/drm/drm-misc
git bisect bad b22935905f9c5830bfd1c66ad3638ffdf6f80da7
# good: [692f5510159c79bfa312a4e27a15e266232bfb4c] Merge tag 'asoc-v6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus git bisect good 692f5510159c79bfa312a4e27a15e266232bfb4c
# good: [b91742d84d29c39b643992b95560cfb7337eab18] mm/shmem.c: use helper macro K()
git bisect good b91742d84d29c39b643992b95560cfb7337eab18
# good: [19134bc23500a01bfdb77a804fc8e4bf8808d0cc] mm: fix kernel-doc warning from tlb_flush_rmaps()
git bisect good 19134bc23500a01bfdb77a804fc8e4bf8808d0cc
# bad: [858e6c6fd1960650c6a44b8158e1ac26ee63e26d] Merge branch 'for-curr' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git
git bisect bad 858e6c6fd1960650c6a44b8158e1ac26ee63e26d
# bad: [9d6b14cd1e993d2ff98df0cef6d935ce6fd4dbec] Merge tag 'flex-array-transformations-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
git bisect bad 9d6b14cd1e993d2ff98df0cef6d935ce6fd4dbec
# good: [3b425dd2aeb8c876805a4cc29d84a6c455b43530] parisc: led: Move register_led_regions() to late_initcall()
git bisect good 3b425dd2aeb8c876805a4cc29d84a6c455b43530
# good: [48d25d382643a9d8867f8eb13af231268ab10db5] Merge tag 'parisc-for-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
git bisect good 48d25d382643a9d8867f8eb13af231268ab10db5
# bad: [c8171a86b27401aa1f492dd1f080f3102264f1ab] csky: Fixup -Wmissing-prototypes warning
git bisect bad c8171a86b27401aa1f492dd1f080f3102264f1ab
# good: [1362d15ffb59db65b2df354b548b7915686cb05c] csky: pgtable: Invalidate stale I-cache lines in update_mmu_cache
git bisect good 1362d15ffb59db65b2df354b548b7915686cb05c
# good: [c1884e1e116409dafce84df38134aa2d7cdb719d] csky: Make pfn accessors static inlines
git bisect good c1884e1e116409dafce84df38134aa2d7cdb719d

# first bad commit: [c8171a86b27401aa1f492dd1f080f3102264f1ab] csky: Fixup -Wmissing-prototypes warning
author maintainer
#4 lore raw
Quoted 26 lines · Guenter Roeck
Quoted 24 lines · On Thu, Aug 10, 2023 at 11:07:50PM -0400, [email protected] wrote:

From: Guo Ren <[email protected]>

Cleanup the warnings:

arch/csky/kernel/ptrace.c:320:16: error: no previous prototype for 'syscall_trace_enter' [-Werror=missing-prototypes] arch/csky/kernel/ptrace.c:336:17: error: no previous prototype for 'syscall_trace_exit' [-Werror=missing-prototypes] arch/csky/kernel/setup.c:116:34: error: no previous prototype for 'csky_start' [-Werror=missing-prototypes] arch/csky/kernel/signal.c:255:17: error: no previous prototype for 'do_notify_resume' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:150:15: error: no previous prototype for 'do_trap_unknown' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:152:15: error: no previous prototype for 'do_trap_zdiv' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:154:15: error: no previous prototype for 'do_trap_buserr' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:157:17: error: no previous prototype for 'do_trap_misaligned' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:168:17: error: no previous prototype for 'do_trap_bkpt' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:187:17: error: no previous prototype for 'do_trap_illinsn' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:210:17: error: no previous prototype for 'do_trap_fpe' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:220:17: error: no previous prototype for 'do_trap_priv' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:230:17: error: no previous prototype for 'trap_c' [-Werror=missing-prototypes] arch/csky/kernel/traps.c:57:13: error: no previous prototype for 'trap_init' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:12:5: error: no previous prototype for '__vdso_clock_gettime64' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:18:5: error: no previous prototype for '__vdso_gettimeofday' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:24:5: error: no previous prototype for '__vdso_clock_getres' [-Werror=missing-prototypes] arch/csky/kernel/vdso/vgettimeofday.c:6:5: error: no previous prototype for '__vdso_clock_gettime' [-Werror=missing-prototypes] arch/csky/mm/fault.c:187:17: error: no previous prototype for 'do_page_fault' [-Werror=missing-prototypes]

Quoted 6 lines
Quoted 4 lines

I get the following build errors in linux-next. Bisect points to this patch.

I missed this:

arch/csky/include/asm/traps.h +2 -0
index 1e7d303b91e9..732c4aaa2e26 100644
@@ -3,6 +3,8 @@
 #ifndef __ASM_CSKY_TRAPS_H
 #define __ASM_CSKY_TRAPS_H
 
+#include <linux/linkage.h>
+
 #define VEC_RESET      0
 #define VEC_ALIGN      1
 #define VEC_ACCESS     2

Sorry, I would send another pull request to fixup mainline code.

Quoted 47 lines

Building csky:defconfig ... failed
--------------
Error log:
In file included from arch/csky/include/asm/ptrace.h:7,
from arch/csky/include/asm/elf.h:6,
from include/linux/elf.h:6,
from kernel/extable.c:6:
arch/csky/include/asm/traps.h:43:11: error: expected ';' before 'void'

   43 | asmlinkage void do_trap_unknown(struct pt_regs *regs);
      |           ^~~~~

[ and many more similar errors ]

Guenter

---
# bad: [56585460cc2ec44fc5d66924f0a116f57080f0dc] Add linux-next specific files for 20230830
# good: [2dde18cd1d8fac735875f2e4987f11817cc0bc2c] Linux 6.5
git bisect start 'HEAD' 'v6.5'
# bad: [17582b16f00f2ca3f84f1c9dadef1529895ddd9a] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
git bisect bad 17582b16f00f2ca3f84f1c9dadef1529895ddd9a
# good: [bd6c11bc43c496cddfc6cf603b5d45365606dbd5] Merge tag 'net-next-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
git bisect good bd6c11bc43c496cddfc6cf603b5d45365606dbd5
# bad: [b22935905f9c5830bfd1c66ad3638ffdf6f80da7] Merge branch 'for-linux-next-fixes' of git://anongit.freedesktop.org/drm/drm-misc
git bisect bad b22935905f9c5830bfd1c66ad3638ffdf6f80da7
# good: [692f5510159c79bfa312a4e27a15e266232bfb4c] Merge tag 'asoc-v6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus git bisect good 692f5510159c79bfa312a4e27a15e266232bfb4c
# good: [b91742d84d29c39b643992b95560cfb7337eab18] mm/shmem.c: use helper macro K()
git bisect good b91742d84d29c39b643992b95560cfb7337eab18
# good: [19134bc23500a01bfdb77a804fc8e4bf8808d0cc] mm: fix kernel-doc warning from tlb_flush_rmaps()
git bisect good 19134bc23500a01bfdb77a804fc8e4bf8808d0cc
# bad: [858e6c6fd1960650c6a44b8158e1ac26ee63e26d] Merge branch 'for-curr' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git
git bisect bad 858e6c6fd1960650c6a44b8158e1ac26ee63e26d
# bad: [9d6b14cd1e993d2ff98df0cef6d935ce6fd4dbec] Merge tag 'flex-array-transformations-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
git bisect bad 9d6b14cd1e993d2ff98df0cef6d935ce6fd4dbec
# good: [3b425dd2aeb8c876805a4cc29d84a6c455b43530] parisc: led: Move register_led_regions() to late_initcall()
git bisect good 3b425dd2aeb8c876805a4cc29d84a6c455b43530
# good: [48d25d382643a9d8867f8eb13af231268ab10db5] Merge tag 'parisc-for-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
git bisect good 48d25d382643a9d8867f8eb13af231268ab10db5
# bad: [c8171a86b27401aa1f492dd1f080f3102264f1ab] csky: Fixup -Wmissing-prototypes warning
git bisect bad c8171a86b27401aa1f492dd1f080f3102264f1ab
# good: [1362d15ffb59db65b2df354b548b7915686cb05c] csky: pgtable: Invalidate stale I-cache lines in update_mmu_cache
git bisect good 1362d15ffb59db65b2df354b548b7915686cb05c
# good: [c1884e1e116409dafce84df38134aa2d7cdb719d] csky: Make pfn accessors static inlines
git bisect good c1884e1e116409dafce84df38134aa2d7cdb719d

# first bad commit: [c8171a86b27401aa1f492dd1f080f3102264f1ab] csky: Fixup -Wmissing-prototypes warning
Signature · 2 lines
Best Regards
 Guo Ren