diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-07-26 09:55:59 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-07-26 09:55:59 -0400 |
commit | ff69a4c855066592f9e293cff8f54813614dd544 (patch) | |
tree | c1fcee172f8bfb62c7c6b970b0c9f57ae35f9df4 /arch | |
parent | 3b2f64d00c46e1e4e9bd0bb9bb12619adac27a4b (diff) |
ARM: constify machine_desc structure uses
struct machine_desc records are defined everywhere as a 'const'
structure, but unfortuantely it loses its const-ness through the use of
linker magic - the symbols which surround the section are not declared
const so it becomes possible not to use 'const' for pointers to these
const structures.
Let's fix this oversight - all pointers to these structures should be
marked const too.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/mach/arch.h | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/memblock.h | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/prom.h | 4 | ||||
-rw-r--r-- | arch/arm/kernel/atags.h | 5 | ||||
-rw-r--r-- | arch/arm/kernel/atags_parse.c | 6 | ||||
-rw-r--r-- | arch/arm/kernel/devtree.c | 6 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 12 | ||||
-rw-r--r-- | arch/arm/mm/init.c | 5 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 4 | ||||
-rw-r--r-- | arch/arm/mm/nommu.c | 2 |
10 files changed, 26 insertions, 25 deletions
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 441efc491b50..69b879ac0289 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
@@ -65,12 +65,12 @@ struct machine_desc { | |||
65 | /* | 65 | /* |
66 | * Current machine - only accessible during boot. | 66 | * Current machine - only accessible during boot. |
67 | */ | 67 | */ |
68 | extern struct machine_desc *machine_desc; | 68 | extern const struct machine_desc *machine_desc; |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Machine type table - also only accessible during boot | 71 | * Machine type table - also only accessible during boot |
72 | */ | 72 | */ |
73 | extern struct machine_desc __arch_info_begin[], __arch_info_end[]; | 73 | extern const struct machine_desc __arch_info_begin[], __arch_info_end[]; |
74 | #define for_each_machine_desc(p) \ | 74 | #define for_each_machine_desc(p) \ |
75 | for (p = __arch_info_begin; p < __arch_info_end; p++) | 75 | for (p = __arch_info_begin; p < __arch_info_end; p++) |
76 | 76 | ||
diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h index 00ca5f92648e..c2f5102ae659 100644 --- a/arch/arm/include/asm/memblock.h +++ b/arch/arm/include/asm/memblock.h | |||
@@ -4,8 +4,7 @@ | |||
4 | struct meminfo; | 4 | struct meminfo; |
5 | struct machine_desc; | 5 | struct machine_desc; |
6 | 6 | ||
7 | extern void arm_memblock_init(struct meminfo *, struct machine_desc *); | 7 | void arm_memblock_init(struct meminfo *, const struct machine_desc *); |
8 | |||
9 | phys_addr_t arm_memblock_steal(phys_addr_t size, phys_addr_t align); | 8 | phys_addr_t arm_memblock_steal(phys_addr_t size, phys_addr_t align); |
10 | 9 | ||
11 | #endif | 10 | #endif |
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h index a219227c3e43..4a2985e21969 100644 --- a/arch/arm/include/asm/prom.h +++ b/arch/arm/include/asm/prom.h | |||
@@ -15,13 +15,13 @@ | |||
15 | 15 | ||
16 | #ifdef CONFIG_OF | 16 | #ifdef CONFIG_OF |
17 | 17 | ||
18 | extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); | 18 | extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys); |
19 | extern void arm_dt_memblock_reserve(void); | 19 | extern void arm_dt_memblock_reserve(void); |
20 | extern void __init arm_dt_init_cpu_maps(void); | 20 | extern void __init arm_dt_init_cpu_maps(void); |
21 | 21 | ||
22 | #else /* CONFIG_OF */ | 22 | #else /* CONFIG_OF */ |
23 | 23 | ||
24 | static inline struct machine_desc *setup_machine_fdt(unsigned int dt_phys) | 24 | static inline const struct machine_desc *setup_machine_fdt(unsigned int dt_phys) |
25 | { | 25 | { |
26 | return NULL; | 26 | return NULL; |
27 | } | 27 | } |
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h index 9edc9692332d..ec4164da6e30 100644 --- a/arch/arm/kernel/atags.h +++ b/arch/arm/kernel/atags.h | |||
@@ -7,9 +7,10 @@ static inline void save_atags(struct tag *tags) { } | |||
7 | void convert_to_tag_list(struct tag *tags); | 7 | void convert_to_tag_list(struct tag *tags); |
8 | 8 | ||
9 | #ifdef CONFIG_ATAGS | 9 | #ifdef CONFIG_ATAGS |
10 | struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr); | 10 | const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer, |
11 | unsigned int machine_nr); | ||
11 | #else | 12 | #else |
12 | static inline struct machine_desc * | 13 | static inline const struct machine_desc * |
13 | setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) | 14 | setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) |
14 | { | 15 | { |
15 | early_print("no ATAGS support: can't continue\n"); | 16 | early_print("no ATAGS support: can't continue\n"); |
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c index 14512e6931d8..8c14de8180c0 100644 --- a/arch/arm/kernel/atags_parse.c +++ b/arch/arm/kernel/atags_parse.c | |||
@@ -178,11 +178,11 @@ static void __init squash_mem_tags(struct tag *tag) | |||
178 | tag->hdr.tag = ATAG_NONE; | 178 | tag->hdr.tag = ATAG_NONE; |
179 | } | 179 | } |
180 | 180 | ||
181 | struct machine_desc * __init setup_machine_tags(phys_addr_t __atags_pointer, | 181 | const struct machine_desc * __init |
182 | unsigned int machine_nr) | 182 | setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) |
183 | { | 183 | { |
184 | struct tag *tags = (struct tag *)&default_tags; | 184 | struct tag *tags = (struct tag *)&default_tags; |
185 | struct machine_desc *mdesc = NULL, *p; | 185 | const struct machine_desc *mdesc = NULL, *p; |
186 | char *from = default_command_line; | 186 | char *from = default_command_line; |
187 | 187 | ||
188 | default_tags.mem.start = PHYS_OFFSET; | 188 | default_tags.mem.start = PHYS_OFFSET; |
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 5859c8bc727c..eae1976f859d 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c | |||
@@ -176,10 +176,10 @@ void __init arm_dt_init_cpu_maps(void) | |||
176 | * If a dtb was passed to the kernel in r2, then use it to choose the | 176 | * If a dtb was passed to the kernel in r2, then use it to choose the |
177 | * correct machine_desc and to setup the system. | 177 | * correct machine_desc and to setup the system. |
178 | */ | 178 | */ |
179 | struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) | 179 | const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) |
180 | { | 180 | { |
181 | struct boot_param_header *devtree; | 181 | struct boot_param_header *devtree; |
182 | struct machine_desc *mdesc, *mdesc_best = NULL; | 182 | const struct machine_desc *mdesc, *mdesc_best = NULL; |
183 | unsigned int score, mdesc_score = ~1; | 183 | unsigned int score, mdesc_score = ~1; |
184 | unsigned long dt_root; | 184 | unsigned long dt_root; |
185 | const char *model; | 185 | const char *model; |
@@ -188,7 +188,7 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) | |||
188 | DT_MACHINE_START(GENERIC_DT, "Generic DT based system") | 188 | DT_MACHINE_START(GENERIC_DT, "Generic DT based system") |
189 | MACHINE_END | 189 | MACHINE_END |
190 | 190 | ||
191 | mdesc_best = (struct machine_desc *)&__mach_desc_GENERIC_DT; | 191 | mdesc_best = &__mach_desc_GENERIC_DT; |
192 | #endif | 192 | #endif |
193 | 193 | ||
194 | if (!dt_phys) | 194 | if (!dt_phys) |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 63af9a7ae512..863629989f02 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -72,10 +72,10 @@ static int __init fpe_setup(char *line) | |||
72 | __setup("fpe=", fpe_setup); | 72 | __setup("fpe=", fpe_setup); |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | extern void paging_init(struct machine_desc *desc); | 75 | extern void paging_init(const struct machine_desc *desc); |
76 | extern void sanity_check_meminfo(void); | 76 | extern void sanity_check_meminfo(void); |
77 | extern enum reboot_mode reboot_mode; | 77 | extern enum reboot_mode reboot_mode; |
78 | extern void setup_dma_zone(struct machine_desc *desc); | 78 | extern void setup_dma_zone(const struct machine_desc *desc); |
79 | 79 | ||
80 | unsigned int processor_id; | 80 | unsigned int processor_id; |
81 | EXPORT_SYMBOL(processor_id); | 81 | EXPORT_SYMBOL(processor_id); |
@@ -139,7 +139,7 @@ EXPORT_SYMBOL(elf_platform); | |||
139 | static const char *cpu_name; | 139 | static const char *cpu_name; |
140 | static const char *machine_name; | 140 | static const char *machine_name; |
141 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; | 141 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; |
142 | struct machine_desc *machine_desc __initdata; | 142 | const struct machine_desc *machine_desc __initdata; |
143 | 143 | ||
144 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; | 144 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; |
145 | #define ENDIANNESS ((char)endian_test.l) | 145 | #define ENDIANNESS ((char)endian_test.l) |
@@ -607,7 +607,7 @@ static void __init setup_processor(void) | |||
607 | 607 | ||
608 | void __init dump_machine_table(void) | 608 | void __init dump_machine_table(void) |
609 | { | 609 | { |
610 | struct machine_desc *p; | 610 | const struct machine_desc *p; |
611 | 611 | ||
612 | early_print("Available machine support:\n\nID (hex)\tNAME\n"); | 612 | early_print("Available machine support:\n\nID (hex)\tNAME\n"); |
613 | for_each_machine_desc(p) | 613 | for_each_machine_desc(p) |
@@ -694,7 +694,7 @@ static int __init early_mem(char *p) | |||
694 | } | 694 | } |
695 | early_param("mem", early_mem); | 695 | early_param("mem", early_mem); |
696 | 696 | ||
697 | static void __init request_standard_resources(struct machine_desc *mdesc) | 697 | static void __init request_standard_resources(const struct machine_desc *mdesc) |
698 | { | 698 | { |
699 | struct memblock_region *region; | 699 | struct memblock_region *region; |
700 | struct resource *res; | 700 | struct resource *res; |
@@ -850,7 +850,7 @@ void __init hyp_mode_check(void) | |||
850 | 850 | ||
851 | void __init setup_arch(char **cmdline_p) | 851 | void __init setup_arch(char **cmdline_p) |
852 | { | 852 | { |
853 | struct machine_desc *mdesc; | 853 | const struct machine_desc *mdesc; |
854 | 854 | ||
855 | setup_processor(); | 855 | setup_processor(); |
856 | mdesc = setup_machine_fdt(__atags_pointer); | 856 | mdesc = setup_machine_fdt(__atags_pointer); |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 15225d829d71..2958e74fc42c 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -231,7 +231,7 @@ static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, | |||
231 | } | 231 | } |
232 | #endif | 232 | #endif |
233 | 233 | ||
234 | void __init setup_dma_zone(struct machine_desc *mdesc) | 234 | void __init setup_dma_zone(const struct machine_desc *mdesc) |
235 | { | 235 | { |
236 | #ifdef CONFIG_ZONE_DMA | 236 | #ifdef CONFIG_ZONE_DMA |
237 | if (mdesc->dma_zone_size) { | 237 | if (mdesc->dma_zone_size) { |
@@ -335,7 +335,8 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align) | |||
335 | return phys; | 335 | return phys; |
336 | } | 336 | } |
337 | 337 | ||
338 | void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) | 338 | void __init arm_memblock_init(struct meminfo *mi, |
339 | const struct machine_desc *mdesc) | ||
339 | { | 340 | { |
340 | int i; | 341 | int i; |
341 | 342 | ||
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4f56617a2392..56054ac8348e 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -1151,7 +1151,7 @@ void __init arm_mm_memblock_reserve(void) | |||
1151 | * called function. This means you can't use any function or debugging | 1151 | * called function. This means you can't use any function or debugging |
1152 | * method which may touch any device, otherwise the kernel _will_ crash. | 1152 | * method which may touch any device, otherwise the kernel _will_ crash. |
1153 | */ | 1153 | */ |
1154 | static void __init devicemaps_init(struct machine_desc *mdesc) | 1154 | static void __init devicemaps_init(const struct machine_desc *mdesc) |
1155 | { | 1155 | { |
1156 | struct map_desc map; | 1156 | struct map_desc map; |
1157 | unsigned long addr; | 1157 | unsigned long addr; |
@@ -1272,7 +1272,7 @@ static void __init map_lowmem(void) | |||
1272 | * paging_init() sets up the page tables, initialises the zone memory | 1272 | * paging_init() sets up the page tables, initialises the zone memory |
1273 | * maps, and sets up the zero page, bad page and bad page tables. | 1273 | * maps, and sets up the zero page, bad page and bad page tables. |
1274 | */ | 1274 | */ |
1275 | void __init paging_init(struct machine_desc *mdesc) | 1275 | void __init paging_init(const struct machine_desc *mdesc) |
1276 | { | 1276 | { |
1277 | void *zero_page; | 1277 | void *zero_page; |
1278 | 1278 | ||
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 1fa50100ab6a..34d4ab217bab 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -299,7 +299,7 @@ void __init sanity_check_meminfo(void) | |||
299 | * paging_init() sets up the page tables, initialises the zone memory | 299 | * paging_init() sets up the page tables, initialises the zone memory |
300 | * maps, and sets up the zero page, bad page and bad page tables. | 300 | * maps, and sets up the zero page, bad page and bad page tables. |
301 | */ | 301 | */ |
302 | void __init paging_init(struct machine_desc *mdesc) | 302 | void __init paging_init(const struct machine_desc *mdesc) |
303 | { | 303 | { |
304 | early_trap_init((void *)CONFIG_VECTORS_BASE); | 304 | early_trap_init((void *)CONFIG_VECTORS_BASE); |
305 | mpu_setup(); | 305 | mpu_setup(); |