Commit 8ff1443c authored by Russell King's avatar Russell King

ARM: simplify early machine init hooks

Rather than storing each machine init hook separately, store a
pointer to the machine description record and dereference this
instead.  This pointer is only available while the init sections
are present, which is not a problem as we only use it from init
code.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent cd544ce7
...@@ -45,6 +45,11 @@ struct machine_desc { ...@@ -45,6 +45,11 @@ struct machine_desc {
#endif #endif
}; };
/*
* Current machine - only accessible during boot.
*/
extern struct machine_desc *machine_desc;
/* /*
* Set of macros to define architecture features. This is built into * Set of macros to define architecture features. This is built into
* a table by the linker. * a table by the linker.
......
...@@ -17,8 +17,6 @@ struct seq_file; ...@@ -17,8 +17,6 @@ struct seq_file;
/* /*
* This is internal. Do not use it. * This is internal. Do not use it.
*/ */
extern unsigned int arch_nr_irqs;
extern void (*init_arch_irq)(void);
extern void init_FIQ(void); extern void init_FIQ(void);
extern int show_fiq_list(struct seq_file *, void *); extern int show_fiq_list(struct seq_file *, void *);
......
...@@ -43,7 +43,6 @@ struct sys_timer { ...@@ -43,7 +43,6 @@ struct sys_timer {
#endif #endif
}; };
extern struct sys_timer *system_timer;
extern void timer_tick(void); extern void timer_tick(void);
#endif #endif
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
...@@ -47,8 +48,6 @@ ...@@ -47,8 +48,6 @@
#define irq_finish(irq) do { } while (0) #define irq_finish(irq) do { } while (0)
#endif #endif
unsigned int arch_nr_irqs;
void (*init_arch_irq)(void) __initdata = NULL;
unsigned long irq_err_count; unsigned long irq_err_count;
int show_interrupts(struct seq_file *p, void *v) int show_interrupts(struct seq_file *p, void *v)
...@@ -154,13 +153,13 @@ void set_irq_flags(unsigned int irq, unsigned int iflags) ...@@ -154,13 +153,13 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
void __init init_IRQ(void) void __init init_IRQ(void)
{ {
init_arch_irq(); machine_desc->init_irq();
} }
#ifdef CONFIG_SPARSE_IRQ #ifdef CONFIG_SPARSE_IRQ
int __init arch_probe_nr_irqs(void) int __init arch_probe_nr_irqs(void)
{ {
nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS; nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs : NR_IRQS;
return nr_irqs; return nr_irqs;
} }
#endif #endif
......
...@@ -126,6 +126,7 @@ EXPORT_SYMBOL(elf_platform); ...@@ -126,6 +126,7 @@ EXPORT_SYMBOL(elf_platform);
static const char *cpu_name; static const char *cpu_name;
static const char *machine_name; static const char *machine_name;
static char __initdata cmd_line[COMMAND_LINE_SIZE]; static char __initdata cmd_line[COMMAND_LINE_SIZE];
struct machine_desc *machine_desc __initdata;
static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
...@@ -708,13 +709,11 @@ static struct init_tags { ...@@ -708,13 +709,11 @@ static struct init_tags {
{ 0, ATAG_NONE } { 0, ATAG_NONE }
}; };
static void (*init_machine)(void) __initdata;
static int __init customize_machine(void) static int __init customize_machine(void)
{ {
/* customizes platform devices, or adds new ones */ /* customizes platform devices, or adds new ones */
if (init_machine) if (machine_desc->init_machine)
init_machine(); machine_desc->init_machine();
return 0; return 0;
} }
arch_initcall(customize_machine); arch_initcall(customize_machine);
...@@ -809,6 +808,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -809,6 +808,7 @@ void __init setup_arch(char **cmdline_p)
setup_processor(); setup_processor();
mdesc = setup_machine(machine_arch_type); mdesc = setup_machine(machine_arch_type);
machine_desc = mdesc;
machine_name = mdesc->name; machine_name = mdesc->name;
if (mdesc->soft_reboot) if (mdesc->soft_reboot)
...@@ -868,13 +868,6 @@ void __init setup_arch(char **cmdline_p) ...@@ -868,13 +868,6 @@ void __init setup_arch(char **cmdline_p)
cpu_init(); cpu_init();
tcm_init(); tcm_init();
/*
* Set up various architecture-specific pointers
*/
arch_nr_irqs = mdesc->nr_irqs;
init_arch_irq = mdesc->init_irq;
system_timer = mdesc->timer;
init_machine = mdesc->init_machine;
#ifdef CONFIG_MULTI_IRQ_HANDLER #ifdef CONFIG_MULTI_IRQ_HANDLER
handle_arch_irq = mdesc->handle_irq; handle_arch_irq = mdesc->handle_irq;
#endif #endif
......
...@@ -30,12 +30,13 @@ ...@@ -30,12 +30,13 @@
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
/* /*
* Our system timer. * Our system timer.
*/ */
struct sys_timer *system_timer; static struct sys_timer *system_timer;
#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
/* this needs a better home */ /* this needs a better home */
...@@ -160,6 +161,7 @@ device_initcall(timer_init_sysfs); ...@@ -160,6 +161,7 @@ device_initcall(timer_init_sysfs);
void __init time_init(void) void __init time_init(void)
{ {
system_timer = machine_desc->timer;
system_timer->init(); system_timer->init();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment