Skip to content

Commit

Permalink
MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code
Browse files Browse the repository at this point in the history
commit 3747069b25e419f6b51395f48127e9812abc3596 upstream.

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 5e427ec ("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.

Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
and are flagged as __cpuinit  -- so if we remove the __cpuinit from
the arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
related content into no-ops as early as possible, since that will get
rid of these warnings.  In any case, they are temporary and harmless.

Here, we remove all the MIPS __cpuinit from C code and __CPUINIT
from asm files.  MIPS is interesting in this respect, because there
are also uasm users hiding behind their own renamed versions of the
__cpuinit macros.

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

[ralf@linux-mips.org: Folded in Paul's followup fix.]

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5494/
Patchwork: https://patchwork.linux-mips.org/patch/5495/
Patchwork: https://patchwork.linux-mips.org/patch/5509/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
paulgortmaker committed Jul 14, 2013
1 parent 60ffef0 commit 078a55f
Show file tree
Hide file tree
Showing 61 changed files with 294 additions and 338 deletions.
2 changes: 1 addition & 1 deletion arch/mips/ath79/setup.c
Expand Up @@ -182,7 +182,7 @@ const char *get_system_type(void)
return ath79_sys_type;
}

unsigned int __cpuinit get_c0_compare_int(void)
unsigned int get_c0_compare_int(void)
{
return CP0_LEGACY_COMPARE_IRQ;
}
Expand Down
12 changes: 6 additions & 6 deletions arch/mips/cavium-octeon/octeon-irq.c
Expand Up @@ -1095,7 +1095,7 @@ static void octeon_irq_ip3_ciu(void)

static bool octeon_irq_use_ip4;

static void __cpuinit octeon_irq_local_enable_ip4(void *arg)
static void octeon_irq_local_enable_ip4(void *arg)
{
set_c0_status(STATUSF_IP4);
}
Expand All @@ -1110,21 +1110,21 @@ static void (*octeon_irq_ip2)(void);
static void (*octeon_irq_ip3)(void);
static void (*octeon_irq_ip4)(void);

void __cpuinitdata (*octeon_irq_setup_secondary)(void);
void (*octeon_irq_setup_secondary)(void);

void __cpuinit octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t h)
void octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t h)
{
octeon_irq_ip4 = h;
octeon_irq_use_ip4 = true;
on_each_cpu(octeon_irq_local_enable_ip4, NULL, 1);
}

static void __cpuinit octeon_irq_percpu_enable(void)
static void octeon_irq_percpu_enable(void)
{
irq_cpu_online();
}

static void __cpuinit octeon_irq_init_ciu_percpu(void)
static void octeon_irq_init_ciu_percpu(void)
{
int coreid = cvmx_get_core_num();

Expand Down Expand Up @@ -1167,7 +1167,7 @@ static void octeon_irq_init_ciu2_percpu(void)
cvmx_read_csr(CVMX_CIU2_SUM_PPX_IP2(coreid));
}

static void __cpuinit octeon_irq_setup_secondary_ciu(void)
static void octeon_irq_setup_secondary_ciu(void)
{
octeon_irq_init_ciu_percpu();
octeon_irq_percpu_enable();
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/cavium-octeon/smp.c
Expand Up @@ -173,7 +173,7 @@ static void octeon_boot_secondary(int cpu, struct task_struct *idle)
* After we've done initial boot, this function is called to allow the
* board code to clean up state, if needed
*/
static void __cpuinit octeon_init_secondary(void)
static void octeon_init_secondary(void)
{
unsigned int sr;

Expand Down Expand Up @@ -375,7 +375,7 @@ static int octeon_update_boot_vector(unsigned int cpu)
return 0;
}

static int __cpuinit octeon_cpu_callback(struct notifier_block *nfb,
static int octeon_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
Expand All @@ -394,7 +394,7 @@ static int __cpuinit octeon_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}

static int __cpuinit register_cavium_notifier(void)
static int register_cavium_notifier(void)
{
hotcpu_notifier(octeon_cpu_callback, 0);
return 0;
Expand Down
37 changes: 13 additions & 24 deletions arch/mips/include/asm/uasm.h
Expand Up @@ -13,12 +13,8 @@

#ifdef CONFIG_EXPORT_UASM
#include <linux/export.h>
#define __uasminit
#define __uasminitdata
#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
#else
#define __uasminit __cpuinit
#define __uasminitdata __cpuinitdata
#define UASM_EXPORT_SYMBOL(sym)
#endif

Expand Down Expand Up @@ -54,43 +50,36 @@
#endif

#define Ip_u1u2u3(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)

#define Ip_u2u1u3(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)

#define Ip_u3u1u2(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)

#define Ip_u1u2s3(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)

#define Ip_u2s3u1(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c)
void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c)

#define Ip_u2u1s3(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)

#define Ip_u2u1msbu3(op) \
void __uasminit \
ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
unsigned int d)

#define Ip_u1u2(op) \
void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b)
void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b)

#define Ip_u1s2(op) \
void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, signed int b)
void ISAOPC(op)(u32 **buf, unsigned int a, signed int b)

#define Ip_u1(op) void __uasminit ISAOPC(op)(u32 **buf, unsigned int a)
#define Ip_u1(op) void ISAOPC(op)(u32 **buf, unsigned int a)

#define Ip_0(op) void __uasminit ISAOPC(op)(u32 **buf)
#define Ip_0(op) void ISAOPC(op)(u32 **buf)

Ip_u2u1s3(_addiu);
Ip_u3u1u2(_addu);
Expand Down Expand Up @@ -163,7 +152,7 @@ struct uasm_label {
int lab;
};

void __uasminit ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr,
void ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr,
int lid);
#ifdef CONFIG_64BIT
int ISAFUNC(uasm_in_compat_space_p)(long addr);
Expand All @@ -174,7 +163,7 @@ void ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr);
void ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr);

#define UASM_L_LA(lb) \
static inline void __uasminit ISAFUNC(uasm_l##lb)(struct uasm_label **lab, u32 *addr) \
static inline void ISAFUNC(uasm_l##lb)(struct uasm_label **lab, u32 *addr) \
{ \
ISAFUNC(uasm_build_label)(lab, addr, label##lb); \
}
Expand Down
4 changes: 0 additions & 4 deletions arch/mips/kernel/bmips_vec.S
Expand Up @@ -28,8 +28,6 @@
.set mips0
.endm

__CPUINIT

/***********************************************************************
* Alternate CPU1 startup vector for BMIPS4350
*
Expand Down Expand Up @@ -216,8 +214,6 @@ END(bmips_smp_int_vec)
* Certain CPUs support extending kseg0 to 1024MB.
***********************************************************************/

__CPUINIT

LEAF(bmips_enable_xks01)

#if defined(CONFIG_XKS01)
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cevt-bcm1480.c
Expand Up @@ -109,7 +109,7 @@ static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
static DEFINE_PER_CPU(char [18], sibyte_hpt_name);

void __cpuinit sb1480_clockevent_init(void)
void sb1480_clockevent_init(void)
{
unsigned int cpu = smp_processor_id();
unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cevt-gic.c
Expand Up @@ -59,7 +59,7 @@ void gic_event_handler(struct clock_event_device *dev)
{
}

int __cpuinit gic_clockevent_init(void)
int gic_clockevent_init(void)
{
unsigned int cpu = smp_processor_id();
struct clock_event_device *cd;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cevt-r4k.c
Expand Up @@ -171,7 +171,7 @@ int c0_compare_int_usable(void)
}

#ifndef CONFIG_MIPS_MT_SMTC
int __cpuinit r4k_clockevent_init(void)
int r4k_clockevent_init(void)
{
unsigned int cpu = smp_processor_id();
struct clock_event_device *cd;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cevt-sb1250.c
Expand Up @@ -107,7 +107,7 @@ static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
static DEFINE_PER_CPU(char [18], sibyte_hpt_name);

void __cpuinit sb1250_clockevent_init(void)
void sb1250_clockevent_init(void)
{
unsigned int cpu = smp_processor_id();
unsigned int irq = K_INT_TIMER_0 + cpu;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cevt-smtc.c
Expand Up @@ -248,7 +248,7 @@ irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
}


int __cpuinit smtc_clockevent_init(void)
int smtc_clockevent_init(void)
{
uint64_t mips_freq = mips_hpt_frequency;
unsigned int cpu = smp_processor_id();
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/cpu-bugs64.c
Expand Up @@ -168,7 +168,7 @@ static inline void check_mult_sh(void)
panic(bug64hit, !R4000_WAR ? r4kwar : nowar);
}

static volatile int daddi_ov __cpuinitdata;
static volatile int daddi_ov;

asmlinkage void __init do_daddi_ov(struct pt_regs *regs)
{
Expand Down
14 changes: 7 additions & 7 deletions arch/mips/kernel/cpu-probe.c
Expand Up @@ -27,7 +27,7 @@
#include <asm/spram.h>
#include <asm/uaccess.h>

static int __cpuinitdata mips_fpu_disabled;
static int mips_fpu_disabled;

static int __init fpu_disable(char *s)
{
Expand All @@ -39,7 +39,7 @@ static int __init fpu_disable(char *s)

__setup("nofpu", fpu_disable);

int __cpuinitdata mips_dsp_disabled;
int mips_dsp_disabled;

static int __init dsp_disable(char *s)
{
Expand Down Expand Up @@ -134,7 +134,7 @@ static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
#endif
}

static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa)
static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
{
switch (isa) {
case MIPS_CPU_ISA_M64R2:
Expand All @@ -159,7 +159,7 @@ static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa)
}
}

static char unknown_isa[] __cpuinitdata = KERN_ERR \
static char unknown_isa[] = KERN_ERR \
"Unsupported ISA type, c0.config0: %d.";

static inline unsigned int decode_config0(struct cpuinfo_mips *c)
Expand Down Expand Up @@ -290,7 +290,7 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
return config4 & MIPS_CONF_M;
}

static void __cpuinit decode_configs(struct cpuinfo_mips *c)
static void decode_configs(struct cpuinfo_mips *c)
{
int ok;

Expand Down Expand Up @@ -962,7 +962,7 @@ EXPORT_SYMBOL(__ua_limit);
const char *__cpu_name[NR_CPUS];
const char *__elf_platform;

__cpuinit void cpu_probe(void)
void cpu_probe(void)
{
struct cpuinfo_mips *c = &current_cpu_data;
unsigned int cpu = smp_processor_id();
Expand Down Expand Up @@ -1047,7 +1047,7 @@ __cpuinit void cpu_probe(void)
#endif
}

__cpuinit void cpu_report(void)
void cpu_report(void)
{
struct cpuinfo_mips *c = &current_cpu_data;

Expand Down
4 changes: 0 additions & 4 deletions arch/mips/kernel/head.S
Expand Up @@ -158,8 +158,6 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
j start_kernel
END(kernel_entry)

__CPUINIT

#ifdef CONFIG_SMP
/*
* SMP slave cpus entry point. Board specific code for bootstrap calls this
Expand Down Expand Up @@ -188,5 +186,3 @@ NESTED(smp_bootstrap, 16, sp)
j start_secondary
END(smp_bootstrap)
#endif /* CONFIG_SMP */

__FINIT
6 changes: 3 additions & 3 deletions arch/mips/kernel/smp-bmips.c
Expand Up @@ -398,23 +398,23 @@ struct plat_smp_ops bmips_smp_ops = {
* UP BMIPS systems as well.
***********************************************************************/

static void __cpuinit bmips_wr_vec(unsigned long dst, char *start, char *end)
static void bmips_wr_vec(unsigned long dst, char *start, char *end)
{
memcpy((void *)dst, start, end - start);
dma_cache_wback((unsigned long)start, end - start);
local_flush_icache_range(dst, dst + (end - start));
instruction_hazard();
}

static inline void __cpuinit bmips_nmi_handler_setup(void)
static inline void bmips_nmi_handler_setup(void)
{
bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
&bmips_reset_nmi_vec_end);
bmips_wr_vec(BMIPS_WARM_RESTART_VEC, &bmips_smp_int_vec,
&bmips_smp_int_vec_end);
}

void __cpuinit bmips_ebase_setup(void)
void bmips_ebase_setup(void)
{
unsigned long new_ebase = ebase;
void __iomem __maybe_unused *cbr;
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/kernel/smp-mt.c
Expand Up @@ -149,7 +149,7 @@ static void vsmp_send_ipi_mask(const struct cpumask *mask, unsigned int action)
vsmp_send_ipi_single(i, action);
}

static void __cpuinit vsmp_init_secondary(void)
static void vsmp_init_secondary(void)
{
#ifdef CONFIG_IRQ_GIC
/* This is Malta specific: IPI,performance and timer interrupts */
Expand All @@ -162,7 +162,7 @@ static void __cpuinit vsmp_init_secondary(void)
STATUSF_IP6 | STATUSF_IP7);
}

static void __cpuinit vsmp_smp_finish(void)
static void vsmp_smp_finish(void)
{
/* CDFIXME: remove this? */
write_c0_compare(read_c0_count() + (8* mips_hpt_frequency/HZ));
Expand All @@ -188,7 +188,7 @@ static void vsmp_cpus_done(void)
* (unsigned long)idle->thread_info the gp
* assumes a 1:1 mapping of TC => VPE
*/
static void __cpuinit vsmp_boot_secondary(int cpu, struct task_struct *idle)
static void vsmp_boot_secondary(int cpu, struct task_struct *idle)
{
struct thread_info *gp = task_thread_info(idle);
dvpe();
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/kernel/smp-up.c
Expand Up @@ -28,11 +28,11 @@ static inline void up_send_ipi_mask(const struct cpumask *mask,
* After we've done initial boot, this function is called to allow the
* board code to clean up state, if needed
*/
static void __cpuinit up_init_secondary(void)
static void up_init_secondary(void)
{
}

static void __cpuinit up_smp_finish(void)
static void up_smp_finish(void)
{
}

Expand All @@ -44,7 +44,7 @@ static void up_cpus_done(void)
/*
* Firmware CPU startup hook
*/
static void __cpuinit up_boot_secondary(int cpu, struct task_struct *idle)
static void up_boot_secondary(int cpu, struct task_struct *idle)
{
}

Expand Down

0 comments on commit 078a55f

Please sign in to comment.