diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-20 05:18:36 -0500 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-24 04:49:51 -0500 |
| commit | 8ff1443c5439ecee7472b80cf12ecfc337e6ee98 (patch) | |
| tree | b6899444bc0b66a016d29271c5d70e8ad43db5ca | |
| parent | cd544ce754ac2432ffcc0626ea802d2b30876b50 (diff) | |
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: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/include/asm/mach/arch.h | 5 | ||||
| -rw-r--r-- | arch/arm/include/asm/mach/irq.h | 2 | ||||
| -rw-r--r-- | arch/arm/include/asm/mach/time.h | 1 | ||||
| -rw-r--r-- | arch/arm/kernel/irq.c | 7 | ||||
| -rw-r--r-- | arch/arm/kernel/setup.c | 15 | ||||
| -rw-r--r-- | arch/arm/kernel/time.c | 4 |
6 files changed, 15 insertions, 19 deletions
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 7d55356110d4..69908ddbaf18 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
| @@ -46,6 +46,11 @@ struct machine_desc { | |||
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | /* | 48 | /* |
| 49 | * Current machine - only accessible during boot. | ||
| 50 | */ | ||
| 51 | extern struct machine_desc *machine_desc; | ||
| 52 | |||
| 53 | /* | ||
| 49 | * Set of macros to define architecture features. This is built into | 54 | * Set of macros to define architecture features. This is built into |
| 50 | * a table by the linker. | 55 | * a table by the linker. |
| 51 | */ | 56 | */ |
diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h index 6ecdad9a5c42..831e81453f81 100644 --- a/arch/arm/include/asm/mach/irq.h +++ b/arch/arm/include/asm/mach/irq.h | |||
| @@ -17,8 +17,6 @@ struct seq_file; | |||
| 17 | /* | 17 | /* |
| 18 | * This is internal. Do not use it. | 18 | * This is internal. Do not use it. |
| 19 | */ | 19 | */ |
| 20 | extern unsigned int arch_nr_irqs; | ||
| 21 | extern void (*init_arch_irq)(void); | ||
| 22 | extern void init_FIQ(void); | 20 | extern void init_FIQ(void); |
| 23 | extern int show_fiq_list(struct seq_file *, void *); | 21 | extern int show_fiq_list(struct seq_file *, void *); |
| 24 | 22 | ||
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index 35d408f6dccf..883f6be5117a 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h | |||
| @@ -43,7 +43,6 @@ struct sys_timer { | |||
| 43 | #endif | 43 | #endif |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | extern struct sys_timer *system_timer; | ||
| 47 | extern void timer_tick(void); | 46 | extern void timer_tick(void); |
| 48 | 47 | ||
| 49 | #endif | 48 | #endif |
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 36ad3be4692a..a591971dbf7b 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/proc_fs.h> | 37 | #include <linux/proc_fs.h> |
| 38 | 38 | ||
| 39 | #include <asm/system.h> | 39 | #include <asm/system.h> |
| 40 | #include <asm/mach/arch.h> | ||
| 40 | #include <asm/mach/irq.h> | 41 | #include <asm/mach/irq.h> |
| 41 | #include <asm/mach/time.h> | 42 | #include <asm/mach/time.h> |
| 42 | 43 | ||
| @@ -47,8 +48,6 @@ | |||
| 47 | #define irq_finish(irq) do { } while (0) | 48 | #define irq_finish(irq) do { } while (0) |
| 48 | #endif | 49 | #endif |
| 49 | 50 | ||
| 50 | unsigned int arch_nr_irqs; | ||
| 51 | void (*init_arch_irq)(void) __initdata = NULL; | ||
| 52 | unsigned long irq_err_count; | 51 | unsigned long irq_err_count; |
| 53 | 52 | ||
| 54 | int show_interrupts(struct seq_file *p, void *v) | 53 | int show_interrupts(struct seq_file *p, void *v) |
| @@ -154,13 +153,13 @@ void set_irq_flags(unsigned int irq, unsigned int iflags) | |||
| 154 | 153 | ||
| 155 | void __init init_IRQ(void) | 154 | void __init init_IRQ(void) |
| 156 | { | 155 | { |
| 157 | init_arch_irq(); | 156 | machine_desc->init_irq(); |
| 158 | } | 157 | } |
| 159 | 158 | ||
| 160 | #ifdef CONFIG_SPARSE_IRQ | 159 | #ifdef CONFIG_SPARSE_IRQ |
| 161 | int __init arch_probe_nr_irqs(void) | 160 | int __init arch_probe_nr_irqs(void) |
| 162 | { | 161 | { |
| 163 | nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS; | 162 | nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs : NR_IRQS; |
| 164 | return nr_irqs; | 163 | return nr_irqs; |
| 165 | } | 164 | } |
| 166 | #endif | 165 | #endif |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 0826f36330c4..e53132eee27a 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
| @@ -126,6 +126,7 @@ EXPORT_SYMBOL(elf_platform); | |||
| 126 | static const char *cpu_name; | 126 | static const char *cpu_name; |
| 127 | static const char *machine_name; | 127 | static const char *machine_name; |
| 128 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; | 128 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; |
| 129 | struct machine_desc *machine_desc __initdata; | ||
| 129 | 130 | ||
| 130 | static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; | 131 | static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; |
| 131 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; | 132 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; |
| @@ -708,13 +709,11 @@ static struct init_tags { | |||
| 708 | { 0, ATAG_NONE } | 709 | { 0, ATAG_NONE } |
| 709 | }; | 710 | }; |
| 710 | 711 | ||
| 711 | static void (*init_machine)(void) __initdata; | ||
| 712 | |||
| 713 | static int __init customize_machine(void) | 712 | static int __init customize_machine(void) |
| 714 | { | 713 | { |
| 715 | /* customizes platform devices, or adds new ones */ | 714 | /* customizes platform devices, or adds new ones */ |
| 716 | if (init_machine) | 715 | if (machine_desc->init_machine) |
| 717 | init_machine(); | 716 | machine_desc->init_machine(); |
| 718 | return 0; | 717 | return 0; |
| 719 | } | 718 | } |
| 720 | arch_initcall(customize_machine); | 719 | arch_initcall(customize_machine); |
| @@ -809,6 +808,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 809 | 808 | ||
| 810 | setup_processor(); | 809 | setup_processor(); |
| 811 | mdesc = setup_machine(machine_arch_type); | 810 | mdesc = setup_machine(machine_arch_type); |
| 811 | machine_desc = mdesc; | ||
| 812 | machine_name = mdesc->name; | 812 | machine_name = mdesc->name; |
| 813 | 813 | ||
| 814 | if (mdesc->soft_reboot) | 814 | if (mdesc->soft_reboot) |
| @@ -868,13 +868,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 868 | cpu_init(); | 868 | cpu_init(); |
| 869 | tcm_init(); | 869 | tcm_init(); |
| 870 | 870 | ||
| 871 | /* | ||
| 872 | * Set up various architecture-specific pointers | ||
| 873 | */ | ||
| 874 | arch_nr_irqs = mdesc->nr_irqs; | ||
| 875 | init_arch_irq = mdesc->init_irq; | ||
| 876 | system_timer = mdesc->timer; | ||
| 877 | init_machine = mdesc->init_machine; | ||
| 878 | #ifdef CONFIG_MULTI_IRQ_HANDLER | 871 | #ifdef CONFIG_MULTI_IRQ_HANDLER |
| 879 | handle_arch_irq = mdesc->handle_irq; | 872 | handle_arch_irq = mdesc->handle_irq; |
| 880 | #endif | 873 | #endif |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 38c261f9951c..f1e2eb19a67d 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
| @@ -30,12 +30,13 @@ | |||
| 30 | #include <asm/leds.h> | 30 | #include <asm/leds.h> |
| 31 | #include <asm/thread_info.h> | 31 | #include <asm/thread_info.h> |
| 32 | #include <asm/stacktrace.h> | 32 | #include <asm/stacktrace.h> |
| 33 | #include <asm/mach/arch.h> | ||
| 33 | #include <asm/mach/time.h> | 34 | #include <asm/mach/time.h> |
| 34 | 35 | ||
| 35 | /* | 36 | /* |
| 36 | * Our system timer. | 37 | * Our system timer. |
| 37 | */ | 38 | */ |
| 38 | struct sys_timer *system_timer; | 39 | static struct sys_timer *system_timer; |
| 39 | 40 | ||
| 40 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) | 41 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) |
| 41 | /* this needs a better home */ | 42 | /* this needs a better home */ |
| @@ -160,6 +161,7 @@ device_initcall(timer_init_sysfs); | |||
| 160 | 161 | ||
| 161 | void __init time_init(void) | 162 | void __init time_init(void) |
| 162 | { | 163 | { |
| 164 | system_timer = machine_desc->timer; | ||
| 163 | system_timer->init(); | 165 | system_timer->init(); |
| 164 | } | 166 | } |
| 165 | 167 | ||
