Skip to contentSkip to conversation

hexagon: Fix up instances of -Wmissing-prototypes

PATCH Applied Nathan Chancellor 3 participants 22 messages Nov 30, 2023 – Dec 1, 2023 Qualcomm hexagon architecture

lore
Share & tools
lore
#0 lore raw

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]>
#1 lore raw

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)
        | ^
        | static

1 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
index 650bca92f0b7..3204e9ba6d6f 100644
@@ -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
#2 lore raw

PATCH 2/19 hexagon: mm: Mark paging_init() as static

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 146115c9de61..f164b377b93b 100644
@@ -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
#3 lore raw

PATCH 3/19 hexagon: mm: Include asm/setup.h for setup_arch_memory()'s prototype

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

The 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
index f164b377b93b..3458f39ca2ac 100644
@@ -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
#4 lore raw

PATCH 4/19 hexagon: smp: Mark handle_ipi() and start_secondary() as static

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

2 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
index 4e8bee25b8c6..608884bc3396 100644
@@ -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
#5 lore raw

PATCH 5/19 hexagon: vm_fault: Mark do_page_fault() as static

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 7295ea3f8cc8..ab0f0a791e00 100644
@@ -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
#6 lore raw

PATCH 6/19 hexagon: vm_fault: Include asm/vm_fault.h for prototypes

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

The 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
index ab0f0a791e00..3771fb453898 100644
@@ -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
#7 lore raw

PATCH 7/19 hexagon: vm_tlb: Include asm/tlbflush.h for prototypes

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

6 warnings generated.

---
 arch/hexagon/mm/vm_tlb.c | 1 +
 1 file changed, 1 insertion(+)
arch/hexagon/mm/vm_tlb.c +1 -0
index 53482f2a9ff9..8b6405e2234b 100644
@@ -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
#8 lore raw

PATCH 8/19 hexagon: time: Include asm/time.h for prototypes

In reply to Nathan Chancellor

Clang 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
index febc95714d75..59f00bf54fe9 100644
@@ -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
#9 lore raw

PATCH 9/19 hexagon: time: Mark time_init_deferred() as static

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 59f00bf54fe9..f04dbe4f8a4c 100644
@@ -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
#10 lore raw

PATCH 10/19 hexagon: time: Include asm/delay.h for prototypes

In reply to Nathan Chancellor

Clang 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
index f04dbe4f8a4c..f0f207e2a694 100644
@@ -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
#11 lore raw

PATCH 11/19 hexagon: signal: Switch to SYSCALL_DEFINE0 for sys_rt_sigreturn()

In reply to Nathan Chancellor

Clang 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)
        |            ^
        |            static

1 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
index bcba31e9e0ae..d301f4621553 100644
@@ -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
#12 lore raw

PATCH 12/19 hexagon: reset: Include linux/reboot.h for prototypes

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

3 warnings generated.

---
 arch/hexagon/kernel/reset.c | 1 +
 1 file changed, 1 insertion(+)
arch/hexagon/kernel/reset.c +1 -0
index da36114d928f..efd70a8d2526 100644
@@ -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
#13 lore raw

PATCH 13/19 hexagon: process: Include linux/cpu.h for arch_cpu_idle() prototype

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index dd7f74ea2c20..51e37fc92857 100644
@@ -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
#14 lore raw

PATCH 14/19 hexagon: process: Add internal prototype for do_work_pending()

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 51e37fc92857..2a77bfd75694 100644
@@ -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
#15 lore raw

PATCH 15/19 hexagon: vdso: Include asm/elf.h for arch_setup_additional_pages() prototype

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

1 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
index b70970ac809f..2e4872d62124 100644
@@ -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
#16 lore raw

PATCH 16/19 hexagon: vm_events: Remove unused dummy_handler()

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 59ef72e4a4e5..2b881a89b206 100644
@@ -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
#17 lore raw

PATCH 17/19 hexagon: irq: Add prototype for arch_do_IRQ()

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 1f7f1292f701..a60d26754caa 100644
@@ -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
#18 lore raw

PATCH 18/19 hexagon: traps: Remove sys_syscall()

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

This 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
index 6447763ce5a9..3f6ff43cb514 100644
@@ -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
#19 lore raw

PATCH 19/19 hexagon: traps: Add internal prototypes for functions only called from asm

In reply to Nathan Chancellor

Clang 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)
        | ^
        | static

These 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
index 3f6ff43cb514..75e062722d28 100644
@@ -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
#20 lore raw
In reply to Nathan Chancellor
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.

#21 lore raw
In reply to Nathan Chancellor
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