hexagon: Fix up instances of -Wmissing-prototypes
cover hexagon: Fix up instances of -Wmissing-prototypes
Hi all,
This series fixes all the instances of -Wmissing-prototypes in arch/hexagon, now that it is enabled globally in a default build. I hope most of the patches will be uncontroversial but please let me know otherwise. This survives ARCH=hexagon defconfig and allmodconfig with LLVM 17.0.6.
This is based on Arnd's asm-generic-prototypes branch but it applies cleanly to 6.7-rc3 as well, in case Andrew wants to take it (as far as I remember, he has handled Hexagon patches for me in the past).
---
Nathan Chancellor (19):
hexagon: uaccess: Remove clear_user_hexagon()
hexagon: mm: Mark paging_init() as static
hexagon: mm: Include asm/setup.h for setup_arch_memory()'s prototype
hexagon: smp: Mark handle_ipi() and start_secondary() as static
hexagon: vm_fault: Mark do_page_fault() as static
hexagon: vm_fault: Include asm/vm_fault.h for prototypes
hexagon: vm_tlb: Include asm/tlbflush.h for prototypes
hexagon: time: Include asm/time.h for prototypes
hexagon: time: Mark time_init_deferred() as static
hexagon: time: Include asm/delay.h for prototypes
hexagon: signal: Switch to SYSCALL_DEFINE0 for sys_rt_sigreturn()
hexagon: reset: Include linux/reboot.h for prototypes
hexagon: process: Include linux/cpu.h for arch_cpu_idle() prototype
hexagon: process: Add internal prototype for do_work_pending()
hexagon: vdso: Include asm/elf.h for arch_setup_additional_pages() prototype
hexagon: vm_events: Remove unused dummy_handler()
hexagon: irq: Add prototype for arch_do_IRQ()
hexagon: traps: Remove sys_syscall()
hexagon: traps: Add internal prototypes for functions only called from asm
arch/hexagon/include/asm/irq.h | 3 +++ arch/hexagon/kernel/process.c | 2 ++ arch/hexagon/kernel/reset.c | 1 + arch/hexagon/kernel/signal.c | 2 +- arch/hexagon/kernel/smp.c | 4 ++-- arch/hexagon/kernel/time.c | 4 +++- arch/hexagon/kernel/traps.c | 11 ++++------- arch/hexagon/kernel/vdso.c | 1 + arch/hexagon/kernel/vm_events.c | 7 ------- arch/hexagon/mm/init.c | 3 ++- arch/hexagon/mm/uaccess.c | 8 -------- arch/hexagon/mm/vm_fault.c | 3 ++- arch/hexagon/mm/vm_tlb.c | 1 + 13 files changed, 22 insertions(+), 28 deletions(-)
---
base-commit: 6479f0df0b7b7e977357e524bdd2eb3aeb4fd085
change-id: 20231130-hexagon-missing-prototypes-6e05144769e7
Best regards,
Signature · 1 line
Nathan Chancellor <[email protected]>
PATCH 1/19 hexagon: uaccess: Remove clear_user_hexagon()
Clang warns:
arch/hexagon/mm/uaccess.c:39:15: warning: no previous prototype for function 'clear_user_hexagon' [-Wmissing-prototypes]
39 | unsigned long clear_user_hexagon(void __user *dest, unsigned long count)
| ^
arch/hexagon/mm/uaccess.c:39:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
39 | unsigned long clear_user_hexagon(void __user *dest, unsigned long count)
| ^
| static1 warning generated.
This function appears to have been unused since it was introduced in commit 7567746e1c0d ("Hexagon: Add user access functions"), so remove it.
--- arch/hexagon/mm/uaccess.c | 8 -------- 1 file changed, 8 deletions(-)
arch/hexagon/mm/uaccess.c +0 -8
@@ -35,11 +35,3 @@ __kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count)return count; } - -unsigned long clear_user_hexagon (void __user *dest,unsigned long count) -{ -if (!access_ok (dest, count)) -return count; -else -return __clear_user_hexagon (dest, count); -}
Signature · 1 line
2.43.0
PATCH 2/19 hexagon: mm: Mark paging_init() as static
In reply to Nathan ChancellorClang warns:
arch/hexagon/mm/init.c:89:13: warning: no previous prototype for function 'paging_init' [-Wmissing-prototypes]
89 | void __init paging_init(void)
| ^
arch/hexagon/mm/init.c:89:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
89 | void __init paging_init(void)
| ^
| staticThis function is only used within this translation unit, so mark it static as suggested.
--- arch/hexagon/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/mm/init.c +1 -1
@@ -86,7 +86,7 @@ void sync_icache_dcache(pte_t pte)* In this mode, we only have one pg_data_t * structure: contig_mem_data. */ -void __init paging_init (void ) +static void __init paging_init (void ) {unsigned long max_zone_pfn[MAX_NR_ZONES ] = {0 , };
Signature · 1 line
2.43.0
PATCH 3/19 hexagon: mm: Include asm/setup.h for setup_arch_memory()'s prototype
In reply to Nathan ChancellorClang warns:
arch/hexagon/mm/init.c:138:13: warning: no previous prototype for function 'setup_arch_memory' [-Wmissing-prototypes]
138 | void __init setup_arch_memory(void)
| ^
arch/hexagon/mm/init.c:138:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
138 | void __init setup_arch_memory(void)
| ^
| staticThe prototype is in asm/setup.h, include it to clear up the warning.
--- arch/hexagon/mm/init.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/mm/init.c +1 -0
@@ -12,6 +12,7 @@#include <linux/highmem.h> #include <asm/tlb.h> #include <asm/sections.h> +#include <asm/setup.h> #include <asm/vm_mmu.h> /*
Signature · 1 line
2.43.0
PATCH 4/19 hexagon: smp: Mark handle_ipi() and start_secondary() as static
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/smp.c:82:13: warning: no previous prototype for function 'handle_ipi' [-Wmissing-prototypes]
82 | irqreturn_t handle_ipi(int irq, void *desc)
| ^
arch/hexagon/kernel/smp.c:82:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
82 | irqreturn_t handle_ipi(int irq, void *desc)
| ^
| static
arch/hexagon/kernel/smp.c:127:6: warning: no previous prototype for function 'start_secondary' [-Wmissing-prototypes]
127 | void start_secondary(void)
| ^
arch/hexagon/kernel/smp.c:127:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
127 | void start_secondary(void)
| ^
| static2 warnings generated.
These functions are not used outside of this translation unit, so mark them as static.
--- arch/hexagon/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/hexagon/kernel/smp.c +2 -2
@@ -79,7 +79,7 @@ void smp_vm_unmask_irq(void *info)* Specifically, first arg is irq, second is the irq_desc. */ -irqreturn_t handle_ipi (int irq,void *desc) +static irqreturn_t handle_ipi (int irq,void *desc) {int cpu =smp_processor_id ();struct ipi_data *ipi = &per_cpu (ipi_data, cpu);
@@ -124,7 +124,7 @@ void __init smp_prepare_boot_cpu(void)* to point to current thread info */ -void start_secondary (void ) +static void start_secondary (void ) {unsigned long thread_ptr;unsigned int cpu, irq;
Signature · 1 line
2.43.0
PATCH 5/19 hexagon: vm_fault: Mark do_page_fault() as static
In reply to Nathan ChancellorClang warns:
arch/hexagon/mm/vm_fault.c:36:6: warning: no previous prototype for function 'do_page_fault' [-Wmissing-prototypes]
36 | void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
| ^
arch/hexagon/mm/vm_fault.c:36:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
36 | void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
| ^
| staticThis function is not used outside of this translation unit, so mark it as static.
--- arch/hexagon/mm/vm_fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/mm/vm_fault.c +1 -1
@@ -33,7 +33,7 @@/* * Canonical page fault handler */ -void do_page_fault (unsigned long address,long cause,struct pt_regs *regs) +static void do_page_fault (unsigned long address,long cause,struct pt_regs *regs) {struct vm_area_struct *vma;struct mm_struct *mm = current->mm;
Signature · 1 line
2.43.0
PATCH 6/19 hexagon: vm_fault: Include asm/vm_fault.h for prototypes
In reply to Nathan ChancellorClang warns:
arch/hexagon/mm/vm_fault.c:157:6: warning: no previous prototype for function 'read_protection_fault' [-Wmissing-prototypes]
157 | void read_protection_fault(struct pt_regs *regs)
| ^
arch/hexagon/mm/vm_fault.c:157:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
157 | void read_protection_fault(struct pt_regs *regs)
| ^
| static
arch/hexagon/mm/vm_fault.c:164:6: warning: no previous prototype for function 'write_protection_fault' [-Wmissing-prototypes]
164 | void write_protection_fault(struct pt_regs *regs)
| ^
arch/hexagon/mm/vm_fault.c:164:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
164 | void write_protection_fault(struct pt_regs *regs)
| ^
| static
arch/hexagon/mm/vm_fault.c:171:6: warning: no previous prototype for function 'execute_protection_fault' [-Wmissing-prototypes]
171 | void execute_protection_fault(struct pt_regs *regs)
| ^
arch/hexagon/mm/vm_fault.c:171:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
171 | void execute_protection_fault(struct pt_regs *regs)
| ^
| staticThe prototypes for these functions are defined in asm/vm_fault.h, so include it to pick them up and silence the warnings.
--- arch/hexagon/mm/vm_fault.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/mm/vm_fault.c +1 -0
@@ -12,6 +12,7 @@*/ #include <asm/traps.h> +#include <asm/vm_fault.h> #include <linux/uaccess.h> #include <linux/mm.h> #include <linux/sched/signal.h>
Signature · 1 line
2.43.0
PATCH 7/19 hexagon: vm_tlb: Include asm/tlbflush.h for prototypes
In reply to Nathan ChancellorClang warns about several missing prototypes that are declared in this header:
arch/hexagon/mm/vm_tlb.c:25:6: warning: no previous prototype for function 'flush_tlb_range' [-Wmissing-prototypes]
25 | void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
| ^
arch/hexagon/mm/vm_tlb.c:25:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
25 | void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
| ^
| static
arch/hexagon/mm/vm_tlb.c:37:6: warning: no previous prototype for function 'flush_tlb_one' [-Wmissing-prototypes]
37 | void flush_tlb_one(unsigned long vaddr)
| ^
arch/hexagon/mm/vm_tlb.c:37:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
37 | void flush_tlb_one(unsigned long vaddr)
| ^
| static
arch/hexagon/mm/vm_tlb.c:47:6: warning: no previous prototype for function 'tlb_flush_all' [-Wmissing-prototypes]
47 | void tlb_flush_all(void)
| ^
arch/hexagon/mm/vm_tlb.c:47:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
47 | void tlb_flush_all(void)
| ^
| static
arch/hexagon/mm/vm_tlb.c:56:6: warning: no previous prototype for function 'flush_tlb_mm' [-Wmissing-prototypes]
56 | void flush_tlb_mm(struct mm_struct *mm)
| ^
arch/hexagon/mm/vm_tlb.c:56:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
56 | void flush_tlb_mm(struct mm_struct *mm)
| ^
| static
arch/hexagon/mm/vm_tlb.c:66:6: warning: no previous prototype for function 'flush_tlb_page' [-Wmissing-prototypes]
66 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long vaddr)
| ^
arch/hexagon/mm/vm_tlb.c:66:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
66 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long vaddr)
| ^
| static
arch/hexagon/mm/vm_tlb.c:78:6: warning: no previous prototype for function 'flush_tlb_kernel_range' [-Wmissing-prototypes]
78 | void flush_tlb_kernel_range(unsigned long start, unsigned long end)
| ^
arch/hexagon/mm/vm_tlb.c:78:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
78 | void flush_tlb_kernel_range(unsigned long start, unsigned long end)
| ^
| static6 warnings generated.
--- arch/hexagon/mm/vm_tlb.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/mm/vm_tlb.c +1 -0
@@ -14,6 +14,7 @@#include <linux/sched.h> #include <asm/page.h> #include <asm/hexagon_vm.h> +#include <asm/tlbflush.h> /* * Initial VM implementation has only one map active at a time, with
Signature · 1 line
2.43.0
PATCH 8/19 hexagon: time: Include asm/time.h for prototypes
In reply to Nathan ChancellorClang warns about missing prototypes that are declared in this header:
arch/hexagon/kernel/time.c:118:6: warning: no previous prototype for function 'setup_percpu_clockdev' [-Wmissing-prototypes]
118 | void setup_percpu_clockdev(void)
| ^
arch/hexagon/kernel/time.c:118:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
118 | void setup_percpu_clockdev(void)
| ^
| static
arch/hexagon/kernel/time.c:135:6: warning: no previous prototype for function 'ipi_timer' [-Wmissing-prototypes]
135 | void ipi_timer(void)
| ^
arch/hexagon/kernel/time.c:135:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
135 | void ipi_timer(void)
| ^
| static--- arch/hexagon/kernel/time.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/kernel/time.c +1 -0
@@ -18,6 +18,7 @@#include <linux/module.h> #include <asm/hexagon_vm.h> +#include <asm/time.h> #define TIMER_ENABLE BIT(0)
Signature · 1 line
2.43.0
PATCH 9/19 hexagon: time: Mark time_init_deferred() as static
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/time.c:163:13: warning: no previous prototype for function 'time_init_deferred' [-Wmissing-prototypes]
163 | void __init time_init_deferred(void)
| ^
arch/hexagon/kernel/time.c:163:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
163 | void __init time_init_deferred(void)
| ^
| staticThis function is not used outside of this translation unit so mark it as static to resolve the warning.
--- arch/hexagon/kernel/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/kernel/time.c +1 -1
@@ -161,7 +161,7 @@ static irqreturn_t timer_interrupt(int irq, void *devid)* This runs just before the delay loop is calibrated, and * is used for delay calibration. */ -void __init time_init_deferred (void ) +static void __init time_init_deferred (void ) {struct resource *resource =NULL ;struct clock_event_device *ce_dev = &hexagon_clockevent_dev;
Signature · 1 line
2.43.0
PATCH 10/19 hexagon: time: Include asm/delay.h for prototypes
In reply to Nathan ChancellorClang warns about missing prototypes that are declared in this header:
arch/hexagon/kernel/time.c:209:6: warning: no previous prototype for function '__delay' [-Wmissing-prototypes]
209 | void __delay(unsigned long cycles)
| ^
arch/hexagon/kernel/time.c:209:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
209 | void __delay(unsigned long cycles)
| ^
| static
arch/hexagon/kernel/time.c:224:6: warning: no previous prototype for function '__udelay' [-Wmissing-prototypes]
224 | void __udelay(unsigned long usecs)
| ^
arch/hexagon/kernel/time.c:224:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
224 | void __udelay(unsigned long usecs)
| ^
| static--- arch/hexagon/kernel/time.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/kernel/time.c +1 -0
@@ -17,6 +17,7 @@#include <linux/of_irq.h> #include <linux/module.h> +#include <asm/delay.h> #include <asm/hexagon_vm.h> #include <asm/time.h>
Signature · 1 line
2.43.0
PATCH 11/19 hexagon: signal: Switch to SYSCALL_DEFINE0 for sys_rt_sigreturn()
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/signal.c:223:16: warning: no previous prototype for function 'sys_rt_sigreturn' [-Wmissing-prototypes]
223 | asmlinkage int sys_rt_sigreturn(void)
| ^
arch/hexagon/kernel/signal.c:223:12: note: declare 'static' if the function is not intended to be used outside of this translation unit
223 | asmlinkage int sys_rt_sigreturn(void)
| ^
| static1 warning generated.
Switch to the SYSCALL_DEFINE0() macro, which automatically declares a prototype.
--- arch/hexagon/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/hexagon/kernel/signal.c +1 -1
@@ -220,7 +220,7 @@ void do_signal(struct pt_regs *regs)* Architecture-specific wrappers for signal-related system calls */ -asmlinkage int sys_rt_sigreturn(void) +SYSCALL_DEFINE0 (rt_sigreturn) {struct pt_regs *regs =current_pt_regs ();struct rt_sigframe __user *frame;
Signature · 1 line
2.43.0
PATCH 12/19 hexagon: reset: Include linux/reboot.h for prototypes
In reply to Nathan ChancellorClang warns about missing prototypes that are declared in this header:
arch/hexagon/kernel/reset.c:9:6: warning: no previous prototype for function 'machine_power_off' [-Wmissing-prototypes]
9 | void machine_power_off(void)
| ^
arch/hexagon/kernel/reset.c:9:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
9 | void machine_power_off(void)
| ^
| static
arch/hexagon/kernel/reset.c:15:6: warning: no previous prototype for function 'machine_halt' [-Wmissing-prototypes]
15 | void machine_halt(void)
| ^
arch/hexagon/kernel/reset.c:15:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
15 | void machine_halt(void)
| ^
| static
arch/hexagon/kernel/reset.c:19:6: warning: no previous prototype for function 'machine_restart' [-Wmissing-prototypes]
19 | void machine_restart(char *cmd)
| ^
arch/hexagon/kernel/reset.c:19:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
19 | void machine_restart(char *cmd)
| ^
| static3 warnings generated.
--- arch/hexagon/kernel/reset.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/kernel/reset.c +1 -0
@@ -3,6 +3,7 @@* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. */ +#include <linux/reboot.h> #include <linux/smp.h> #include <asm/hexagon_vm.h>
Signature · 1 line
2.43.0
PATCH 13/19 hexagon: process: Include linux/cpu.h for arch_cpu_idle() prototype
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/process.c:43:6: warning: no previous prototype for function 'arch_cpu_idle' [-Wmissing-prototypes]
43 | void arch_cpu_idle(void)
| ^
arch/hexagon/kernel/process.c:43:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
43 | void arch_cpu_idle(void)
| ^
| staticThis prototype is declared in include/linux/cpu.h, include it in process.c to clear up the warning.
--- arch/hexagon/kernel/process.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/kernel/process.c +1 -0
@@ -5,6 +5,7 @@* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. */ +#include <linux/cpu.h> #include <linux/sched.h> #include <linux/sched/debug.h> #include <linux/sched/task.h>
Signature · 1 line
2.43.0
PATCH 14/19 hexagon: process: Add internal prototype for do_work_pending()
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/process.c:155:5: warning: no previous prototype for function 'do_work_pending' [-Wmissing-prototypes]
155 | int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
| ^
arch/hexagon/kernel/process.c:155:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
155 | int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
| ^
| staticThis function is only referenced from assembly, so it does not technically need a prototype. Add one right above the definition anyways to clear up the warning.
--- arch/hexagon/kernel/process.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/kernel/process.c +1 -0
@@ -153,6 +153,7 @@ unsigned long __get_wchan(struct task_struct *p)* Returns 0 if there's no need to re-check for more work. */ +int do_work_pending (struct pt_regs *regs,u32 thread_info_flags);int do_work_pending (struct pt_regs *regs,u32 thread_info_flags) {if (!(thread_info_flags & _TIF_WORK_MASK)) {
Signature · 1 line
2.43.0
PATCH 15/19 hexagon: vdso: Include asm/elf.h for arch_setup_additional_pages() prototype
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/vdso.c:49:5: warning: no previous prototype for function 'arch_setup_additional_pages' [-Wmissing-prototypes]
49 | int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
| ^
arch/hexagon/kernel/vdso.c:49:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
49 | int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
| ^
| static1 warning generated.
Include the header that declares the prototype to clear up the warning.
--- arch/hexagon/kernel/vdso.c | 1 + 1 file changed, 1 insertion(+)
arch/hexagon/kernel/vdso.c +1 -0
@@ -10,6 +10,7 @@#include <linux/vmalloc.h> #include <linux/binfmts.h> +#include <asm/elf.h> #include <asm/vdso.h> static struct page *vdso_page;
Signature · 1 line
2.43.0
PATCH 16/19 hexagon: vm_events: Remove unused dummy_handler()
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/vm_events.c:76:6: warning: no previous prototype for function 'dummy_handler' [-Wmissing-prototypes]
76 | void dummy_handler(struct pt_regs *regs)
| ^
arch/hexagon/kernel/vm_events.c:76:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
76 | void dummy_handler(struct pt_regs *regs)
| ^
| staticThis function appears to be entirely unused, so remove it.
--- arch/hexagon/kernel/vm_events.c | 7 ------- 1 file changed, 7 deletions(-)
arch/hexagon/kernel/vm_events.c +0 -7
@@ -73,13 +73,6 @@ void show_regs(struct pt_regs *regs) pt_psp(regs), pt_badva(regs), ints_enabled(regs)); } -void dummy_handler (struct pt_regs *regs) -{ -unsigned int elr =pt_elr (regs); -printk (KERN_ERR "Unimplemented handler; ELR=0x%08x\n" , elr); -} - -void arch_do_IRQ (struct pt_regs *regs) {int irq =pt_cause (regs);
Signature · 1 line
2.43.0
PATCH 17/19 hexagon: irq: Add prototype for arch_do_IRQ()
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/vm_events.c:83:6: warning: no previous prototype for function 'arch_do_IRQ' [-Wmissing-prototypes]
83 | void arch_do_IRQ(struct pt_regs *regs)
| ^
arch/hexagon/kernel/vm_events.c:83:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
83 | void arch_do_IRQ(struct pt_regs *regs)
| ^
| staticThis function is only called from assembly but the irq header is a reasonable place to put a prototype to silence the warning.
--- arch/hexagon/include/asm/irq.h | 3 +++ 1 file changed, 3 insertions(+)
arch/hexagon/include/asm/irq.h +3 -0
@@ -20,4 +20,7 @@#include <asm-generic/irq.h> +struct pt_regs ; +void arch_do_IRQ (struct pt_regs *); +#endif
Signature · 1 line
2.43.0
PATCH 18/19 hexagon: traps: Remove sys_syscall()
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/traps.c:335:6: warning: no previous prototype for function 'sys_syscall' [-Wmissing-prototypes]
335 | long sys_syscall(void)
| ^
arch/hexagon/kernel/traps.c:335:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
335 | long sys_syscall(void)
| ^
| staticThis function is not used anywhere, so remove it.
--- arch/hexagon/kernel/traps.c | 7 ------- 1 file changed, 7 deletions(-)
arch/hexagon/kernel/traps.c +0 -7
@@ -331,13 +331,6 @@ void do_genex(struct pt_regs *regs) } } -/* Indirect system call dispatch */ -long sys_syscall (void ) -{ -printk (KERN_ERR "sys_syscall invoked!\n" ); -return -ENOSYS ; -} -void do_trap0 (struct pt_regs *regs) {syscall_fn syscall;
Signature · 1 line
2.43.0
PATCH 19/19 hexagon: traps: Add internal prototypes for functions only called from asm
In reply to Nathan ChancellorClang warns:
arch/hexagon/kernel/traps.c:284:6: warning: no previous prototype for function 'do_genex' [-Wmissing-prototypes]
284 | void do_genex(struct pt_regs *regs)
| ^
arch/hexagon/kernel/traps.c:284:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
284 | void do_genex(struct pt_regs *regs)
| ^
| static
arch/hexagon/kernel/traps.c:341:6: warning: no previous prototype for function 'do_trap0' [-Wmissing-prototypes]
341 | void do_trap0(struct pt_regs *regs)
| ^
arch/hexagon/kernel/traps.c:341:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
341 | void do_trap0(struct pt_regs *regs)
| ^
| static
arch/hexagon/kernel/traps.c:418:6: warning: no previous prototype for function 'do_machcheck' [-Wmissing-prototypes]
418 | void do_machcheck(struct pt_regs *regs)
| ^
arch/hexagon/kernel/traps.c:418:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
418 | void do_machcheck(struct pt_regs *regs)
| ^
| static
arch/hexagon/kernel/traps.c:428:6: warning: no previous prototype for function 'do_debug_exception' [-Wmissing-prototypes]
428 | void do_debug_exception(struct pt_regs *regs)
| ^
arch/hexagon/kernel/traps.c:428:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
428 | void do_debug_exception(struct pt_regs *regs)
| ^
| staticThese functions are only called from assembly or this translation unit, so just add prototypes right above the definitions to silence the warnings.
--- arch/hexagon/kernel/traps.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/hexagon/kernel/traps.c +4 -0
@@ -281,6 +281,7 @@ static void cache_error(struct pt_regs *regs)/* * General exception handler */ +void do_genex (struct pt_regs *regs);void do_genex (struct pt_regs *regs) {/*
@@ -331,6 +332,7 @@ void do_genex(struct pt_regs *regs) } } +void do_trap0 (struct pt_regs *regs);void do_trap0 (struct pt_regs *regs) {syscall_fn syscall;
@@ -408,6 +410,7 @@ void do_trap0(struct pt_regs *regs)/* * Machine check exception handler */ +void do_machcheck (struct pt_regs *regs);void do_machcheck (struct pt_regs *regs) {/* Halt and catch fire */
@@ -418,6 +421,7 @@ void do_machcheck(struct pt_regs *regs)* Treat this like the old 0xdb trap. */ +void do_debug_exception (struct pt_regs *regs);void do_debug_exception (struct pt_regs *regs) { regs->hvmer.vmest &= ~HVM_VMEST_CAUSE_MSK ;
Signature · 1 line
2.43.0
Quoted 9 lines · On Thu, 30 Nov 2023 15:58:13 -0700 Nathan Chancellor <[email protected]> wrote:
This series fixes all the instances of -Wmissing-prototypes in
arch/hexagon, now that it is enabled globally in a default build. I hope most of the patches will be uncontroversial but please let me know otherwise. This survives ARCH=hexagon defconfig and allmodconfig with LLVM 17.0.6.This is based on Arnd's asm-generic-prototypes branch but it applies cleanly to 6.7-rc3 as well, in case Andrew wants to take it (as far as I remember, he has handled Hexagon patches for me in the past).
Thanks. I added this to mm.git's mm-nonmm-unstable branch.
It precedes Arnd's "Makefile.extrawarn: turn on missing-prototypes globally" so everything lands nicely without bisection issues.
Quoted 11 lines · Nathan Chancellor
Hi all,
This series fixes all the instances of -Wmissing-prototypes in
arch/hexagon, now that it is enabled globally in a default build. I hope most of the patches will be uncontroversial but please let me know otherwise. This survives ARCH=hexagon defconfig and allmodconfig with LLVM 17.0.6.This is based on Arnd's asm-generic-prototypes branch but it applies cleanly to 6.7-rc3 as well, in case Andrew wants to take it (as far as I remember, he has handled Hexagon patches for me in the past).
The patches all look fine to me. I usually prefer to put prototypes in a header even if the only caller is in a .S file rather than adding them in front of the definition, but your version does the job.
Arnd