Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
init: consolidate prototypes in linux/init.h
Browse files Browse the repository at this point in the history
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.

[[email protected]: declare time_init_early()]
  Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Dennis Zhou <[email protected]>
Cc: Eric Paris <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Russell King <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
arndb authored and akpm00 committed Jun 10, 2023
1 parent 23108f6 commit ad1a483
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 45 deletions.
1 change: 0 additions & 1 deletion arch/arm/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct irqaction;
struct pt_regs;

void handle_IRQ(unsigned int, struct pt_regs *);
void init_IRQ(void);

#ifdef CONFIG_SMP
#include <linux/cpumask.h>
Expand Down
2 changes: 0 additions & 2 deletions arch/microblaze/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion arch/mips/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];

/*
Expand Down
1 change: 0 additions & 1 deletion arch/parisc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions arch/riscv/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 0 additions & 2 deletions arch/riscv/include/asm/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 0 additions & 2 deletions arch/s390/kernel/entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion arch/sh/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions arch/sh/include/asm/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_info {
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/include/asm/irq_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/include/asm/irq_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/include/asm/timer_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/kernel/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,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);
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions arch/x86/include/asm/mem_encrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/*
Expand Down
1 change: 0 additions & 1 deletion arch/x86/include/asm/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion arch/x86/include/asm/tsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion include/linux/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/linux/delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 20 additions & 0 deletions include/linux/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
*
Expand Down
18 changes: 0 additions & 18 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ad1a483

Please sign in to comment.