Skip to content

Commit c718a0b

Browse files
bibo-maochenhuacai
authored andcommitted
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: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 68ffa23 commit c718a0b

File tree

16 files changed

+72
-39
lines changed

16 files changed

+72
-39
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
#ifndef __ASM_EXCEPTION_H
4+
#define __ASM_EXCEPTION_H
5+
6+
#include <asm/ptrace.h>
7+
#include <linux/kprobes.h>
8+
9+
void show_registers(struct pt_regs *regs);
10+
11+
asmlinkage void cache_parity_error(void);
12+
asmlinkage void noinstr do_ade(struct pt_regs *regs);
13+
asmlinkage void noinstr do_ale(struct pt_regs *regs);
14+
asmlinkage void noinstr do_bce(struct pt_regs *regs);
15+
asmlinkage void noinstr do_bp(struct pt_regs *regs);
16+
asmlinkage void noinstr do_ri(struct pt_regs *regs);
17+
asmlinkage void noinstr do_fpu(struct pt_regs *regs);
18+
asmlinkage void noinstr do_fpe(struct pt_regs *regs, unsigned long fcsr);
19+
asmlinkage void noinstr do_lsx(struct pt_regs *regs);
20+
asmlinkage void noinstr do_lasx(struct pt_regs *regs);
21+
asmlinkage void noinstr do_lbt(struct pt_regs *regs);
22+
asmlinkage void noinstr do_watch(struct pt_regs *regs);
23+
asmlinkage void noinstr do_syscall(struct pt_regs *regs);
24+
asmlinkage void noinstr do_reserved(struct pt_regs *regs);
25+
asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp);
26+
asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
27+
unsigned long write, unsigned long address);
28+
29+
asmlinkage void handle_ade(void);
30+
asmlinkage void handle_ale(void);
31+
asmlinkage void handle_bce(void);
32+
asmlinkage void handle_sys(void);
33+
asmlinkage void handle_bp(void);
34+
asmlinkage void handle_ri(void);
35+
asmlinkage void handle_fpu(void);
36+
asmlinkage void handle_fpe(void);
37+
asmlinkage void handle_lsx(void);
38+
asmlinkage void handle_lasx(void);
39+
asmlinkage void handle_lbt(void);
40+
asmlinkage void handle_watch(void);
41+
asmlinkage void handle_reserved(void);
42+
asmlinkage void handle_vint(void);
43+
asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs);
44+
45+
#endif /* __ASM_EXCEPTION_H */

arch/loongarch/include/asm/smp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct secondary_data {
7070
extern struct secondary_data cpuboot_data;
7171

7272
extern asmlinkage void smpboot_entry(void);
73+
extern asmlinkage void start_secondary(void);
7374

7475
extern void calculate_cpu_foreign_map(void);
7576

arch/loongarch/kernel/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ obj-$(CONFIG_CPU_HAS_LBT) += lbt.o
1919

2020
obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o
2121

22+
CFLAGS_module.o += $(call cc-option,-Wno-override-init,)
23+
CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,)
24+
CFLAGS_perf_event.o += $(call cc-option,-Wno-override-init,)
25+
2226
ifdef CONFIG_FUNCTION_TRACER
2327
ifndef CONFIG_DYNAMIC_FTRACE
2428
obj-y += mcount.o ftrace.o

arch/loongarch/kernel/acpi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
281281
pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u\n", pxm, pa->apic_id, node);
282282
}
283283

284-
void __init acpi_numa_arch_fixup(void) {}
285284
#endif
286285

287286
void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)

arch/loongarch/kernel/module-sections.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/elf.h>
77
#include <linux/kernel.h>
88
#include <linux/module.h>
9+
#include <linux/moduleloader.h>
910
#include <linux/ftrace.h>
1011

1112
Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val)

arch/loongarch/kernel/process.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <asm/bootinfo.h>
3838
#include <asm/cpu.h>
3939
#include <asm/elf.h>
40+
#include <asm/exec.h>
4041
#include <asm/fpu.h>
4142
#include <asm/lbt.h>
4243
#include <asm/io.h>

arch/loongarch/kernel/signal.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/audit.h>
1414
#include <linux/cache.h>
1515
#include <linux/context_tracking.h>
16+
#include <linux/entry-common.h>
1617
#include <linux/irqflags.h>
1718
#include <linux/sched.h>
1819
#include <linux/mm.h>
@@ -891,8 +892,8 @@ static unsigned long setup_extcontext(struct extctx_layout *extctx, unsigned lon
891892
return new_sp;
892893
}
893894

894-
void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
895-
struct extctx_layout *extctx)
895+
static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
896+
struct extctx_layout *extctx)
896897
{
897898
unsigned long sp;
898899

@@ -922,7 +923,7 @@ void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
922923
* Atomically swap in the new signal mask, and wait for a signal.
923924
*/
924925

925-
asmlinkage long sys_rt_sigreturn(void)
926+
SYSCALL_DEFINE0(rt_sigreturn)
926927
{
927928
int sig;
928929
sigset_t set;

arch/loongarch/kernel/smp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/cpumask.h>
1414
#include <linux/init.h>
1515
#include <linux/interrupt.h>
16+
#include <linux/profile.h>
1617
#include <linux/seq_file.h>
1718
#include <linux/smp.h>
1819
#include <linux/threads.h>
@@ -556,10 +557,12 @@ void smp_send_stop(void)
556557
smp_call_function(stop_this_cpu, NULL, 0);
557558
}
558559

560+
#ifdef CONFIG_PROFILING
559561
int setup_profiling_timer(unsigned int multiplier)
560562
{
561563
return 0;
562564
}
565+
#endif
563566

564567
static void flush_tlb_all_ipi(void *info)
565568
{

arch/loongarch/kernel/syscall.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/unistd.h>
1414

1515
#include <asm/asm.h>
16+
#include <asm/exception.h>
1617
#include <asm/signal.h>
1718
#include <asm/switch_to.h>
1819
#include <asm-generic/syscalls.h>

arch/loongarch/kernel/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_device *dev)
2929
{
3030
}
3131

32-
irqreturn_t constant_timer_interrupt(int irq, void *data)
32+
static irqreturn_t constant_timer_interrupt(int irq, void *data)
3333
{
3434
int cpu = smp_processor_id();
3535
struct clock_event_device *cd;

0 commit comments

Comments
 (0)