Commit c718a0ba authored by Bibo Mao's avatar Bibo Mao Committed by Huacai Chen

LoongArch: Fix some build warnings with W=1

There are some building warnings when building LoongArch kernel with W=1
as following, this patch fixes them.

arch/loongarch/kernel/acpi.c:284:13: warning: no previous prototype for ‘acpi_numa_arch_fixup’ [-Wmissing-prototypes]
  284 | void __init acpi_numa_arch_fixup(void) {}
      |             ^~~~~~~~~~~~~~~~~~~~
arch/loongarch/kernel/time.c:32:13: warning: no previous prototype for ‘constant_timer_interrupt’ [-Wmissing-prototypes]
   32 | irqreturn_t constant_timer_interrupt(int irq, void *data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
arch/loongarch/kernel/traps.c:496:25: warning: no previous prototype for 'do_fpe' [-Wmissing-prototypes]
  496 | asmlinkage void noinstr do_fpe(struct pt_regs *regs
      |                         ^~~~~~
arch/loongarch/kernel/traps.c:813:22: warning: variable ‘opcode’ set but not used [-Wunused-but-set-variable]
  813 |         unsigned int opcode;
      |                      ^~~~~~
arch/loongarch/kernel/signal.c:895:14: warning: no previous prototype for ‘get_sigframe’ [-Wmissing-prototypes]
  895 | void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
      |              ^~~~~~~~~~~~
arch/loongarch/kernel/syscall.c:21:40: warning: initialized field overwritten [-Woverride-init]
   21 | #define __SYSCALL(nr, call)     [nr] = (call),
      |                                        ^
arch/loongarch/kernel/syscall.c:40:14: warning: no previous prototype for ‘do_syscall’ [-Wmissing-prototypes]
   40 | void noinstr do_syscall(struct pt_regs *regs)
      |              ^~~~~~~~~~
arch/loongarch/kernel/smp.c:502:17: warning: no previous prototype for ‘start_secondary’ [-Wmissing-prototypes]
  502 | asmlinkage void start_secondary(void)
      |                 ^~~~~~~~~~~~~~~
arch/loongarch/kernel/process.c:309:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
  309 | unsigned long arch_align_stack(unsigned long sp)
      |               ^~~~~~~~~~~~~~~~
arch/loongarch/kernel/topology.c:13:5: warning: no previous prototype for ‘arch_register_cpu’ [-Wmissing-prototypes]
   13 | int arch_register_cpu(int cpu)
      |     ^~~~~~~~~~~~~~~~~
arch/loongarch/kernel/topology.c:27:6: warning: no previous prototype for ‘arch_unregister_cpu’ [-Wmissing-prototypes]
   27 | void arch_unregister_cpu(int cpu)
      |      ^~~~~~~~~~~~~~~~~~~
arch/loongarch/kernel/module-sections.c:103:5: warning: no previous prototype for ‘module_frob_arch_sections’ [-Wmissing-prototypes]
  103 | int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/loongarch/mm/hugetlbpage.c:56:5: warning: no previous prototype for ‘is_aligned_hugepage_range’ [-Wmissing-prototypes]
   56 | int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 68ffa230
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __ASM_EXCEPTION_H
#define __ASM_EXCEPTION_H
#include <asm/ptrace.h>
#include <linux/kprobes.h>
void show_registers(struct pt_regs *regs);
asmlinkage void cache_parity_error(void);
asmlinkage void noinstr do_ade(struct pt_regs *regs);
asmlinkage void noinstr do_ale(struct pt_regs *regs);
asmlinkage void noinstr do_bce(struct pt_regs *regs);
asmlinkage void noinstr do_bp(struct pt_regs *regs);
asmlinkage void noinstr do_ri(struct pt_regs *regs);
asmlinkage void noinstr do_fpu(struct pt_regs *regs);
asmlinkage void noinstr do_fpe(struct pt_regs *regs, unsigned long fcsr);
asmlinkage void noinstr do_lsx(struct pt_regs *regs);
asmlinkage void noinstr do_lasx(struct pt_regs *regs);
asmlinkage void noinstr do_lbt(struct pt_regs *regs);
asmlinkage void noinstr do_watch(struct pt_regs *regs);
asmlinkage void noinstr do_syscall(struct pt_regs *regs);
asmlinkage void noinstr do_reserved(struct pt_regs *regs);
asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp);
asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
unsigned long write, unsigned long address);
asmlinkage void handle_ade(void);
asmlinkage void handle_ale(void);
asmlinkage void handle_bce(void);
asmlinkage void handle_sys(void);
asmlinkage void handle_bp(void);
asmlinkage void handle_ri(void);
asmlinkage void handle_fpu(void);
asmlinkage void handle_fpe(void);
asmlinkage void handle_lsx(void);
asmlinkage void handle_lasx(void);
asmlinkage void handle_lbt(void);
asmlinkage void handle_watch(void);
asmlinkage void handle_reserved(void);
asmlinkage void handle_vint(void);
asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs);
#endif /* __ASM_EXCEPTION_H */
...@@ -70,6 +70,7 @@ struct secondary_data { ...@@ -70,6 +70,7 @@ struct secondary_data {
extern struct secondary_data cpuboot_data; extern struct secondary_data cpuboot_data;
extern asmlinkage void smpboot_entry(void); extern asmlinkage void smpboot_entry(void);
extern asmlinkage void start_secondary(void);
extern void calculate_cpu_foreign_map(void); extern void calculate_cpu_foreign_map(void);
......
...@@ -19,6 +19,10 @@ obj-$(CONFIG_CPU_HAS_LBT) += lbt.o ...@@ -19,6 +19,10 @@ obj-$(CONFIG_CPU_HAS_LBT) += lbt.o
obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o
CFLAGS_module.o += $(call cc-option,-Wno-override-init,)
CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,)
CFLAGS_perf_event.o += $(call cc-option,-Wno-override-init,)
ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FUNCTION_TRACER
ifndef CONFIG_DYNAMIC_FTRACE ifndef CONFIG_DYNAMIC_FTRACE
obj-y += mcount.o ftrace.o obj-y += mcount.o ftrace.o
......
...@@ -281,7 +281,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) ...@@ -281,7 +281,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u\n", pxm, pa->apic_id, node); pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u\n", pxm, pa->apic_id, node);
} }
void __init acpi_numa_arch_fixup(void) {}
#endif #endif
void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size) void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/elf.h> #include <linux/elf.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleloader.h>
#include <linux/ftrace.h> #include <linux/ftrace.h>
Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val) Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val)
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/elf.h> #include <asm/elf.h>
#include <asm/exec.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/lbt.h> #include <asm/lbt.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/audit.h> #include <linux/audit.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/context_tracking.h> #include <linux/context_tracking.h>
#include <linux/entry-common.h>
#include <linux/irqflags.h> #include <linux/irqflags.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -891,7 +892,7 @@ static unsigned long setup_extcontext(struct extctx_layout *extctx, unsigned lon ...@@ -891,7 +892,7 @@ static unsigned long setup_extcontext(struct extctx_layout *extctx, unsigned lon
return new_sp; return new_sp;
} }
void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
struct extctx_layout *extctx) struct extctx_layout *extctx)
{ {
unsigned long sp; unsigned long sp;
...@@ -922,7 +923,7 @@ void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, ...@@ -922,7 +923,7 @@ void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
* Atomically swap in the new signal mask, and wait for a signal. * Atomically swap in the new signal mask, and wait for a signal.
*/ */
asmlinkage long sys_rt_sigreturn(void) SYSCALL_DEFINE0(rt_sigreturn)
{ {
int sig; int sig;
sigset_t set; sigset_t set;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/profile.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/threads.h> #include <linux/threads.h>
...@@ -556,10 +557,12 @@ void smp_send_stop(void) ...@@ -556,10 +557,12 @@ void smp_send_stop(void)
smp_call_function(stop_this_cpu, NULL, 0); smp_call_function(stop_this_cpu, NULL, 0);
} }
#ifdef CONFIG_PROFILING
int setup_profiling_timer(unsigned int multiplier) int setup_profiling_timer(unsigned int multiplier)
{ {
return 0; return 0;
} }
#endif
static void flush_tlb_all_ipi(void *info) static void flush_tlb_all_ipi(void *info)
{ {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/unistd.h> #include <linux/unistd.h>
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/exception.h>
#include <asm/signal.h> #include <asm/signal.h>
#include <asm/switch_to.h> #include <asm/switch_to.h>
#include <asm-generic/syscalls.h> #include <asm-generic/syscalls.h>
......
...@@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_device *dev) ...@@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_device *dev)
{ {
} }
irqreturn_t constant_timer_interrupt(int irq, void *data) static irqreturn_t constant_timer_interrupt(int irq, void *data)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
struct clock_event_device *cd; struct clock_event_device *cd;
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/acpi.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -7,6 +8,8 @@ ...@@ -7,6 +8,8 @@
#include <linux/percpu.h> #include <linux/percpu.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <acpi/processor.h>
static DEFINE_PER_CPU(struct cpu, cpu_devices); static DEFINE_PER_CPU(struct cpu, cpu_devices);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/kgdb.h> #include <linux/kgdb.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
#include <linux/kprobes.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
#include <asm/branch.h> #include <asm/branch.h>
#include <asm/break.h> #include <asm/break.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/exception.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/lbt.h> #include <asm/lbt.h>
#include <asm/inst.h> #include <asm/inst.h>
...@@ -53,21 +53,6 @@ ...@@ -53,21 +53,6 @@
#include "access-helper.h" #include "access-helper.h"
extern asmlinkage void handle_ade(void);
extern asmlinkage void handle_ale(void);
extern asmlinkage void handle_bce(void);
extern asmlinkage void handle_sys(void);
extern asmlinkage void handle_bp(void);
extern asmlinkage void handle_ri(void);
extern asmlinkage void handle_fpu(void);
extern asmlinkage void handle_fpe(void);
extern asmlinkage void handle_lbt(void);
extern asmlinkage void handle_lsx(void);
extern asmlinkage void handle_lasx(void);
extern asmlinkage void handle_reserved(void);
extern asmlinkage void handle_watch(void);
extern asmlinkage void handle_vint(void);
static void show_backtrace(struct task_struct *task, const struct pt_regs *regs, static void show_backtrace(struct task_struct *task, const struct pt_regs *regs,
const char *loglvl, bool user) const char *loglvl, bool user)
{ {
...@@ -439,8 +424,8 @@ static inline void setup_vint_size(unsigned int size) ...@@ -439,8 +424,8 @@ static inline void setup_vint_size(unsigned int size)
* happen together with Overflow or Underflow, and `ptrace' can set * happen together with Overflow or Underflow, and `ptrace' can set
* any bits. * any bits.
*/ */
void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, static void force_fcsr_sig(unsigned long fcsr,
struct task_struct *tsk) void __user *fault_addr, struct task_struct *tsk)
{ {
int si_code = FPE_FLTUNK; int si_code = FPE_FLTUNK;
...@@ -458,7 +443,7 @@ void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, ...@@ -458,7 +443,7 @@ void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr,
force_sig_fault(SIGFPE, si_code, fault_addr); force_sig_fault(SIGFPE, si_code, fault_addr);
} }
int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr) static int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr)
{ {
int si_code; int si_code;
...@@ -824,7 +809,7 @@ asmlinkage void noinstr do_watch(struct pt_regs *regs) ...@@ -824,7 +809,7 @@ asmlinkage void noinstr do_watch(struct pt_regs *regs)
asmlinkage void noinstr do_ri(struct pt_regs *regs) asmlinkage void noinstr do_ri(struct pt_regs *regs)
{ {
int status = SIGILL; int status = SIGILL;
unsigned int opcode = 0; unsigned int __maybe_unused opcode;
unsigned int __user *era = (unsigned int __user *)exception_era(regs); unsigned int __user *era = (unsigned int __user *)exception_era(regs);
irqentry_state_t state = irqentry_enter(regs); irqentry_state_t state = irqentry_enter(regs);
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
#include <linux/kprobes.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/kfence.h> #include <linux/kfence.h>
#include <asm/branch.h> #include <asm/branch.h>
#include <asm/exception.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
......
...@@ -50,18 +50,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, ...@@ -50,18 +50,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,
return (pte_t *) pmd; return (pte_t *) pmd;
} }
/*
* This function checks for proper alignment of input addr and len parameters.
*/
int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
{
if (len & ~HPAGE_MASK)
return -EINVAL;
if (addr & ~HPAGE_MASK)
return -EINVAL;
return 0;
}
int pmd_huge(pmd_t pmd) int pmd_huge(pmd_t pmd)
{ {
return (pmd_val(pmd) & _PAGE_HUGE) != 0; return (pmd_val(pmd) & _PAGE_HUGE) != 0;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include <asm/io.h> #include <asm/io.h>
#include <asm-generic/early_ioremap.h>
void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size) void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size)
{ {
......
...@@ -261,7 +261,7 @@ unsigned long pcpu_handlers[NR_CPUS]; ...@@ -261,7 +261,7 @@ unsigned long pcpu_handlers[NR_CPUS];
#endif #endif
extern long exception_handlers[VECSIZE * 128 / sizeof(long)]; extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
void setup_tlb_handler(int cpu) static void setup_tlb_handler(int cpu)
{ {
setup_ptwalker(); setup_ptwalker();
local_flush_tlb_all(); local_flush_tlb_all();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment