2021-05-19 19:17:50

by zhaoxiao

[permalink] [raw]
Subject: [PATCH] arch/mips/kernel/asm-offsets.c: Make local functions static

Fixes the following W=1 kernel build warning(s):
arch/mips/kernel/asm-offsets.c:26:6: warning: no previous prototype for 'output_ptreg_defines' [-Wmissing-prototypes]
void output_ptreg_defines(void)
^~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:78:6: warning: no previous prototype for 'output_task_defines' [-Wmissing-prototypes]
void output_task_defines(void)
^~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:93:6: warning: no previous prototype for 'output_thread_info_defines' [-Wmissing-prototypes]
void output_thread_info_defines(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:109:6: warning: no previous prototype for 'output_thread_defines' [-Wmissing-prototypes]
void output_thread_defines(void)
^~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:137:6: warning: no previous prototype for 'output_thread_fpu_defines' [-Wmissing-prototypes]
void output_thread_fpu_defines(void)
^~~~~~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:180:6: warning: no previous prototype for 'output_mm_defines' [-Wmissing-prototypes]
void output_mm_defines(void)
^~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:241:6: warning: no previous prototype for 'output_sc_defines' [-Wmissing-prototypes]
void output_sc_defines(void)
^~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:254:6: warning: no previous prototype for 'output_signal_defined' [-Wmissing-prototypes]
void output_signal_defined(void)
^~~~~~~~~~~~~~~~~~~~~
arch/mips/kernel/asm-offsets.c:347:6: warning: no previous prototype for 'output_kvm_defines' [-Wmissing-prototypes]
void output_kvm_defines(void)

Signed-off-by: zhaoxiao <[email protected]>
---
arch/mips/kernel/asm-offsets.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 5735b2cd6f2a..2dc1ecb12c00 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -23,7 +23,7 @@

#include <linux/kvm_host.h>

-void output_ptreg_defines(void)
+static void output_ptreg_defines(void)
{
COMMENT("MIPS pt_regs offsets.");
OFFSET(PT_R0, pt_regs, regs[0]);
@@ -75,7 +75,7 @@ void output_ptreg_defines(void)
BLANK();
}

-void output_task_defines(void)
+static void output_task_defines(void)
{
COMMENT("MIPS task_struct offsets.");
OFFSET(TASK_STATE, task_struct, state);
@@ -90,7 +90,7 @@ void output_task_defines(void)
BLANK();
}

-void output_thread_info_defines(void)
+static void output_thread_info_defines(void)
{
COMMENT("MIPS thread_info offsets.");
OFFSET(TI_TASK, thread_info, task);
@@ -106,7 +106,7 @@ void output_thread_info_defines(void)
BLANK();
}

-void output_thread_defines(void)
+static void output_thread_defines(void)
{
COMMENT("MIPS specific thread_struct offsets.");
OFFSET(THREAD_REG16, task_struct, thread.reg16);
@@ -134,7 +134,7 @@ void output_thread_defines(void)
}

#ifdef CONFIG_MIPS_FP_SUPPORT
-void output_thread_fpu_defines(void)
+static void output_thread_fpu_defines(void)
{
OFFSET(THREAD_FPU, task_struct, thread.fpu);

@@ -177,7 +177,7 @@ void output_thread_fpu_defines(void)
}
#endif

-void output_mm_defines(void)
+static void output_mm_defines(void)
{
COMMENT("Size of struct page");
DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page));
@@ -216,7 +216,7 @@ void output_mm_defines(void)
}

#ifdef CONFIG_32BIT
-void output_sc_defines(void)
+static void output_sc_defines(void)
{
COMMENT("Linux sigcontext offsets.");
OFFSET(SC_REGS, sigcontext, sc_regs);
@@ -238,7 +238,7 @@ void output_sc_defines(void)
#endif

#ifdef CONFIG_64BIT
-void output_sc_defines(void)
+static void output_sc_defines(void)
{
COMMENT("Linux sigcontext offsets.");
OFFSET(SC_REGS, sigcontext, sc_regs);
@@ -251,7 +251,7 @@ void output_sc_defines(void)
}
#endif

-void output_signal_defined(void)
+static void output_signal_defined(void)
{
COMMENT("Linux signal numbers.");
DEFINE(_SIGHUP, SIGHUP);
@@ -344,7 +344,7 @@ void output_pm_defines(void)
#endif

#ifdef CONFIG_MIPS_FP_SUPPORT
-void output_kvm_defines(void)
+static void output_kvm_defines(void)
{
COMMENT(" KVM/MIPS Specific offsets. ");

--
2.20.1





2021-05-19 19:54:48

by Jiaxun Yang

[permalink] [raw]
Subject: Re: [PATCH] arch/mips/kernel/asm-offsets.c: Make local functions static



?? 2021/5/19 14:28, zhaoxiao ะด??:
> Fixes the following W=1 kernel build warning(s):
> arch/mips/kernel/asm-offsets.c:26:6: warning: no previous prototype for 'output_ptreg_defines' [-Wmissing-prototypes]
> void output_ptreg_defines(void)
> ^~~~~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:78:6: warning: no previous prototype for 'output_task_defines' [-Wmissing-prototypes]
> void output_task_defines(void)
> ^~~~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:93:6: warning: no previous prototype for 'output_thread_info_defines' [-Wmissing-prototypes]
> void output_thread_info_defines(void)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:109:6: warning: no previous prototype for 'output_thread_defines' [-Wmissing-prototypes]
> void output_thread_defines(void)
> ^~~~~~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:137:6: warning: no previous prototype for 'output_thread_fpu_defines' [-Wmissing-prototypes]
> void output_thread_fpu_defines(void)
> ^~~~~~~~~~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:180:6: warning: no previous prototype for 'output_mm_defines' [-Wmissing-prototypes]
> void output_mm_defines(void)
> ^~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:241:6: warning: no previous prototype for 'output_sc_defines' [-Wmissing-prototypes]
> void output_sc_defines(void)
> ^~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:254:6: warning: no previous prototype for 'output_signal_defined' [-Wmissing-prototypes]
> void output_signal_defined(void)
> ^~~~~~~~~~~~~~~~~~~~~
> arch/mips/kernel/asm-offsets.c:347:6: warning: no previous prototype for 'output_kvm_defines' [-Wmissing-prototypes]
> void output_kvm_defines(void)

The same... they're supposed to be used by asm-offset generator.
If you don't understand how it works there is an article[1] in Chinese.

You may try __used attribute to bypass these warning.

Thanks.

[1]: https://insidelinuxdev.net/article/a030fi.html

- Jiaxun
>
> Signed-off-by: zhaoxiao <[email protected]>
> ---
> arch/mips/kernel/asm-offsets.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
> index 5735b2cd6f2a..2dc1ecb12c00 100644
> --- a/arch/mips/kernel/asm-offsets.c
> +++ b/arch/mips/kernel/asm-offsets.c
> @@ -23,7 +23,7 @@
>
> #include <linux/kvm_host.h>
>
> -void output_ptreg_defines(void)
> +static void output_ptreg_defines(void)
> {
> COMMENT("MIPS pt_regs offsets.");
> OFFSET(PT_R0, pt_regs, regs[0]);
> @@ -75,7 +75,7 @@ void output_ptreg_defines(void)
> BLANK();
> }
>
> -void output_task_defines(void)
> +static void output_task_defines(void)
> {
> COMMENT("MIPS task_struct offsets.");
> OFFSET(TASK_STATE, task_struct, state);
> @@ -90,7 +90,7 @@ void output_task_defines(void)
> BLANK();
> }
>
> -void output_thread_info_defines(void)
> +static void output_thread_info_defines(void)
> {
> COMMENT("MIPS thread_info offsets.");
> OFFSET(TI_TASK, thread_info, task);
> @@ -106,7 +106,7 @@ void output_thread_info_defines(void)
> BLANK();
> }
>
> -void output_thread_defines(void)
> +static void output_thread_defines(void)
> {
> COMMENT("MIPS specific thread_struct offsets.");
> OFFSET(THREAD_REG16, task_struct, thread.reg16);
> @@ -134,7 +134,7 @@ void output_thread_defines(void)
> }
>
> #ifdef CONFIG_MIPS_FP_SUPPORT
> -void output_thread_fpu_defines(void)
> +static void output_thread_fpu_defines(void)
> {
> OFFSET(THREAD_FPU, task_struct, thread.fpu);
>
> @@ -177,7 +177,7 @@ void output_thread_fpu_defines(void)
> }
> #endif
>
> -void output_mm_defines(void)
> +static void output_mm_defines(void)
> {
> COMMENT("Size of struct page");
> DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page));
> @@ -216,7 +216,7 @@ void output_mm_defines(void)
> }
>
> #ifdef CONFIG_32BIT
> -void output_sc_defines(void)
> +static void output_sc_defines(void)
> {
> COMMENT("Linux sigcontext offsets.");
> OFFSET(SC_REGS, sigcontext, sc_regs);
> @@ -238,7 +238,7 @@ void output_sc_defines(void)
> #endif
>
> #ifdef CONFIG_64BIT
> -void output_sc_defines(void)
> +static void output_sc_defines(void)
> {
> COMMENT("Linux sigcontext offsets.");
> OFFSET(SC_REGS, sigcontext, sc_regs);
> @@ -251,7 +251,7 @@ void output_sc_defines(void)
> }
> #endif
>
> -void output_signal_defined(void)
> +static void output_signal_defined(void)
> {
> COMMENT("Linux signal numbers.");
> DEFINE(_SIGHUP, SIGHUP);
> @@ -344,7 +344,7 @@ void output_pm_defines(void)
> #endif
>
> #ifdef CONFIG_MIPS_FP_SUPPORT
> -void output_kvm_defines(void)
> +static void output_kvm_defines(void)
> {
> COMMENT(" KVM/MIPS Specific offsets. ");
>