diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2006-07-04 02:46:44 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-07 06:19:16 -0400 |
commit | b5a1a9abe1a54ba40a9612001920f98bbdd0c56f (patch) | |
tree | e0ed5a874d08e753b9643120cc68900c31c95cbe | |
parent | 980ffd3258dbcdb011e929de5d658ec81febba8d (diff) |
[POWERPC] Use const qualifiers for prom parsing utilites
The of_bus callbacks map and get_flags can be constified, as they don't
alter the range or addr arguments. of_dump_addr and of_read_addr can
also be constified.
Built for 32- and 64-bit powerpc
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/prom_parse.c | 22 | ||||
-rw-r--r-- | include/asm-powerpc/prom.h | 2 |
2 files changed, 13 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index 21009b1f7869..e9960170667b 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | /* Debug utility */ | 28 | /* Debug utility */ |
29 | #ifdef DEBUG | 29 | #ifdef DEBUG |
30 | static void of_dump_addr(const char *s, u32 *addr, int na) | 30 | static void of_dump_addr(const char *s, const u32 *addr, int na) |
31 | { | 31 | { |
32 | printk("%s", s); | 32 | printk("%s", s); |
33 | while(na--) | 33 | while(na--) |
@@ -35,7 +35,7 @@ static void of_dump_addr(const char *s, u32 *addr, int na) | |||
35 | printk("\n"); | 35 | printk("\n"); |
36 | } | 36 | } |
37 | #else | 37 | #else |
38 | static void of_dump_addr(const char *s, u32 *addr, int na) { } | 38 | static void of_dump_addr(const char *s, const u32 *addr, int na) { } |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | 41 | ||
@@ -46,9 +46,10 @@ struct of_bus { | |||
46 | int (*match)(struct device_node *parent); | 46 | int (*match)(struct device_node *parent); |
47 | void (*count_cells)(struct device_node *child, | 47 | void (*count_cells)(struct device_node *child, |
48 | int *addrc, int *sizec); | 48 | int *addrc, int *sizec); |
49 | u64 (*map)(u32 *addr, u32 *range, int na, int ns, int pna); | 49 | u64 (*map)(u32 *addr, const u32 *range, |
50 | int na, int ns, int pna); | ||
50 | int (*translate)(u32 *addr, u64 offset, int na); | 51 | int (*translate)(u32 *addr, u64 offset, int na); |
51 | unsigned int (*get_flags)(u32 *addr); | 52 | unsigned int (*get_flags)(const u32 *addr); |
52 | }; | 53 | }; |
53 | 54 | ||
54 | 55 | ||
@@ -65,7 +66,8 @@ static void of_bus_default_count_cells(struct device_node *dev, | |||
65 | *sizec = prom_n_size_cells(dev); | 66 | *sizec = prom_n_size_cells(dev); |
66 | } | 67 | } |
67 | 68 | ||
68 | static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna) | 69 | static u64 of_bus_default_map(u32 *addr, const u32 *range, |
70 | int na, int ns, int pna) | ||
69 | { | 71 | { |
70 | u64 cp, s, da; | 72 | u64 cp, s, da; |
71 | 73 | ||
@@ -93,7 +95,7 @@ static int of_bus_default_translate(u32 *addr, u64 offset, int na) | |||
93 | return 0; | 95 | return 0; |
94 | } | 96 | } |
95 | 97 | ||
96 | static unsigned int of_bus_default_get_flags(u32 *addr) | 98 | static unsigned int of_bus_default_get_flags(const u32 *addr) |
97 | { | 99 | { |
98 | return IORESOURCE_MEM; | 100 | return IORESOURCE_MEM; |
99 | } | 101 | } |
@@ -118,7 +120,7 @@ static void of_bus_pci_count_cells(struct device_node *np, | |||
118 | *sizec = 2; | 120 | *sizec = 2; |
119 | } | 121 | } |
120 | 122 | ||
121 | static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna) | 123 | static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna) |
122 | { | 124 | { |
123 | u64 cp, s, da; | 125 | u64 cp, s, da; |
124 | 126 | ||
@@ -143,7 +145,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na) | |||
143 | return of_bus_default_translate(addr + 1, offset, na - 1); | 145 | return of_bus_default_translate(addr + 1, offset, na - 1); |
144 | } | 146 | } |
145 | 147 | ||
146 | static unsigned int of_bus_pci_get_flags(u32 *addr) | 148 | static unsigned int of_bus_pci_get_flags(const u32 *addr) |
147 | { | 149 | { |
148 | unsigned int flags = 0; | 150 | unsigned int flags = 0; |
149 | u32 w = addr[0]; | 151 | u32 w = addr[0]; |
@@ -178,7 +180,7 @@ static void of_bus_isa_count_cells(struct device_node *child, | |||
178 | *sizec = 1; | 180 | *sizec = 1; |
179 | } | 181 | } |
180 | 182 | ||
181 | static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna) | 183 | static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna) |
182 | { | 184 | { |
183 | u64 cp, s, da; | 185 | u64 cp, s, da; |
184 | 186 | ||
@@ -203,7 +205,7 @@ static int of_bus_isa_translate(u32 *addr, u64 offset, int na) | |||
203 | return of_bus_default_translate(addr + 1, offset, na - 1); | 205 | return of_bus_default_translate(addr + 1, offset, na - 1); |
204 | } | 206 | } |
205 | 207 | ||
206 | static unsigned int of_bus_isa_get_flags(u32 *addr) | 208 | static unsigned int of_bus_isa_get_flags(const u32 *addr) |
207 | { | 209 | { |
208 | unsigned int flags = 0; | 210 | unsigned int flags = 0; |
209 | u32 w = addr[0]; | 211 | u32 w = addr[0]; |
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index b095a285c84b..56f6ea0c76de 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
@@ -198,7 +198,7 @@ extern int release_OF_resource(struct device_node* node, int index); | |||
198 | 198 | ||
199 | 199 | ||
200 | /* Helper to read a big number */ | 200 | /* Helper to read a big number */ |
201 | static inline u64 of_read_number(u32 *cell, int size) | 201 | static inline u64 of_read_number(const u32 *cell, int size) |
202 | { | 202 | { |
203 | u64 r = 0; | 203 | u64 r = 0; |
204 | while (size--) | 204 | while (size--) |