Skip to contentSkip to conversation

mm/init/kernel: missing-prototypes warnings

PATCH In review Arnd Bergmann 7 participants 24 messages May 17, 2023 – Jun 22, 2023

Subsystems (26)
lore
Share & tools
lore
#0 lore raw

cover mm/init/kernel: missing-prototypes warnings

From: Arnd Bergmann <[email protected]>

These are patches addressing -Wmissing-prototypes warnings in common kernel code and memory management code files that usually get merged through the -mm tree.

Andrew, can you pick these up in the -mm tree?

Arnd

Arnd Bergmann (14):
mm: percpu: unhide pcpu_embed_first_chunk prototype
mm: page_poison: always declare __kernel_map_pages() function
mm: sparse: mark populate_section_memmap() static
audit: avoid missing-prototype warnings
lib: devmem_is_allowed: include linux/io.h
locking: add lockevent_read() prototype
panic: hide unused global functions
panic: make function declarations visible
kunit: include debugfs header file
suspend: add a arch_resume_nosmt() prototype
init: consolidate prototypes in linux/init.h
init: move cifs_root_data() prototype into linux/mount.h
thread_info: move function declarations to linux/thread_info.h
time_namespace: always provide arch_get_vdso_data() prototype for vdso

 arch/arm/include/asm/irq.h           |  1 -
 arch/arm64/include/asm/thread_info.h |  4 ----
 arch/microblaze/include/asm/setup.h  |  2 --
 arch/mips/include/asm/irq.h          |  1 -
 arch/parisc/kernel/smp.c             |  1 -
 arch/powerpc/include/asm/irq.h       |  1 -
 arch/riscv/include/asm/irq.h         |  2 --
 arch/riscv/include/asm/timex.h       |  2 --
 arch/s390/include/asm/thread_info.h  |  3 ---
 arch/s390/kernel/entry.h             |  2 --
 arch/sh/include/asm/irq.h            |  1 -
 arch/sh/include/asm/rtc.h            |  2 --
 arch/sh/include/asm/thread_info.h    |  3 ---
 arch/sparc/include/asm/irq_32.h      |  1 -
 arch/sparc/include/asm/irq_64.h      |  1 -
 arch/sparc/include/asm/timer_64.h    |  1 -
 arch/sparc/kernel/kernel.h           |  4 ----
 arch/x86/include/asm/irq.h           |  2 --
 arch/x86/include/asm/mem_encrypt.h   |  3 ---
 arch/x86/include/asm/thread_info.h   |  3 ---
 arch/x86/include/asm/time.h          |  1 -
 arch/x86/include/asm/tsc.h           |  1 -
 include/asm-generic/bug.h            |  5 +++--
 include/linux/acpi.h                 |  3 ++-
 include/linux/audit.h                |  2 --
 include/linux/audit_arch.h           |  2 ++
 include/linux/delay.h                |  1 +
 include/linux/init.h                 | 20 ++++++++++++++++++++
 include/linux/mm.h                   |  3 +--
 include/linux/mount.h                |  2 ++
 include/linux/panic.h                |  3 +++
 include/linux/percpu.h               |  2 --
 include/linux/suspend.h              |  2 ++
 include/linux/thread_info.h          |  5 +++++
 include/linux/time_namespace.h       |  3 ++-
 init/do_mounts.c                     |  2 --
 init/main.c                          | 18 ------------------
 kernel/audit.h                       |  2 +-
 kernel/locking/lock_events.h         |  4 ++++
 kernel/panic.c                       |  3 +--
 lib/devmem_is_allowed.c              |  1 +
 lib/kunit/debugfs.c                  |  1 +
 mm/sparse.c                          |  2 +-
 43 files changed, 52 insertions(+), 76 deletions(-)
Signature · 39 lines
2.39.2


Cc: Russell King <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: [email protected]
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: Eric Paris <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Dennis Zhou <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
#1 lore raw

PATCH 1/14 mm: percpu: unhide pcpu_embed_first_chunk prototype

From: Arnd Bergmann <[email protected]>

This function is called whenever CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK or CONFIG_HAVE_SETUP_PER_CPU_AREA, but only declared when the former is set:

mm/percpu.c:3055:12: error: no previous prototype for 'pcpu_embed_first_chunk' [-Werror=missing-prototypes]

There is no real point in hiding declarations, so just remove the #ifdef here.

---
 include/linux/percpu.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/percpu.h +0 -2
index 1338ea2aa720..42125cf9c506 100644
@@ -103,12 +103,10 @@ extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
 extern void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 					 void *base_addr);
 
-#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
 extern int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
 				size_t atom_size,
 				pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
 				pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn);
-#endif
 
 #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
 void __init pcpu_populate_pte(unsigned long addr);
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/14 mm: page_poison: always declare __kernel_map_pages() function

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The __kernel_map_pages() function is mainly used for CONFIG_DEBUG_PAGEALLOC, but has a number of architecture specific definitions that may also be used in other configurations, as well as a global fallback definition for architectures that do not support DEBUG_PAGEALLOC.

When the option is disabled, any definitions without the prototype cause a warning:

mm/page_poison.c:102:6: error: no previous prototype for '__kernel_map_pages' [-Werror=missing-prototypes]

The function is a trivial nop here, so just declare it anyway to avoid the warning.

---
 include/linux/mm.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/mm.h +1 -2
index 27ce77080c79..e95d7c575ea6 100644
@@ -3453,13 +3453,12 @@ static inline bool debug_pagealloc_enabled_static(void)
 	return static_branch_unlikely(&_debug_pagealloc_enabled);
 }
 
-#ifdef CONFIG_DEBUG_PAGEALLOC
 /*
  * To support DEBUG_PAGEALLOC architecture must ensure that
  * __kernel_map_pages() never fails
  */
 extern void __kernel_map_pages(struct page *page, int numpages, int enable);
-
+#ifdef CONFIG_DEBUG_PAGEALLOC
 static inline void debug_pagealloc_map_pages(struct page *page, int numpages)
 {
 	if (debug_pagealloc_enabled_static())
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/14 mm: sparse: mark populate_section_memmap() static

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

There are two definitions of this function, but the second one lacks the 'static' annotation:

mm/sparse.c:704:25: error: no previous prototype for 'populate_section_memmap' [-Werror=missing-prototypes]

---
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/sparse.c +1 -1
index c2afdb26039e..b8d5d58fe240 100644
@@ -701,7 +701,7 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)
 	return rc;
 }
 #else
-struct page * __meminit populate_section_memmap(unsigned long pfn,
+static struct page * __meminit populate_section_memmap(unsigned long pfn,
 		unsigned long nr_pages, int nid, struct vmem_altmap *altmap,
 		struct dev_pagemap *pgmap)
 {
Signature · 1 line
2.39.2
#4 lore raw

PATCH 4/14 audit: avoid missing-prototype warnings

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Building with 'make W=1' reveals two function definitions without a previous prototype in the audit code:

lib/compat_audit.c:32:5: error: no previous prototype for 'audit_classify_compat_syscall' [-Werror=missing-prototypes] kernel/audit.c:1813:14: error: no previous prototype for 'audit_serial' [-Werror=missing-prototypes]

The first one needs a declaration from linux/audit.h but cannot include that header without causing conflicting (compat) syscall number definitions, so move the it into linux/audit_arch.h.

The second one is declared conditionally based on CONFIG_AUDITSYSCALL but needed as a local function even when that option is disabled, so move the declaration out of the #ifdef block.

---
 include/linux/audit.h      | 2 --
 include/linux/audit_arch.h | 2 ++
 kernel/audit.h             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
include/linux/audit.h +0 -2
index 31086a72e32a..6a3a9e122bb5 100644
@@ -130,8 +130,6 @@ extern unsigned compat_dir_class[];
 extern unsigned compat_chattr_class[];
 extern unsigned compat_signal_class[];
 
-extern int audit_classify_compat_syscall(int abi, unsigned syscall);
-
 /* audit_names->type values */
 #define	AUDIT_TYPE_UNKNOWN	0	/* we don't know yet */
 #define	AUDIT_TYPE_NORMAL	1	/* a "normal" audit record */
include/linux/audit_arch.h +2 -0
index 8fdb1afe251a..0e34d673ef17 100644
@@ -21,4 +21,6 @@ enum auditsc_class_t {
 	AUDITSC_NVALS /* count */
 };
 
+extern int audit_classify_compat_syscall(int abi, unsigned syscall);
+
 #endif
kernel/audit.h +1 -1
index c57b008b9914..94738bce40b2 100644
@@ -259,8 +259,8 @@ extern struct tty_struct *audit_get_tty(void);
 extern void audit_put_tty(struct tty_struct *tty);
 
 /* audit watch/mark/tree functions */
-#ifdef CONFIG_AUDITSYSCALL
 extern unsigned int audit_serial(void);
+#ifdef CONFIG_AUDITSYSCALL
 extern int auditsc_get_stamp(struct audit_context *ctx,
 			      struct timespec64 *t, unsigned int *serial);
 
Signature · 1 line
2.39.2
maintainer
#5 lore raw

Re: [PATCH 4/14] audit: avoid missing-prototype warnings

Quoted 51 lines · On May 17, 2023 Arnd Bergmann <[email protected]> wrote:

Building with 'make W=1' reveals two function definitions without a previous prototype in the audit code:

lib/compat_audit.c:32:5: error: no previous prototype for 'audit_classify_compat_syscall' [-Werror=missing-prototypes] kernel/audit.c:1813:14: error: no previous prototype for 'audit_serial' [-Werror=missing-prototypes]

The first one needs a declaration from linux/audit.h but cannot include that header without causing conflicting (compat) syscall number definitions, so move the it into linux/audit_arch.h.

The second one is declared conditionally based on CONFIG_AUDITSYSCALL but needed as a local function even when that option is disabled, so move the declaration out of the #ifdef block.

---
 include/linux/audit.h      | 2 --
 include/linux/audit_arch.h | 2 ++
 kernel/audit.h             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
include/linux/audit.h +0 -2
index 31086a72e32a..6a3a9e122bb5 100644
@@ -130,8 +130,6 @@ extern unsigned compat_dir_class[];
 extern unsigned compat_chattr_class[];
 extern unsigned compat_signal_class[];
 
-extern int audit_classify_compat_syscall(int abi, unsigned syscall);
-
 /* audit_names->type values */
 #define	AUDIT_TYPE_UNKNOWN	0	/* we don't know yet */
 #define	AUDIT_TYPE_NORMAL	1	/* a "normal" audit record */
include/linux/audit_arch.h +2 -0
index 8fdb1afe251a..0e34d673ef17 100644
@@ -21,4 +21,6 @@ enum auditsc_class_t {
 	AUDITSC_NVALS /* count */
 };
 
+extern int audit_classify_compat_syscall(int abi, unsigned syscall);
+
 #endif
kernel/audit.h +0 -0
index c57b008b9914..94738bce40b2 100644

kernel/audit.h extern struct tty_struct *audit_get_tty(void); · line 265

Quoted 8 lines
kernel/audit.h +1 -1
@@ -259,8 +259,8 @@ extern struct tty_struct *audit_get_tty(void);
 extern void audit_put_tty(struct tty_struct *tty);
 
 /* audit watch/mark/tree functions */
-#ifdef CONFIG_AUDITSYSCALL
 extern unsigned int audit_serial(void);
+#ifdef CONFIG_AUDITSYSCALL
 extern int auditsc_get_stamp(struct audit_context *ctx,
 			      struct timespec64 *t, unsigned int *serial);

We probably should move the audit_serial() and auditsc_get_stamp() away from the watch/mark/tree functions, but that isn't your problem.

Anyway, this looks okay to me; do you have a problem if I merge this via the audit/next branch or were you hoping to have this go in through a different tree?

--
paul-moore.com

maintainer
#6 lore raw

Re: [PATCH 4/14] audit: avoid missing-prototype warnings

Quoted 8 lines · Paul Moore

On May 17, 2023 Arnd Bergmann <[email protected]> wrote:

We probably should move the audit_serial() and auditsc_get_stamp() away from the watch/mark/tree functions, but that isn't your problem.

Anyway, this looks okay to me; do you have a problem if I merge this via the audit/next branch or were you hoping to have this go in through a different tree?

Merging it through your tree is probably best, Andrew can either pick the ones that nobody else took, or I can resend the rest.

Arnd

maintainer
#7 lore raw

Re: [PATCH 4/14] audit: avoid missing-prototype warnings

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Paul Moore

On May 17, 2023 Arnd Bergmann <[email protected]> wrote:

We probably should move the audit_serial() and auditsc_get_stamp() away from the watch/mark/tree functions, but that isn't your problem.

Quoted 6 lines
Quoted 3 lines

Anyway, this looks okay to me; do you have a problem if I merge this via the audit/next branch or were you hoping to have this go in through a different tree?

Merging it through your tree is probably best, Andrew can either pick the ones that nobody else took, or I can resend the rest.

Easy enough, merged to audit/next, thanks.

Signature · 1 line
paul-moore.com
#8 lore raw

PATCH 5/14 lib: devmem_is_allowed: include linux/io.h

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The devmem_is_allowed() function is defined in a file of the same name, but the declaration is in asm/io.h, which is not included there, causing a W=1 warning:

lib/devmem_is_allowed.c:20:5: error: no previous prototype for 'devmem_is_allowed' [-Werror=missing-prototypes]

Include the appropriate header to avoid the warning.

---
 lib/devmem_is_allowed.c | 1 +
 1 file changed, 1 insertion(+)
lib/devmem_is_allowed.c +1 -0
index 60be9e24bd57..9c060c69f134 100644
@@ -10,6 +10,7 @@
 
 #include <linux/mm.h>
 #include <linux/ioport.h>
+#include <linux/io.h>
 
 /*
  * devmem_is_allowed() checks to see if /dev/mem access to a certain address
Signature · 1 line
2.39.2
#9 lore raw

PATCH 6/14 locking: add lockevent_read() prototype

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

lockevent_read() has a __weak definition and the only caller in kernel/locking/lock_events.c, plus a strong definition in qspinlock_stat.h that overrides it, but no other declaration. This causes a W=1 warning:

kernel/locking/lock_events.c:61:16: error: no previous prototype for 'lockevent_read' [-Werror=missing-prototypes]

Add shared prototype to avoid the warnings.

---
 kernel/locking/lock_events.h | 4 ++++
 1 file changed, 4 insertions(+)
kernel/locking/lock_events.h +4 -0
index 8c7e7d25f09c..a6016b91803d 100644
@@ -57,4 +57,8 @@ static inline void __lockevent_add(enum lock_events event, int inc)
 #define lockevent_cond_inc(ev, c)
 
 #endif /* CONFIG_LOCK_EVENT_COUNTS */
+
+ssize_t lockevent_read(struct file *file, char __user *user_buf,
+		       size_t count, loff_t *ppos);
+
 #endif /* __LOCKING_LOCK_EVENTS_H */
Signature · 1 line
2.39.2
#10 lore raw

PATCH 7/14 panic: hide unused global functions

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Building with W=1 shows warnings about two functions that have no declaration or caller in certain configurations:

kernel/panic.c:688:6: error: no previous prototype for 'warn_slowpath_fmt' [-Werror=missing-prototypes] kernel/panic.c:710:6: error: no previous prototype for '__warn_printk' [-Werror=missing-prototypes]

Enclose the definition in the same #ifdef check as the declaration.

---
 kernel/panic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/panic.c +1 -2
index 886d2ebd0a0d..10effe40a3fa 100644
@@ -684,6 +684,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 	add_taint(taint, LOCKDEP_STILL_OK);
 }
 
+#ifdef CONFIG_BUG
 #ifndef __WARN_FLAGS
 void warn_slowpath_fmt(const char *file, int line, unsigned taint,
 		       const char *fmt, ...)
@@ -722,8 +723,6 @@ void __warn_printk(const char *fmt, ...)
 EXPORT_SYMBOL(__warn_printk);
 #endif
 
-#ifdef CONFIG_BUG
-
 /* Support resetting WARN*_ONCE state */
 
 static int clear_warn_once_set(void *data, u64 val)
Signature · 1 line
2.39.2
#11 lore raw

PATCH 8/14 panic: make function declarations visible

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

A few panic() related functions have a global definition but not declaration, which causes a warning with W=1:

kernel/panic.c:710:6: error: no previous prototype for '__warn_printk' [-Werror=missing-prototypes] kernel/panic.c:756:24: error: no previous prototype for '__stack_chk_fail' [-Werror=missing-prototypes] kernel/exit.c:1917:32: error: no previous prototype for 'abort' [-Werror=missing-prototypes]

__warn_printk() is called both as a global function when CONFIG_BUG is enabled, and as a local function in other configs. The other two here are called indirectly from generated or assembler code.

Add prototypes for all of these.

---
 include/asm-generic/bug.h | 5 +++--
 include/linux/panic.h     | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)
include/asm-generic/bug.h +3 -2
index 4050b191e1a9..6e794420bd39 100644
@@ -87,10 +87,12 @@ struct bug_entry {
  *
  * Use the versions with printk format strings to provide better diagnostics.
  */
-#ifndef __WARN_FLAGS
 extern __printf(4, 5)
 void warn_slowpath_fmt(const char *file, const int line, unsigned taint,
 		       const char *fmt, ...);
+extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
+
+#ifndef __WARN_FLAGS
 #define __WARN()		__WARN_printf(TAINT_WARN, NULL)
 #define __WARN_printf(taint, arg...) do {				\
 		instrumentation_begin();				\
@@ -98,7 +100,6 @@ void warn_slowpath_fmt(const char *file, const int line, unsigned taint,
 		instrumentation_end();					\
 	} while (0)
 #else
-extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
 #define __WARN()		__WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
 #define __WARN_printf(taint, arg...) do {				\
 		instrumentation_begin();				\
include/linux/panic.h +3 -0
index 979b776e3bcb..6717b15e798c 100644
@@ -32,6 +32,9 @@ extern int sysctl_panic_on_stackoverflow;
 
 extern bool crash_kexec_post_notifiers;
 
+extern void __stack_chk_fail(void);
+void abort(void);
+
 /*
  * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
  * holds a CPU number which is executing panic() currently. A value of
Signature · 1 line
2.39.2
#12 lore raw

PATCH 9/14 kunit: include debugfs header file

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

An extra #include statement is needed to ensure the prototypes for debugfs interfaces are visible, avoiding this warning:

lib/kunit/debugfs.c:28:6: error: no previous prototype for 'kunit_debugfs_cleanup' [-Werror=missing-prototypes] lib/kunit/debugfs.c:33:6: error: no previous prototype for 'kunit_debugfs_init' [-Werror=missing-prototypes] lib/kunit/debugfs.c:102:6: error: no previous prototype for 'kunit_debugfs_create_suite' [-Werror=missing-prototypes] lib/kunit/debugfs.c:118:6: error: no previous prototype for 'kunit_debugfs_destroy_suite' [-Werror=missing-prototypes]

---
 lib/kunit/debugfs.c | 1 +
 1 file changed, 1 insertion(+)
lib/kunit/debugfs.c +1 -0
index b08bb1fba106..22c5c496a68f 100644
@@ -10,6 +10,7 @@
 #include <kunit/test.h>
 
 #include "string-stream.h"
+#include "debugfs.h"
 
 #define KUNIT_DEBUGFS_ROOT             "kunit"
 #define KUNIT_DEBUGFS_RESULTS          "results"
Signature · 1 line
2.39.2
Reviewed-by on v1 9/14
#13 lore raw

Re: [PATCH 09/14] kunit: include debugfs header file

Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

An extra #include statement is needed to ensure the prototypes for debugfs interfaces are visible, avoiding this warning:

Quoted 7 lines

lib/kunit/debugfs.c:28:6: error: no previous prototype for 'kunit_debugfs_cleanup' [-Werror=missing-prototypes] lib/kunit/debugfs.c:33:6: error: no previous prototype for 'kunit_debugfs_init' [-Werror=missing-prototypes] lib/kunit/debugfs.c:102:6: error: no previous prototype for 'kunit_debugfs_create_suite' [-Werror=missing-prototypes] lib/kunit/debugfs.c:118:6: error: no previous prototype for 'kunit_debugfs_destroy_suite' [-Werror=missing-prototypes]

---

Nice catch, thanks. I'm fine with this going in via -mm, but if you'd prefer it to go via kselftest/kunit, let me know.

Cheers,
-- David

Quoted 22 lines
 lib/kunit/debugfs.c | 1 +
 1 file changed, 1 insertion(+)
lib/kunit/debugfs.c +1 -1
index b08bb1fba106..22c5c496a68f 100644
@@ -10,6 +10,7 @@
 #include <kunit/test.h>
 
 #include "string-stream.h"
+#include "debugfs.h"
 
 #define KUNIT_DEBUGFS_ROOT             "kunit"
 #define KUNIT_DEBUGFS_RESULTS          "results"
--

2.39.2

--
You received this message because you are subscribed to the Google Groups "KUnit Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20230517131102.934196-10-arnd%40kernel.org.

#14 lore raw

PATCH 10/14 suspend: add a arch_resume_nosmt() prototype

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The arch_resume_nosmt() has a __weak definition, plus an x86 specific override, but no prototype that ensures the two have the same arguments. This causes a W=1 warning:

arch/x86/power/hibernate.c:189:5: error: no previous prototype for 'arch_resume_nosmt' [-Werror=missing-prototypes]

Add the prototype in linux/suspend.h, which is included in both places.

---
 include/linux/suspend.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/suspend.h +2 -0
index f16653f7be32..bc911fecb8e8 100644
@@ -472,6 +472,8 @@ static inline int hibernate_quiet_exec(int (*func)(void *data), void *data) {
 }
 #endif /* CONFIG_HIBERNATION */
 
+int arch_resume_nosmt(void);
+
 #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV
 int is_hibernate_resume_dev(dev_t dev);
 #else
Signature · 1 line
2.39.2
maintainer Acked-by on v1 10/14
#15 lore raw

Re: [PATCH 10/14] suspend: add a arch_resume_nosmt() prototype

Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The arch_resume_nosmt() has a __weak definition, plus an x86 specific override, but no prototype that ensures the two have the same arguments. This causes a W=1 warning:

Quoted 6 lines

arch/x86/power/hibernate.c:189:5: error: no previous prototype for 'arch_resume_nosmt' [-Werror=missing-prototypes]

Add the prototype in linux/suspend.h, which is included in both places.

Do you want me to pick this up?

If not

Quoted 20 lines
---
 include/linux/suspend.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/suspend.h +2 -1
index f16653f7be32..bc911fecb8e8 100644
@@ -472,6 +472,8 @@ static inline int hibernate_quiet_exec(int (*func)(void *data), void *data) {
 }
 #endif /* CONFIG_HIBERNATION */
 
+int arch_resume_nosmt(void);
+
 #ifdef CONFIG_HIBERNATION_SNAPSHOT_DEV
 int is_hibernate_resume_dev(dev_t dev);
 #else
--

2.39.2

maintainer
#16 lore raw

Re: [PATCH 10/14] suspend: add a arch_resume_nosmt() prototype

Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The arch_resume_nosmt() has a __weak definition, plus an x86 specific override, but no prototype that ensures the two have the same arguments. This causes a W=1 warning:

Quoted 8 lines
Quoted 6 lines

arch/x86/power/hibernate.c:189:5: error: no previous prototype for 'arch_resume_nosmt' [-Werror=missing-prototypes]

Add the prototype in linux/suspend.h, which is included in both places.

Do you want me to pick this up?

Yes, please do. Thanks,

Arnd

#17 lore raw

Re: [PATCH 10/14] suspend: add a arch_resume_nosmt() prototype

Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The arch_resume_nosmt() has a __weak definition, plus an x86 specific override, but no prototype that ensures the two have the same arguments. This causes a W=1 warning:

arch/x86/power/hibernate.c:189:5: error: no previous prototype for 'arch_resume_nosmt' [-Werror=missing-prototypes]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Add the prototype in linux/suspend.h, which is included in both places.

Do you want me to pick this up?

Yes, please do. Thanks,

Done, thanks!

#18 lore raw

PATCH 11/14 init: consolidate prototypes in linux/init.h

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The init/main.c file contains some extern declarations for functions defined in architecture code, and it defines some other functions that are called from architecture code with a custom prototype. Both of those result in warnings with 'make W=1':

init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes] init/main.c:790:20: error: no previous prototype for 'mem_encrypt_init' [-Werror=missing-prototypes] init/main.c:792:20: error: no previous prototype for 'poking_init' [-Werror=missing-prototypes] arch/arm64/kernel/irq.c:122:13: error: no previous prototype for 'init_IRQ' [-Werror=missing-prototypes] arch/arm64/kernel/time.c:55:13: error: no previous prototype for 'time_init' [-Werror=missing-prototypes] arch/x86/kernel/process.c:935:13: error: no previous prototype for 'arch_post_acpi_subsys_init' [-Werror=missing-prototypes] init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes] kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes]

Add prototypes for all of these in include/linux/init.h or another appropriate header, and remove the duplicate declarations from architecture specific code.

---
 arch/arm/include/asm/irq.h          |  1 -
 arch/microblaze/include/asm/setup.h |  2 --
 arch/mips/include/asm/irq.h         |  1 -
 arch/parisc/kernel/smp.c            |  1 -
 arch/powerpc/include/asm/irq.h      |  1 -
 arch/riscv/include/asm/irq.h        |  2 --
 arch/riscv/include/asm/timex.h      |  2 --
 arch/s390/kernel/entry.h            |  2 --
 arch/sh/include/asm/irq.h           |  1 -
 arch/sh/include/asm/rtc.h           |  2 --
 arch/sparc/include/asm/irq_32.h     |  1 -
 arch/sparc/include/asm/irq_64.h     |  1 -
 arch/sparc/include/asm/timer_64.h   |  1 -
 arch/sparc/kernel/kernel.h          |  4 ----
 arch/x86/include/asm/irq.h          |  2 --
 arch/x86/include/asm/mem_encrypt.h  |  3 ---
 arch/x86/include/asm/time.h         |  1 -
 arch/x86/include/asm/tsc.h          |  1 -
 include/linux/acpi.h                |  3 ++-
 include/linux/delay.h               |  1 +
 include/linux/init.h                | 20 ++++++++++++++++++++
 init/main.c                         | 18 ------------------
 22 files changed, 23 insertions(+), 48 deletions(-)
arch/arm/include/asm/irq.h +0 -1
index f62fa9f36192..ea0fdf83c397 100644
@@ -23,7 +23,6 @@
 #endif
 
 #ifndef __ASSEMBLY__
-void init_IRQ(void);
 
 #ifdef CONFIG_SMP
 #include <linux/cpumask.h>
arch/microblaze/include/asm/setup.h +0 -2
index a06cc1f97aa9..3657f5e78a3d 100644
@@ -16,8 +16,6 @@ extern char *klimit;
 
 extern void mmu_reset(void);
 
-void time_init(void);
-void init_IRQ(void);
 void machine_early_init(const char *cmdline, unsigned int ram,
 		unsigned int fdt, unsigned int msr, unsigned int tlb0,
 		unsigned int tlb1);
arch/mips/include/asm/irq.h +0 -1
index 44f9824c1d8c..75abfa834ab7 100644
@@ -19,7 +19,6 @@
 #define IRQ_STACK_SIZE			THREAD_SIZE
 #define IRQ_STACK_START			(IRQ_STACK_SIZE - 16)
 
-extern void __init init_IRQ(void);
 extern void *irq_stack[NR_CPUS];
 
 /*
arch/parisc/kernel/smp.c +0 -1
index b7fc859fa87d..83348125b524 100644
@@ -271,7 +271,6 @@ void arch_send_call_function_single_ipi(int cpu)
 static void
 smp_cpu_init(int cpunum)
 {
-	extern void init_IRQ(void);    /* arch/parisc/kernel/irq.c */
 	extern void start_cpu_itimer(void); /* arch/parisc/kernel/time.c */
 
 	/* Set modes and Enable floating point coprocessor */
arch/powerpc/include/asm/irq.h +0 -1
index deadd2149426..94dffa1dd223 100644
@@ -50,7 +50,6 @@ extern void *hardirq_ctx[NR_CPUS];
 extern void *softirq_ctx[NR_CPUS];
 
 void __do_IRQ(struct pt_regs *regs);
-extern void __init init_IRQ(void);
 
 int irq_choose_cpu(const struct cpumask *mask);
 
arch/riscv/include/asm/irq.h +0 -2
index 43b9ebfbd943..8e10a94430a2 100644
@@ -16,6 +16,4 @@ void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void));
 
 struct fwnode_handle *riscv_get_intc_hwnode(void);
 
-extern void __init init_IRQ(void);
-
 #endif /* _ASM_RISCV_IRQ_H */
arch/riscv/include/asm/timex.h +0 -2
index d6a7428f6248..a06697846e69 100644
@@ -88,6 +88,4 @@ static inline int read_current_timer(unsigned long *timer_val)
 	return 0;
 }
 
-extern void time_init(void);
-
 #endif /* _ASM_RISCV_TIMEX_H */
arch/s390/kernel/entry.h +0 -2
index 34674e38826b..9f41853f36b9 100644
@@ -34,14 +34,12 @@ void kernel_stack_overflow(struct pt_regs * regs);
 void handle_signal32(struct ksignal *ksig, sigset_t *oldset,
 		     struct pt_regs *regs);
 
-void __init init_IRQ(void);
 void do_io_irq(struct pt_regs *regs);
 void do_ext_irq(struct pt_regs *regs);
 void do_restart(void *arg);
 void __init startup_init(void);
 void die(struct pt_regs *regs, const char *str);
 int setup_profiling_timer(unsigned int multiplier);
-void __init time_init(void);
 unsigned long prepare_ftrace_return(unsigned long parent, unsigned long sp, unsigned long ip);
 
 struct s390_mmap_arg_struct;
arch/sh/include/asm/irq.h +0 -1
index 1c4923502fd4..0f384b1f45ca 100644
@@ -22,7 +22,6 @@ extern unsigned short *irq_mask_register;
 /*
  * PINT IRQs
  */
-void init_IRQ_pint(void);
 void make_imask_irq(unsigned int irq);
 
 static inline int generic_irq_demux(int irq)
arch/sh/include/asm/rtc.h +0 -2
index 2d333ad60810..40b0899783d7 100644
@@ -2,8 +2,6 @@
 #ifndef _ASM_RTC_H
 #define _ASM_RTC_H
 
-void time_init(void);
-
 #define RTC_CAP_4_DIGIT_YEAR	(1 << 0)
 
 struct sh_rtc_platform_data {
arch/sparc/include/asm/irq_32.h +0 -1
index 43ec2609b811..6ee48321cbc2 100644
@@ -17,7 +17,6 @@
 
 #define irq_canonicalize(irq)	(irq)
 
-void __init init_IRQ(void);
 void __init sun4d_init_sbi_irq(void);
 
 #define NO_IRQ		0xffffffff
arch/sparc/include/asm/irq_64.h +0 -1
index 154df2cf19f4..b436029f1ced 100644
@@ -61,7 +61,6 @@ void sun4u_destroy_msi(unsigned int irq);
 unsigned int irq_alloc(unsigned int dev_handle, unsigned int dev_ino);
 void irq_free(unsigned int irq);
 
-void __init init_IRQ(void);
 void fixup_irqs(void);
 
 static inline void set_softint(unsigned long bits)
arch/sparc/include/asm/timer_64.h +0 -1
index dcfad4613e18..ffff52c8b760 100644
@@ -34,7 +34,6 @@ extern struct sparc64_tick_ops *tick_ops;
 
 unsigned long sparc64_get_clock_tick(unsigned int cpu);
 void setup_sparc64_timer(void);
-void __init time_init(void);
 
 #define TICK_PRIV_BIT		BIT(63)
 #define TICKCMP_IRQ_BIT		BIT(63)
arch/sparc/kernel/kernel.h +0 -4
index 9cd09a3ef35f..970ef8dec86e 100644
@@ -62,9 +62,6 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs);
 void do_signal32(struct pt_regs * regs);
 asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp);
 
-/* time_64.c */
-void __init time_init_early(void);
-
 /* compat_audit.c */
 extern unsigned int sparc32_dir_class[];
 extern unsigned int sparc32_chattr_class[];
@@ -91,7 +88,6 @@ extern int static_irq_count;
 extern spinlock_t irq_action_lock;
 
 void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
-void init_IRQ(void);
 
 /* sun4m_irq.c */
 void sun4m_init_IRQ(void);
arch/x86/include/asm/irq.h +0 -2
index 768aa234cbb4..29e083b92813 100644
@@ -40,8 +40,6 @@ extern void __handle_irq(struct irq_desc *desc, struct pt_regs *regs);
 
 extern void init_ISA_irqs(void);
 
-extern void __init init_IRQ(void);
-
 #ifdef CONFIG_X86_LOCAL_APIC
 void arch_trigger_cpumask_backtrace(const struct cpumask *mask,
 				    bool exclude_self);
arch/x86/include/asm/mem_encrypt.h +0 -3
index b7126701574c..1c22c86d13e6 100644
@@ -87,9 +87,6 @@ static inline void mem_encrypt_free_decrypted_mem(void) { }
 
 #endif	/* CONFIG_AMD_MEM_ENCRYPT */
 
-/* Architecture __weak replacement functions */
-void __init mem_encrypt_init(void);
-
 void add_encrypt_protection_map(void);
 
 /*
arch/x86/include/asm/time.h +0 -1
index a53961c64a56..f360104ed172 100644
@@ -6,7 +6,6 @@
 #include <asm/mc146818rtc.h>
 
 extern void hpet_time_init(void);
-extern void time_init(void);
 extern bool pit_timer_init(void);
 extern bool tsc_clocksource_watchdog_disabled(void);
 
arch/x86/include/asm/tsc.h +0 -1
index fbdc3d951494..1992ef5e41a9 100644
@@ -32,7 +32,6 @@ extern struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns);
 
 extern void tsc_early_init(void);
 extern void tsc_init(void);
-extern unsigned long calibrate_delay_is_known(void);
 extern void mark_tsc_unstable(char *reason);
 extern int unsynchronized_tsc(void);
 extern int check_tsc_unstable(void);
include/linux/acpi.h +2 -1
index 7b71dd74baeb..f4c2a87d02c1 100644
@@ -712,7 +712,6 @@ int acpi_match_platform_list(const struct acpi_platform_list *plat);
 
 extern void acpi_early_init(void);
 extern void acpi_subsystem_init(void);
-extern void arch_post_acpi_subsys_init(void);
 
 extern int acpi_nvs_register(__u64 start, __u64 size);
 
@@ -1084,6 +1083,8 @@ static inline bool acpi_sleep_state_supported(u8 sleep_state)
 
 #endif	/* !CONFIG_ACPI */
 
+extern void arch_post_acpi_subsys_init(void);
+
 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
 int acpi_ioapic_add(acpi_handle root);
 #else
include/linux/delay.h +1 -0
index 039e7e0c7378..ff9cda975e30 100644
@@ -56,6 +56,7 @@ static inline void ndelay(unsigned long x)
 
 extern unsigned long lpj_fine;
 void calibrate_delay(void);
+unsigned long calibrate_delay_is_known(void);
 void __attribute__((weak)) calibration_delay_done(void);
 void msleep(unsigned int msecs);
 unsigned long msleep_interruptible(unsigned int msecs);
include/linux/init.h +20 -0
index c5fe6d26f5b1..1200fa99e848 100644
@@ -152,6 +152,24 @@ extern unsigned int reset_devices;
 void setup_arch(char **);
 void prepare_namespace(void);
 void __init init_rootfs(void);
+
+void init_IRQ(void);
+void time_init(void);
+void mem_encrypt_init(void);
+void poking_init(void);
+void pgtable_cache_init(void);
+
+extern initcall_entry_t __initcall_start[];
+extern initcall_entry_t __initcall0_start[];
+extern initcall_entry_t __initcall1_start[];
+extern initcall_entry_t __initcall2_start[];
+extern initcall_entry_t __initcall3_start[];
+extern initcall_entry_t __initcall4_start[];
+extern initcall_entry_t __initcall5_start[];
+extern initcall_entry_t __initcall6_start[];
+extern initcall_entry_t __initcall7_start[];
+extern initcall_entry_t __initcall_end[];
+
 extern struct file_system_type rootfs_fs_type;
 
 #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
@@ -309,6 +327,8 @@ struct obs_kernel_param {
 	int early;
 };
 
+extern const struct obs_kernel_param __setup_start[], __setup_end[];
+
 /*
  * Only for really core code.  See moduleparam.h for the normal way.
  *
init/main.c +0 -18
index af50044deed5..d4400efbef0a 100644
@@ -115,10 +115,6 @@
 
 static int kernel_init(void *);
 
-extern void init_IRQ(void);
-extern void radix_tree_init(void);
-extern void maple_tree_init(void);
-
 /*
  * Debug helper: via this flag we know that we are in 'early bootup code'
  * where only the boot processor is running with IRQ disabled.  This means
@@ -137,7 +133,6 @@ EXPORT_SYMBOL(system_state);
 #define MAX_INIT_ARGS CONFIG_INIT_ENV_ARG_LIMIT
 #define MAX_INIT_ENVS CONFIG_INIT_ENV_ARG_LIMIT
 
-extern void time_init(void);
 /* Default late time init is NULL. archs can override this later. */
 void (*__initdata late_time_init)(void);
 
@@ -196,8 +191,6 @@ static const char *argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
 const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
 static const char *panic_later, *panic_param;
 
-extern const struct obs_kernel_param __setup_start[], __setup_end[];
-
 static bool __init obsolete_checksetup(char *line)
 {
 	const struct obs_kernel_param *p;
@@ -1263,17 +1256,6 @@ int __init_or_module do_one_initcall(initcall_t fn)
 }
 
 
-extern initcall_entry_t __initcall_start[];
-extern initcall_entry_t __initcall0_start[];
-extern initcall_entry_t __initcall1_start[];
-extern initcall_entry_t __initcall2_start[];
-extern initcall_entry_t __initcall3_start[];
-extern initcall_entry_t __initcall4_start[];
-extern initcall_entry_t __initcall5_start[];
-extern initcall_entry_t __initcall6_start[];
-extern initcall_entry_t __initcall7_start[];
-extern initcall_entry_t __initcall_end[];
-
 static initcall_entry_t *initcall_levels[] __initdata = {
 	__initcall0_start,
 	__initcall1_start,
Signature · 1 line
2.39.2
maintainer Reviewed-by Acked-by on v1 11/14
#19 lore raw

Re: [PATCH 11/14] init: consolidate prototypes in linux/init.h

Quoted 45 lines · On Wed, 17 May 2023 06:10:59 PDT (-0700), [email protected] wrote:

From: Arnd Bergmann <[email protected]>

The init/main.c file contains some extern declarations for functions defined in architecture code, and it defines some other functions that are called from architecture code with a custom prototype. Both of those result in warnings with 'make W=1':

init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes] init/main.c:790:20: error: no previous prototype for 'mem_encrypt_init' [-Werror=missing-prototypes] init/main.c:792:20: error: no previous prototype for 'poking_init' [-Werror=missing-prototypes] arch/arm64/kernel/irq.c:122:13: error: no previous prototype for 'init_IRQ' [-Werror=missing-prototypes] arch/arm64/kernel/time.c:55:13: error: no previous prototype for 'time_init' [-Werror=missing-prototypes] arch/x86/kernel/process.c:935:13: error: no previous prototype for 'arch_post_acpi_subsys_init' [-Werror=missing-prototypes] init/calibrate.c:261:37: error: no previous prototype for 'calibrate_delay_is_known' [-Werror=missing-prototypes] kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes]

Add prototypes for all of these in include/linux/init.h or another appropriate header, and remove the duplicate declarations from architecture specific code.

---
 arch/arm/include/asm/irq.h          |  1 -
 arch/microblaze/include/asm/setup.h |  2 --
 arch/mips/include/asm/irq.h         |  1 -
 arch/parisc/kernel/smp.c            |  1 -
 arch/powerpc/include/asm/irq.h      |  1 -
 arch/riscv/include/asm/irq.h        |  2 --
 arch/riscv/include/asm/timex.h      |  2 --
 arch/s390/kernel/entry.h            |  2 --
 arch/sh/include/asm/irq.h           |  1 -
 arch/sh/include/asm/rtc.h           |  2 --
 arch/sparc/include/asm/irq_32.h     |  1 -
 arch/sparc/include/asm/irq_64.h     |  1 -
 arch/sparc/include/asm/timer_64.h   |  1 -
 arch/sparc/kernel/kernel.h          |  4 ----
 arch/x86/include/asm/irq.h          |  2 --
 arch/x86/include/asm/mem_encrypt.h  |  3 ---
 arch/x86/include/asm/time.h         |  1 -
 arch/x86/include/asm/tsc.h          |  1 -
 include/linux/acpi.h                |  3 ++-
 include/linux/delay.h               |  1 +
 include/linux/init.h                | 20 ++++++++++++++++++++
 init/main.c                         | 18 ------------------
 22 files changed, 23 insertions(+), 48 deletions(-)

...

Quoted 16 lines
arch/riscv/include/asm/irq.h +0 -2
index 43b9ebfbd943..8e10a94430a2 100644
@@ -16,6 +16,4 @@ void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void));
 
 struct fwnode_handle *riscv_get_intc_hwnode(void);
 
-extern void __init init_IRQ(void);
-
 #endif /* _ASM_RISCV_IRQ_H */
arch/riscv/include/asm/timex.h +0 -0
index d6a7428f6248..a06697846e69 100644

arch/riscv/include/asm/timex.h static inline int read_current_timer(unsigned long *timer_val) · line 91

Quoted 6 lines
arch/riscv/include/asm/timex.h +0 -2
@@ -88,6 +88,4 @@ static inline int read_current_timer(unsigned long *timer_val)
 	return 0;
 }
 
-extern void time_init(void);
-
 #endif /* _ASM_RISCV_TIMEX_H */

Thanks!

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#20 lore raw

PATCH 12/14 init: move cifs_root_data() prototype into linux/mount.h

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

cifs_root_data() is defined in cifs and called from early init code, but lacks a global prototype:

fs/cifs/cifsroot.c:83:12: error: no previous prototype for 'cifs_root_data'

Move the declaration from do_mounts.c into an appropriate header.

---
 include/linux/mount.h | 2 ++
 init/do_mounts.c      | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/mount.h +2 -0
index 1ea326c368f7..f381eb44b24c 100644
@@ -124,4 +124,6 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
 			  struct vfsmount *);
 extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num);
 
+extern int cifs_root_data(char **dev, char **opts);
+
 #endif /* _LINUX_MOUNT_H */
init/do_mounts.c +0 -2
index 811e94daf0a8..83447c46ad6d 100644
@@ -489,8 +489,6 @@ static int __init mount_nfs_root(void)
 
 #ifdef CONFIG_CIFS_ROOT
 
-extern int cifs_root_data(char **dev, char **opts);
-
 #define CIFSROOT_TIMEOUT_MIN	5
 #define CIFSROOT_TIMEOUT_MAX	30
 #define CIFSROOT_RETRY_MAX	5
Signature · 1 line
2.39.2
#21 lore raw

PATCH 13/14 thread_info: move function declarations to linux/thread_info.h

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

There are a few __weak functions in kernel/fork.c, which architectures can override. If there is no prototype, the compiler warns about them:

kernel/fork.c:164:13: error: no previous prototype for 'arch_release_task_struct' [-Werror=missing-prototypes] kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes] kernel/fork.c:1086:12: error: no previous prototype for 'arch_dup_task_struct' [-Werror=missing-prototypes]

There are already prototypes in a number of architecture specific headers that have addressed those warnings before, but it's much better to have these in a single place so the warning no longer shows up anywhere.

---
 arch/arm64/include/asm/thread_info.h | 4 ----
 arch/s390/include/asm/thread_info.h  | 3 ---
 arch/sh/include/asm/thread_info.h    | 3 ---
 arch/x86/include/asm/thread_info.h   | 3 ---
 include/linux/thread_info.h          | 5 +++++
 5 files changed, 5 insertions(+), 13 deletions(-)
arch/arm64/include/asm/thread_info.h +0 -4
index 848739c15de8..553d1bc559c6 100644
@@ -55,10 +55,6 @@ struct thread_info {
 void arch_setup_new_exec(void);
 #define arch_setup_new_exec     arch_setup_new_exec
 
-void arch_release_task_struct(struct task_struct *tsk);
-int arch_dup_task_struct(struct task_struct *dst,
-				struct task_struct *src);
-
 #endif
 
 #define TIF_SIGPENDING		0	/* signal pending */
arch/s390/include/asm/thread_info.h +0 -3
index c7c97921ed8d..a674c7d25da5 100644
@@ -52,9 +52,6 @@ struct thread_info {
 
 struct task_struct;
 
-void arch_release_task_struct(struct task_struct *tsk);
-int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
-
 void arch_setup_new_exec(void);
 #define arch_setup_new_exec arch_setup_new_exec
 
arch/sh/include/asm/thread_info.h +0 -3
index 1400fbb8b423..9f19a682d315 100644
@@ -84,9 +84,6 @@ static inline struct thread_info *current_thread_info(void)
 
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
-extern void arch_task_cache_init(void);
-extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
-extern void arch_release_task_struct(struct task_struct *tsk);
 extern void init_thread_xstate(void);
 
 #endif /* __ASSEMBLY__ */
arch/x86/include/asm/thread_info.h +0 -3
index f1cccba52eb9..d63b02940747 100644
@@ -232,9 +232,6 @@ static inline int arch_within_stack_frames(const void * const stack,
 			   current_thread_info()->status & TS_COMPAT)
 #endif
 
-extern void arch_task_cache_init(void);
-extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
-extern void arch_release_task_struct(struct task_struct *tsk);
 extern void arch_setup_new_exec(void);
 #define arch_setup_new_exec arch_setup_new_exec
 #endif	/* !__ASSEMBLY__ */
include/linux/thread_info.h +5 -0
index c02646884fa8..9ea0b28068f4 100644
@@ -256,6 +256,11 @@ check_copy_size(const void *addr, size_t bytes, bool is_source)
 static inline void arch_setup_new_exec(void) { }
 #endif
 
+void arch_task_cache_init(void); /* for CONFIG_SH */
+void arch_release_task_struct(struct task_struct *tsk);
+int arch_dup_task_struct(struct task_struct *dst,
+				struct task_struct *src);
+
 #endif	/* __KERNEL__ */
 
 #endif /* _LINUX_THREAD_INFO_H */
Signature · 1 line
2.39.2
maintainer Acked-by on v1 13/14
#22 lore raw

Re: [PATCH 13/14] thread_info: move function declarations to linux/thread_info.h

Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

There are a few __weak functions in kernel/fork.c, which architectures can override. If there is no prototype, the compiler warns about them:

kernel/fork.c:164:13: error: no previous prototype for 'arch_release_task_struct' [-Werror=missing-prototypes] kernel/fork.c:991:20: error: no previous prototype for 'arch_task_cache_init' [-Werror=missing-prototypes] kernel/fork.c:1086:12: error: no previous prototype for 'arch_dup_task_struct' [-Werror=missing-prototypes]

Quoted 5 lines

There are already prototypes in a number of architecture specific headers that have addressed those warnings before, but it's much better to have these in a single place so the warning no longer shows up anywhere.

For arm64:

#23 lore raw

PATCH 14/14 time_namespace: always provide arch_get_vdso_data() prototype for vdso

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The arch_get_vdso_data() function is defined separately on each architecture, but only called when CONFIG_TIME_NS is set. If the definition is a global function, this causes a W=1 warning without TIME_NS:

arch/x86/entry/vdso/vma.c:35:19: error: no previous prototype for 'arch_get_vdso_data' [-Werror=missing-prototypes]

Move the prototype out of the #ifdef block to reliably turn off that warning.

---
 include/linux/time_namespace.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/time_namespace.h +2 -1
index bb9d3f5542f8..03d9c5ac01d1 100644
@@ -44,7 +44,6 @@ struct time_namespace *copy_time_ns(unsigned long flags,
 				    struct time_namespace *old_ns);
 void free_time_ns(struct time_namespace *ns);
 void timens_on_fork(struct nsproxy *nsproxy, struct task_struct *tsk);
-struct vdso_data *arch_get_vdso_data(void *vvar_page);
 struct page *find_timens_vvar_page(struct vm_area_struct *vma);
 
 static inline void put_time_ns(struct time_namespace *ns)
@@ -163,4 +162,6 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim)
 }
 #endif
 
+struct vdso_data *arch_get_vdso_data(void *vvar_page);
+
 #endif /* _LINUX_TIMENS_H */
Signature · 1 line
2.39.2