Skip to content

Commit 8ff1443

Browse files
author
Russell King
committed
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>
1 parent cd544ce commit 8ff1443

6 files changed

Lines changed: 15 additions & 19 deletions

File tree

‎arch/arm/include/asm/mach/arch.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ struct machine_desc {
4545
#endif
4646
};
4747

48+
/*
49+
* Current machine - only accessible during boot.
50+
*/
51+
extern struct machine_desc *machine_desc;
52+
4853
/*
4954
* Set of macros to define architecture features. This is built into
5055
* a table by the linker.

‎arch/arm/include/asm/mach/irq.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ struct seq_file;
1717
/*
1818
* This is internal. Do not use it.
1919
*/
20-
extern unsigned int arch_nr_irqs;
21-
extern void (*init_arch_irq)(void);
2220
extern void init_FIQ(void);
2321
extern int show_fiq_list(struct seq_file *, void *);
2422

‎arch/arm/include/asm/mach/time.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct sys_timer {
4343
#endif
4444
};
4545

46-
extern struct sys_timer *system_timer;
4746
extern void timer_tick(void);
4847

4948
#endif

‎arch/arm/kernel/irq.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <linux/proc_fs.h>
3838

3939
#include <asm/system.h>
40+
#include <asm/mach/arch.h>
4041
#include <asm/mach/irq.h>
4142
#include <asm/mach/time.h>
4243

@@ -47,8 +48,6 @@
4748
#define irq_finish(irq) do { } while (0)
4849
#endif
4950

50-
unsigned int arch_nr_irqs;
51-
void (*init_arch_irq)(void) __initdata = NULL;
5251
unsigned long irq_err_count;
5352

5453
int show_interrupts(struct seq_file *p, void *v)
@@ -154,13 +153,13 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
154153

155154
void __init init_IRQ(void)
156155
{
157-
init_arch_irq();
156+
machine_desc->init_irq();
158157
}
159158

160159
#ifdef CONFIG_SPARSE_IRQ
161160
int __init arch_probe_nr_irqs(void)
162161
{
163-
nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS;
162+
nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs : NR_IRQS;
164163
return nr_irqs;
165164
}
166165
#endif

‎arch/arm/kernel/setup.c‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ EXPORT_SYMBOL(elf_platform);
126126
static const char *cpu_name;
127127
static const char *machine_name;
128128
static char __initdata cmd_line[COMMAND_LINE_SIZE];
129+
struct machine_desc *machine_desc __initdata;
129130

130131
static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
131132
static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
@@ -708,13 +709,11 @@ static struct init_tags {
708709
{ 0, ATAG_NONE }
709710
};
710711

711-
static void (*init_machine)(void) __initdata;
712-
713712
static int __init customize_machine(void)
714713
{
715714
/* customizes platform devices, or adds new ones */
716-
if (init_machine)
717-
init_machine();
715+
if (machine_desc->init_machine)
716+
machine_desc->init_machine();
718717
return 0;
719718
}
720719
arch_initcall(customize_machine);
@@ -809,6 +808,7 @@ void __init setup_arch(char **cmdline_p)
809808

810809
setup_processor();
811810
mdesc = setup_machine(machine_arch_type);
811+
machine_desc = mdesc;
812812
machine_name = mdesc->name;
813813

814814
if (mdesc->soft_reboot)
@@ -868,13 +868,6 @@ void __init setup_arch(char **cmdline_p)
868868
cpu_init();
869869
tcm_init();
870870

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;
878871
#ifdef CONFIG_MULTI_IRQ_HANDLER
879872
handle_arch_irq = mdesc->handle_irq;
880873
#endif

‎arch/arm/kernel/time.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
#include <asm/leds.h>
3131
#include <asm/thread_info.h>
3232
#include <asm/stacktrace.h>
33+
#include <asm/mach/arch.h>
3334
#include <asm/mach/time.h>
3435

3536
/*
3637
* Our system timer.
3738
*/
38-
struct sys_timer *system_timer;
39+
static struct sys_timer *system_timer;
3940

4041
#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
4142
/* this needs a better home */
@@ -160,6 +161,7 @@ device_initcall(timer_init_sysfs);
160161

161162
void __init time_init(void)
162163
{
164+
system_timer = machine_desc->timer;
163165
system_timer->init();
164166
}
165167

0 commit comments

Comments
 (0)