Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0db0628d authored by Paul Gortmaker's avatar Paul Gortmaker
Browse files

kernel: delete __cpuinit usage from all core kernel files

The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications.  For example, the fix in
commit 5e427ec2 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.

After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out.  Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.

This removes all the uses of the __cpuinit macros from C files in
the core kernel directories (kernel, init, lib, mm, and include)
that don't really have a specific maintainer.

[1] https://lkml.org/lkml/2013/5/20/589



Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 49fb4c62
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ Q: If i have some kernel code that needs to be aware of CPU arrival and
A: This is what you would need in your kernel code to receive notifications.

	#include <linux/cpu.h>
	static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
	static int foobar_cpu_callback(struct notifier_block *nfb,
				       unsigned long action, void *hcpu)
	{
		unsigned int cpu = (unsigned long)hcpu;
@@ -285,7 +285,7 @@ A: This is what you would need in your kernel code to receive notifications.
		return NOTIFY_OK;
	}

	static struct notifier_block __cpuinitdata foobar_cpu_notifer =
	static struct notifier_block foobar_cpu_notifer =
	{
	   .notifier_call = foobar_cpu_callback,
	};
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ enum {
/* Need to know about CPUs going up/down? */
#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
#define cpu_notifier(fn, pri) {					\
	static struct notifier_block fn##_nb __cpuinitdata =	\
	static struct notifier_block fn##_nb =			\
		{ .notifier_call = fn, .priority = pri };	\
	register_cpu_notifier(&fn##_nb);			\
}
+1 −1
Original line number Diff line number Diff line
@@ -826,7 +826,7 @@ static inline void perf_restore_debug_store(void) { }
 */
#define perf_cpu_notifier(fn)						\
do {									\
	static struct notifier_block fn##_nb __cpuinitdata =		\
	static struct notifier_block fn##_nb =				\
		{ .notifier_call = fn, .priority = CPU_PRI_PERF };	\
	unsigned long cpu = smp_processor_id();				\
	unsigned long flags;						\
+8 −5
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ __setup("lpj=", lpj_setup);
#define DELAY_CALIBRATION_TICKS			((HZ < 100) ? 1 : (HZ/100))
#define MAX_DIRECT_CALIBRATION_RETRIES		5

static unsigned long __cpuinit calibrate_delay_direct(void)
static unsigned long calibrate_delay_direct(void)
{
	unsigned long pre_start, start, post_start;
	unsigned long pre_end, end, post_end;
@@ -166,7 +166,10 @@ static unsigned long __cpuinit calibrate_delay_direct(void)
	return 0;
}
#else
static unsigned long __cpuinit calibrate_delay_direct(void) {return 0;}
static unsigned long calibrate_delay_direct(void)
{
	return 0;
}
#endif

/*
@@ -180,7 +183,7 @@ static unsigned long __cpuinit calibrate_delay_direct(void) {return 0;}
 */
#define LPS_PREC 8

static unsigned long __cpuinit calibrate_delay_converge(void)
static unsigned long calibrate_delay_converge(void)
{
	/* First stage - slowly accelerate to find initial bounds */
	unsigned long lpj, lpj_base, ticks, loopadd, loopadd_base, chop_limit;
@@ -254,12 +257,12 @@ static DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 };
 * Architectures should override this function if a faster calibration
 * method is available.
 */
unsigned long __attribute__((weak)) __cpuinit calibrate_delay_is_known(void)
unsigned long __attribute__((weak)) calibrate_delay_is_known(void)
{
	return 0;
}

void __cpuinit calibrate_delay(void)
void calibrate_delay(void)
{
	unsigned long lpj;
	static bool printed;
+3 −3
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ EXPORT_SYMBOL(cpu_down);
#endif /*CONFIG_HOTPLUG_CPU*/

/* Requires cpu_add_remove_lock to be held */
static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
static int _cpu_up(unsigned int cpu, int tasks_frozen)
{
	int ret, nr_calls = 0;
	void *hcpu = (void *)(long)cpu;
@@ -419,7 +419,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
	return ret;
}

int __cpuinit cpu_up(unsigned int cpu)
int cpu_up(unsigned int cpu)
{
	int err = 0;

@@ -618,7 +618,7 @@ core_initcall(cpu_hotplug_pm_sync_init);
 * It must be called by the arch code on the new cpu, before the new cpu
 * enables interrupts and before the "boot" cpu returns from __cpu_up().
 */
void __cpuinit notify_cpu_starting(unsigned int cpu)
void notify_cpu_starting(unsigned int cpu)
{
	unsigned long val = CPU_STARTING;

Loading