Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+15 -19
+5
arch/arm/include/asm/mach/arch.h
··· 46 46 }; 47 47 48 48 /* 49 + * Current machine - only accessible during boot. 50 + */ 51 + extern struct machine_desc *machine_desc; 52 + 53 + /* 49 54 * Set of macros to define architecture features. This is built into 50 55 * a table by the linker. 51 56 */
-2
arch/arm/include/asm/mach/irq.h
··· 17 17 /* 18 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 20 extern void init_FIQ(void); 23 21 extern int show_fiq_list(struct seq_file *, void *); 24 22
-1
arch/arm/include/asm/mach/time.h
··· 43 43 #endif 44 44 }; 45 45 46 - extern struct sys_timer *system_timer; 47 46 extern void timer_tick(void); 48 47 49 48 #endif
+3 -4
arch/arm/kernel/irq.c
··· 37 37 #include <linux/proc_fs.h> 38 38 39 39 #include <asm/system.h> 40 + #include <asm/mach/arch.h> 40 41 #include <asm/mach/irq.h> 41 42 #include <asm/mach/time.h> 42 43 ··· 48 47 #define irq_finish(irq) do { } while (0) 49 48 #endif 50 49 51 - unsigned int arch_nr_irqs; 52 - void (*init_arch_irq)(void) __initdata = NULL; 53 50 unsigned long irq_err_count; 54 51 55 52 int show_interrupts(struct seq_file *p, void *v) ··· 153 154 154 155 void __init init_IRQ(void) 155 156 { 156 - init_arch_irq(); 157 + machine_desc->init_irq(); 157 158 } 158 159 159 160 #ifdef CONFIG_SPARSE_IRQ 160 161 int __init arch_probe_nr_irqs(void) 161 162 { 162 - nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS; 163 + nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs : NR_IRQS; 163 164 return nr_irqs; 164 165 } 165 166 #endif
+4 -11
arch/arm/kernel/setup.c
··· 126 126 static const char *cpu_name; 127 127 static const char *machine_name; 128 128 static char __initdata cmd_line[COMMAND_LINE_SIZE]; 129 + struct machine_desc *machine_desc __initdata; 129 130 130 131 static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; 131 132 static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; ··· 709 708 { 0, ATAG_NONE } 710 709 }; 711 710 712 - static void (*init_machine)(void) __initdata; 713 - 714 711 static int __init customize_machine(void) 715 712 { 716 713 /* customizes platform devices, or adds new ones */ 717 - if (init_machine) 718 - init_machine(); 714 + if (machine_desc->init_machine) 715 + machine_desc->init_machine(); 719 716 return 0; 720 717 } 721 718 arch_initcall(customize_machine); ··· 808 809 809 810 setup_processor(); 810 811 mdesc = setup_machine(machine_arch_type); 812 + machine_desc = mdesc; 811 813 machine_name = mdesc->name; 812 814 813 815 if (mdesc->soft_reboot) ··· 868 868 cpu_init(); 869 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 871 #ifdef CONFIG_MULTI_IRQ_HANDLER 879 872 handle_arch_irq = mdesc->handle_irq; 880 873 #endif
+3 -1
arch/arm/kernel/time.c
··· 30 30 #include <asm/leds.h> 31 31 #include <asm/thread_info.h> 32 32 #include <asm/stacktrace.h> 33 + #include <asm/mach/arch.h> 33 34 #include <asm/mach/time.h> 34 35 35 36 /* 36 37 * Our system timer. 37 38 */ 38 - struct sys_timer *system_timer; 39 + static struct sys_timer *system_timer; 39 40 40 41 #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) 41 42 /* this needs a better home */ ··· 161 160 162 161 void __init time_init(void) 163 162 { 163 + system_timer = machine_desc->timer; 164 164 system_timer->init(); 165 165 } 166 166