aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-07-12 01:35:54 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-31 01:55:04 -0400
commita7f67bdf2c9f24509b8e81e0f35573b611987c80 (patch)
tree201662dd6504418ef3c84cfe1f280153a4d8cb29 /arch/powerpc/kernel
parent4288b92b9644fdb4c6168273873fe08f32090d7a (diff)
[POWERPC] Constify & voidify get_property()
Now that get_property() returns a void *, there's no need to cast its return value. Also, treat the return value as const, so we can constify get_property later. powerpc core changes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/btext.c24
-rw-r--r--arch/powerpc/kernel/ibmebus.c6
-rw-r--r--arch/powerpc/kernel/legacy_serial.c35
-rw-r--r--arch/powerpc/kernel/lparcfg.c11
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c10
-rw-r--r--arch/powerpc/kernel/pci_32.c39
-rw-r--r--arch/powerpc/kernel/pci_64.c28
-rw-r--r--arch/powerpc/kernel/pci_dn.c13
-rw-r--r--arch/powerpc/kernel/prom.c23
-rw-r--r--arch/powerpc/kernel/prom_parse.c68
-rw-r--r--arch/powerpc/kernel/rtas-proc.c25
-rw-r--r--arch/powerpc/kernel/rtas.c28
-rw-r--r--arch/powerpc/kernel/rtas_pci.c22
-rw-r--r--arch/powerpc/kernel/setup-common.c19
-rw-r--r--arch/powerpc/kernel/setup_64.c14
-rw-r--r--arch/powerpc/kernel/sysfs.c5
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kernel/vio.c16
18 files changed, 197 insertions, 193 deletions
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index f4e5e14ee2b6..995fcef156fd 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -158,35 +158,35 @@ int btext_initialize(struct device_node *np)
158{ 158{
159 unsigned int width, height, depth, pitch; 159 unsigned int width, height, depth, pitch;
160 unsigned long address = 0; 160 unsigned long address = 0;
161 u32 *prop; 161 const u32 *prop;
162 162
163 prop = (u32 *)get_property(np, "linux,bootx-width", NULL); 163 prop = get_property(np, "linux,bootx-width", NULL);
164 if (prop == NULL) 164 if (prop == NULL)
165 prop = (u32 *)get_property(np, "width", NULL); 165 prop = get_property(np, "width", NULL);
166 if (prop == NULL) 166 if (prop == NULL)
167 return -EINVAL; 167 return -EINVAL;
168 width = *prop; 168 width = *prop;
169 prop = (u32 *)get_property(np, "linux,bootx-height", NULL); 169 prop = get_property(np, "linux,bootx-height", NULL);
170 if (prop == NULL) 170 if (prop == NULL)
171 prop = (u32 *)get_property(np, "height", NULL); 171 prop = get_property(np, "height", NULL);
172 if (prop == NULL) 172 if (prop == NULL)
173 return -EINVAL; 173 return -EINVAL;
174 height = *prop; 174 height = *prop;
175 prop = (u32 *)get_property(np, "linux,bootx-depth", NULL); 175 prop = get_property(np, "linux,bootx-depth", NULL);
176 if (prop == NULL) 176 if (prop == NULL)
177 prop = (u32 *)get_property(np, "depth", NULL); 177 prop = get_property(np, "depth", NULL);
178 if (prop == NULL) 178 if (prop == NULL)
179 return -EINVAL; 179 return -EINVAL;
180 depth = *prop; 180 depth = *prop;
181 pitch = width * ((depth + 7) / 8); 181 pitch = width * ((depth + 7) / 8);
182 prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL); 182 prop = get_property(np, "linux,bootx-linebytes", NULL);
183 if (prop == NULL) 183 if (prop == NULL)
184 prop = (u32 *)get_property(np, "linebytes", NULL); 184 prop = get_property(np, "linebytes", NULL);
185 if (prop) 185 if (prop)
186 pitch = *prop; 186 pitch = *prop;
187 if (pitch == 1) 187 if (pitch == 1)
188 pitch = 0x1000; 188 pitch = 0x1000;
189 prop = (u32 *)get_property(np, "address", NULL); 189 prop = get_property(np, "address", NULL);
190 if (prop) 190 if (prop)
191 address = *prop; 191 address = *prop;
192 192
@@ -214,11 +214,11 @@ int btext_initialize(struct device_node *np)
214 214
215int __init btext_find_display(int allow_nonstdout) 215int __init btext_find_display(int allow_nonstdout)
216{ 216{
217 char *name; 217 const char *name;
218 struct device_node *np = NULL; 218 struct device_node *np = NULL;
219 int rc = -ENODEV; 219 int rc = -ENODEV;
220 220
221 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 221 name = get_property(of_chosen, "linux,stdout-path", NULL);
222 if (name != NULL) { 222 if (name != NULL) {
223 np = of_find_node_by_path(name); 223 np = of_find_node_by_path(name);
224 if (np != NULL) { 224 if (np != NULL) {
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 97ddc02a3d42..d9a0b087fa7f 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -167,7 +167,7 @@ static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name,
167 NULL); 167 NULL);
168 168
169static struct ibmebus_dev* __devinit ibmebus_register_device_common( 169static struct ibmebus_dev* __devinit ibmebus_register_device_common(
170 struct ibmebus_dev *dev, char *name) 170 struct ibmebus_dev *dev, const char *name)
171{ 171{
172 int err = 0; 172 int err = 0;
173 173
@@ -194,10 +194,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node(
194 struct device_node *dn) 194 struct device_node *dn)
195{ 195{
196 struct ibmebus_dev *dev; 196 struct ibmebus_dev *dev;
197 char *loc_code; 197 const char *loc_code;
198 int length; 198 int length;
199 199
200 loc_code = (char *)get_property(dn, "ibm,loc-code", NULL); 200 loc_code = get_property(dn, "ibm,loc-code", NULL);
201 if (!loc_code) { 201 if (!loc_code) {
202 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", 202 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n",
203 __FUNCTION__, dn->name ? dn->name : "<unknown>"); 203 __FUNCTION__, dn->name ? dn->name : "<unknown>");
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 359ab89748e0..ee1e0b8c7f1f 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
39 phys_addr_t taddr, unsigned long irq, 39 phys_addr_t taddr, unsigned long irq,
40 upf_t flags, int irq_check_parent) 40 upf_t flags, int irq_check_parent)
41{ 41{
42 u32 *clk, *spd, clock = BASE_BAUD * 16; 42 const u32 *clk, *spd;
43 u32 clock = BASE_BAUD * 16;
43 int index; 44 int index;
44 45
45 /* get clock freq. if present */ 46 /* get clock freq. if present */
46 clk = (u32 *)get_property(np, "clock-frequency", NULL); 47 clk = get_property(np, "clock-frequency", NULL);
47 if (clk && *clk) 48 if (clk && *clk)
48 clock = *clk; 49 clock = *clk;
49 50
50 /* get default speed if present */ 51 /* get default speed if present */
51 spd = (u32 *)get_property(np, "current-speed", NULL); 52 spd = get_property(np, "current-speed", NULL);
52 53
53 /* If we have a location index, then try to use it */ 54 /* If we have a location index, then try to use it */
54 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) 55 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np,
113 struct device_node *soc_dev) 114 struct device_node *soc_dev)
114{ 115{
115 u64 addr; 116 u64 addr;
116 u32 *addrp; 117 const u32 *addrp;
117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; 118 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
118 119
119 /* We only support ports that have a clock frequency properly 120 /* We only support ports that have a clock frequency properly
@@ -140,15 +141,15 @@ static int __init add_legacy_soc_port(struct device_node *np,
140static int __init add_legacy_isa_port(struct device_node *np, 141static int __init add_legacy_isa_port(struct device_node *np,
141 struct device_node *isa_brg) 142 struct device_node *isa_brg)
142{ 143{
143 u32 *reg; 144 const u32 *reg;
144 char *typep; 145 const char *typep;
145 int index = -1; 146 int index = -1;
146 u64 taddr; 147 u64 taddr;
147 148
148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); 149 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
149 150
150 /* Get the ISA port number */ 151 /* Get the ISA port number */
151 reg = (u32 *)get_property(np, "reg", NULL); 152 reg = get_property(np, "reg", NULL);
152 if (reg == NULL) 153 if (reg == NULL)
153 return -1; 154 return -1;
154 155
@@ -159,7 +160,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
159 /* Now look for an "ibm,aix-loc" property that gives us ordering 160 /* Now look for an "ibm,aix-loc" property that gives us ordering
160 * if any... 161 * if any...
161 */ 162 */
162 typep = (char *)get_property(np, "ibm,aix-loc", NULL); 163 typep = get_property(np, "ibm,aix-loc", NULL);
163 164
164 /* If we have a location index, then use it */ 165 /* If we have a location index, then use it */
165 if (typep && *typep == 'S') 166 if (typep && *typep == 'S')
@@ -184,7 +185,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
184 struct device_node *pci_dev) 185 struct device_node *pci_dev)
185{ 186{
186 u64 addr, base; 187 u64 addr, base;
187 u32 *addrp; 188 const u32 *addrp;
188 unsigned int flags; 189 unsigned int flags;
189 int iotype, index = -1, lindex = 0; 190 int iotype, index = -1, lindex = 0;
190 191
@@ -223,7 +224,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
223 * we get to their "reg" property 224 * we get to their "reg" property
224 */ 225 */
225 if (np != pci_dev) { 226 if (np != pci_dev) {
226 u32 *reg = (u32 *)get_property(np, "reg", NULL); 227 const u32 *reg = get_property(np, "reg", NULL);
227 if (reg && (*reg < 4)) 228 if (reg && (*reg < 4))
228 index = lindex = *reg; 229 index = lindex = *reg;
229 } 230 }
@@ -281,13 +282,13 @@ static void __init setup_legacy_serial_console(int console)
281void __init find_legacy_serial_ports(void) 282void __init find_legacy_serial_ports(void)
282{ 283{
283 struct device_node *np, *stdout = NULL; 284 struct device_node *np, *stdout = NULL;
284 char *path; 285 const char *path;
285 int index; 286 int index;
286 287
287 DBG(" -> find_legacy_serial_port()\n"); 288 DBG(" -> find_legacy_serial_port()\n");
288 289
289 /* Now find out if one of these is out firmware console */ 290 /* Now find out if one of these is out firmware console */
290 path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 291 path = get_property(of_chosen, "linux,stdout-path", NULL);
291 if (path != NULL) { 292 if (path != NULL) {
292 stdout = of_find_node_by_path(path); 293 stdout = of_find_node_by_path(path);
293 if (stdout) 294 if (stdout)
@@ -487,8 +488,8 @@ static int __init check_legacy_serial_console(void)
487{ 488{
488 struct device_node *prom_stdout = NULL; 489 struct device_node *prom_stdout = NULL;
489 int speed = 0, offset = 0; 490 int speed = 0, offset = 0;
490 char *name; 491 const char *name;
491 u32 *spd; 492 const u32 *spd;
492 493
493 DBG(" -> check_legacy_serial_console()\n"); 494 DBG(" -> check_legacy_serial_console()\n");
494 495
@@ -509,7 +510,7 @@ static int __init check_legacy_serial_console(void)
509 } 510 }
510 /* We are getting a weird phandle from OF ... */ 511 /* We are getting a weird phandle from OF ... */
511 /* ... So use the full path instead */ 512 /* ... So use the full path instead */
512 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 513 name = get_property(of_chosen, "linux,stdout-path", NULL);
513 if (name == NULL) { 514 if (name == NULL) {
514 DBG(" no linux,stdout-path !\n"); 515 DBG(" no linux,stdout-path !\n");
515 return -ENODEV; 516 return -ENODEV;
@@ -521,12 +522,12 @@ static int __init check_legacy_serial_console(void)
521 } 522 }
522 DBG("stdout is %s\n", prom_stdout->full_name); 523 DBG("stdout is %s\n", prom_stdout->full_name);
523 524
524 name = (char *)get_property(prom_stdout, "name", NULL); 525 name = get_property(prom_stdout, "name", NULL);
525 if (!name) { 526 if (!name) {
526 DBG(" stdout package has no name !\n"); 527 DBG(" stdout package has no name !\n");
527 goto not_found; 528 goto not_found;
528 } 529 }
529 spd = (u32 *)get_property(prom_stdout, "current-speed", NULL); 530 spd = get_property(prom_stdout, "current-speed", NULL);
530 if (spd) 531 if (spd)
531 speed = *spd; 532 speed = *spd;
532 533
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 2d94b372d49b..3ce3a2d56fa8 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -309,12 +309,11 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
309 int partition_potential_processors; 309 int partition_potential_processors;
310 int partition_active_processors; 310 int partition_active_processors;
311 struct device_node *rtas_node; 311 struct device_node *rtas_node;
312 int *lrdrp = NULL; 312 const int *lrdrp = NULL;
313 313
314 rtas_node = find_path_device("/rtas"); 314 rtas_node = find_path_device("/rtas");
315 if (rtas_node) 315 if (rtas_node)
316 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", 316 lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL);
317 NULL);
318 317
319 if (lrdrp == NULL) { 318 if (lrdrp == NULL) {
320 partition_potential_processors = vdso_data->processorCount; 319 partition_potential_processors = vdso_data->processorCount;
@@ -519,7 +518,8 @@ static int lparcfg_data(struct seq_file *m, void *v)
519 const char *model = ""; 518 const char *model = "";
520 const char *system_id = ""; 519 const char *system_id = "";
521 const char *tmp; 520 const char *tmp;
522 unsigned int *lp_index_ptr, lp_index = 0; 521 const unsigned int *lp_index_ptr;
522 unsigned int lp_index = 0;
523 523
524 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); 524 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
525 525
@@ -539,8 +539,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
539 if (firmware_has_feature(FW_FEATURE_ISERIES)) 539 if (firmware_has_feature(FW_FEATURE_ISERIES))
540 system_id += 4; 540 system_id += 4;
541 } 541 }
542 lp_index_ptr = (unsigned int *) 542 lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL);
543 get_property(rootdn, "ibm,partition-no", NULL);
544 if (lp_index_ptr) 543 if (lp_index_ptr)
545 lp_index = *lp_index_ptr; 544 lp_index = *lp_index_ptr;
546 } 545 }
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index b438d45a068c..4efdaa9d3f43 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -33,8 +33,8 @@ int default_machine_kexec_prepare(struct kimage *image)
33 unsigned long begin, end; /* limits of segment */ 33 unsigned long begin, end; /* limits of segment */
34 unsigned long low, high; /* limits of blocked memory range */ 34 unsigned long low, high; /* limits of blocked memory range */
35 struct device_node *node; 35 struct device_node *node;
36 unsigned long *basep; 36 const unsigned long *basep;
37 unsigned int *sizep; 37 const unsigned int *sizep;
38 38
39 if (!ppc_md.hpte_clear_all) 39 if (!ppc_md.hpte_clear_all)
40 return -ENOENT; 40 return -ENOENT;
@@ -74,10 +74,8 @@ int default_machine_kexec_prepare(struct kimage *image)
74 /* We also should not overwrite the tce tables */ 74 /* We also should not overwrite the tce tables */
75 for (node = of_find_node_by_type(NULL, "pci"); node != NULL; 75 for (node = of_find_node_by_type(NULL, "pci"); node != NULL;
76 node = of_find_node_by_type(node, "pci")) { 76 node = of_find_node_by_type(node, "pci")) {
77 basep = (unsigned long *)get_property(node, "linux,tce-base", 77 basep = get_property(node, "linux,tce-base", NULL);
78 NULL); 78 sizep = get_property(node, "linux,tce-size", NULL);
79 sizep = (unsigned int *)get_property(node, "linux,tce-size",
80 NULL);
81 if (basep == NULL || sizep == NULL) 79 if (basep == NULL || sizep == NULL)
82 continue; 80 continue;
83 81
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 898dae8ab6d9..3f6bd36e9e14 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -633,12 +633,12 @@ pcibios_alloc_controller(void)
633static void 633static void
634make_one_node_map(struct device_node* node, u8 pci_bus) 634make_one_node_map(struct device_node* node, u8 pci_bus)
635{ 635{
636 int *bus_range; 636 const int *bus_range;
637 int len; 637 int len;
638 638
639 if (pci_bus >= pci_bus_count) 639 if (pci_bus >= pci_bus_count)
640 return; 640 return;
641 bus_range = (int *) get_property(node, "bus-range", &len); 641 bus_range = get_property(node, "bus-range", &len);
642 if (bus_range == NULL || len < 2 * sizeof(int)) { 642 if (bus_range == NULL || len < 2 * sizeof(int)) {
643 printk(KERN_WARNING "Can't get bus-range for %s, " 643 printk(KERN_WARNING "Can't get bus-range for %s, "
644 "assuming it starts at 0\n", node->full_name); 644 "assuming it starts at 0\n", node->full_name);
@@ -648,13 +648,13 @@ make_one_node_map(struct device_node* node, u8 pci_bus)
648 648
649 for (node=node->child; node != 0;node = node->sibling) { 649 for (node=node->child; node != 0;node = node->sibling) {
650 struct pci_dev* dev; 650 struct pci_dev* dev;
651 unsigned int *class_code, *reg; 651 const unsigned int *class_code, *reg;
652 652
653 class_code = (unsigned int *) get_property(node, "class-code", NULL); 653 class_code = get_property(node, "class-code", NULL);
654 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 654 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
655 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 655 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
656 continue; 656 continue;
657 reg = (unsigned int *)get_property(node, "reg", NULL); 657 reg = get_property(node, "reg", NULL);
658 if (!reg) 658 if (!reg)
659 continue; 659 continue;
660 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); 660 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff));
@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void)
669{ 669{
670 int i; 670 int i;
671 struct pci_controller* hose; 671 struct pci_controller* hose;
672 u8* of_prop_map; 672 struct property *map_prop;
673 673
674 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); 674 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
675 if (!pci_to_OF_bus_map) { 675 if (!pci_to_OF_bus_map) {
@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void)
691 continue; 691 continue;
692 make_one_node_map(node, hose->first_busno); 692 make_one_node_map(node, hose->first_busno);
693 } 693 }
694 of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); 694 map_prop = of_find_property(find_path_device("/"),
695 if (of_prop_map) 695 "pci-OF-bus-map", NULL);
696 memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); 696 if (map_prop) {
697 BUG_ON(pci_bus_count > map_prop->length);
698 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
699 }
697#ifdef DEBUG 700#ifdef DEBUG
698 printk("PCI->OF bus map:\n"); 701 printk("PCI->OF bus map:\n");
699 for (i=0; i<pci_bus_count; i++) { 702 for (i=0; i<pci_bus_count; i++) {
@@ -712,7 +715,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
712 struct device_node* sub_node; 715 struct device_node* sub_node;
713 716
714 for (; node != 0;node = node->sibling) { 717 for (; node != 0;node = node->sibling) {
715 unsigned int *class_code; 718 const unsigned int *class_code;
716 719
717 if (filter(node, data)) 720 if (filter(node, data))
718 return node; 721 return node;
@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
722 * a fake root for all functions of a multi-function device, 725 * a fake root for all functions of a multi-function device,
723 * we go down them as well. 726 * we go down them as well.
724 */ 727 */
725 class_code = (unsigned int *) get_property(node, "class-code", NULL); 728 class_code = get_property(node, "class-code", NULL);
726 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 729 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
727 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && 730 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
728 strcmp(node->name, "multifunc-device")) 731 strcmp(node->name, "multifunc-device"))
@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void*
737static int 740static int
738scan_OF_pci_childs_iterator(struct device_node* node, void* data) 741scan_OF_pci_childs_iterator(struct device_node* node, void* data)
739{ 742{
740 unsigned int *reg; 743 const unsigned int *reg;
741 u8* fdata = (u8*)data; 744 u8* fdata = (u8*)data;
742 745
743 reg = (unsigned int *) get_property(node, "reg", NULL); 746 reg = get_property(node, "reg", NULL);
744 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] 747 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
745 && ((reg[0] >> 16) & 0xff) == fdata[0]) 748 && ((reg[0] >> 16) & 0xff) == fdata[0])
746 return 1; 749 return 1;
@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data)
841int 844int
842pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) 845pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
843{ 846{
844 unsigned int *reg; 847 const unsigned int *reg;
845 struct pci_controller* hose; 848 struct pci_controller* hose;
846 struct pci_dev* dev = NULL; 849 struct pci_dev* dev = NULL;
847 850
@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
854 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, 857 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
855 find_OF_pci_device_filter, (void *)node)) 858 find_OF_pci_device_filter, (void *)node))
856 return -ENODEV; 859 return -ENODEV;
857 reg = (unsigned int *) get_property(node, "reg", NULL); 860 reg = get_property(node, "reg", NULL);
858 if (!reg) 861 if (!reg)
859 return -ENODEV; 862 return -ENODEV;
860 *bus = (reg[0] >> 16) & 0xff; 863 *bus = (reg[0] >> 16) & 0xff;
@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
885 struct device_node *dev, int primary) 888 struct device_node *dev, int primary)
886{ 889{
887 static unsigned int static_lc_ranges[256] __initdata; 890 static unsigned int static_lc_ranges[256] __initdata;
888 unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; 891 const unsigned int *dt_ranges;
889 unsigned int size; 892 unsigned int *lc_ranges, *ranges, *prev, size;
890 int rlen = 0, orig_rlen; 893 int rlen = 0, orig_rlen;
891 int memno = 0; 894 int memno = 0;
892 struct resource *res; 895 struct resource *res;
@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
897 * that can have more than 3 ranges, fortunately using contiguous 900 * that can have more than 3 ranges, fortunately using contiguous
898 * addresses -- BenH 901 * addresses -- BenH
899 */ 902 */
900 dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); 903 dt_ranges = get_property(dev, "ranges", &rlen);
901 if (!dt_ranges) 904 if (!dt_ranges)
902 return; 905 return;
903 /* Sanity check, though hopefully that never happens */ 906 /* Sanity check, though hopefully that never happens */
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 1d85fcba51e4..e795a7e2a38e 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -246,10 +246,10 @@ static void __init pcibios_claim_of_setup(void)
246#ifdef CONFIG_PPC_MULTIPLATFORM 246#ifdef CONFIG_PPC_MULTIPLATFORM
247static u32 get_int_prop(struct device_node *np, const char *name, u32 def) 247static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
248{ 248{
249 u32 *prop; 249 const u32 *prop;
250 int len; 250 int len;
251 251
252 prop = (u32 *) get_property(np, name, &len); 252 prop = get_property(np, name, &len);
253 if (prop && len >= 4) 253 if (prop && len >= 4)
254 return *prop; 254 return *prop;
255 return def; 255 return def;
@@ -278,10 +278,11 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
278 u64 base, size; 278 u64 base, size;
279 unsigned int flags; 279 unsigned int flags;
280 struct resource *res; 280 struct resource *res;
281 u32 *addrs, i; 281 const u32 *addrs;
282 u32 i;
282 int proplen; 283 int proplen;
283 284
284 addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); 285 addrs = get_property(node, "assigned-addresses", &proplen);
285 if (!addrs) 286 if (!addrs)
286 return; 287 return;
287 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); 288 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
@@ -381,7 +382,7 @@ void __devinit of_scan_bus(struct device_node *node,
381 struct pci_bus *bus) 382 struct pci_bus *bus)
382{ 383{
383 struct device_node *child = NULL; 384 struct device_node *child = NULL;
384 u32 *reg; 385 const u32 *reg;
385 int reglen, devfn; 386 int reglen, devfn;
386 struct pci_dev *dev; 387 struct pci_dev *dev;
387 388
@@ -389,7 +390,7 @@ void __devinit of_scan_bus(struct device_node *node,
389 390
390 while ((child = of_get_next_child(node, child)) != NULL) { 391 while ((child = of_get_next_child(node, child)) != NULL) {
391 DBG(" * %s\n", child->full_name); 392 DBG(" * %s\n", child->full_name);
392 reg = (u32 *) get_property(child, "reg", &reglen); 393 reg = get_property(child, "reg", &reglen);
393 if (reg == NULL || reglen < 20) 394 if (reg == NULL || reglen < 20)
394 continue; 395 continue;
395 devfn = (reg[0] >> 8) & 0xff; 396 devfn = (reg[0] >> 8) & 0xff;
@@ -413,7 +414,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
413 struct pci_dev *dev) 414 struct pci_dev *dev)
414{ 415{
415 struct pci_bus *bus; 416 struct pci_bus *bus;
416 u32 *busrange, *ranges; 417 const u32 *busrange, *ranges;
417 int len, i, mode; 418 int len, i, mode;
418 struct resource *res; 419 struct resource *res;
419 unsigned int flags; 420 unsigned int flags;
@@ -422,13 +423,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
422 DBG("of_scan_pci_bridge(%s)\n", node->full_name); 423 DBG("of_scan_pci_bridge(%s)\n", node->full_name);
423 424
424 /* parse bus-range property */ 425 /* parse bus-range property */
425 busrange = (u32 *) get_property(node, "bus-range", &len); 426 busrange = get_property(node, "bus-range", &len);
426 if (busrange == NULL || len != 8) { 427 if (busrange == NULL || len != 8) {
427 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", 428 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n",
428 node->full_name); 429 node->full_name);
429 return; 430 return;
430 } 431 }
431 ranges = (u32 *) get_property(node, "ranges", &len); 432 ranges = get_property(node, "ranges", &len);
432 if (ranges == NULL) { 433 if (ranges == NULL) {
433 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", 434 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
434 node->full_name); 435 node->full_name);
@@ -892,13 +893,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
892 unsigned int size; 893 unsigned int size;
893 }; 894 };
894 895
895 struct isa_range *range; 896 const struct isa_range *range;
896 unsigned long pci_addr; 897 unsigned long pci_addr;
897 unsigned int isa_addr; 898 unsigned int isa_addr;
898 unsigned int size; 899 unsigned int size;
899 int rlen = 0; 900 int rlen = 0;
900 901
901 range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); 902 range = get_property(isa_node, "ranges", &rlen);
902 if (range == NULL || (rlen < sizeof(struct isa_range))) { 903 if (range == NULL || (rlen < sizeof(struct isa_range))) {
903 printk(KERN_ERR "no ISA ranges or unexpected isa range size," 904 printk(KERN_ERR "no ISA ranges or unexpected isa range size,"
904 "mapping 64k\n"); 905 "mapping 64k\n");
@@ -939,7 +940,8 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
939void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, 940void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
940 struct device_node *dev, int prim) 941 struct device_node *dev, int prim)
941{ 942{
942 unsigned int *ranges, pci_space; 943 const unsigned int *ranges;
944 unsigned int pci_space;
943 unsigned long size; 945 unsigned long size;
944 int rlen = 0; 946 int rlen = 0;
945 int memno = 0; 947 int memno = 0;
@@ -957,7 +959,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
957 * (size depending on dev->n_addr_cells) 959 * (size depending on dev->n_addr_cells)
958 * cells 4+5 or 5+6: the size of the range 960 * cells 4+5 or 5+6: the size of the range
959 */ 961 */
960 ranges = (unsigned int *) get_property(dev, "ranges", &rlen); 962 ranges = get_property(dev, "ranges", &rlen);
961 if (ranges == NULL) 963 if (ranges == NULL)
962 return; 964 return;
963 hose->io_base_phys = 0; 965 hose->io_base_phys = 0;
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 1c18953514c3..68df018dae0e 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -40,8 +40,8 @@
40static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) 40static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
41{ 41{
42 struct pci_controller *phb = data; 42 struct pci_controller *phb = data;
43 int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); 43 const int *type = get_property(dn, "ibm,pci-config-space-type", NULL);
44 u32 *regs; 44 const u32 *regs;
45 struct pci_dn *pdn; 45 struct pci_dn *pdn;
46 46
47 if (mem_init_done) 47 if (mem_init_done)
@@ -54,14 +54,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
54 dn->data = pdn; 54 dn->data = pdn;
55 pdn->node = dn; 55 pdn->node = dn;
56 pdn->phb = phb; 56 pdn->phb = phb;
57 regs = (u32 *)get_property(dn, "reg", NULL); 57 regs = get_property(dn, "reg", NULL);
58 if (regs) { 58 if (regs) {
59 /* First register entry is addr (00BBSS00) */ 59 /* First register entry is addr (00BBSS00) */
60 pdn->busno = (regs[0] >> 16) & 0xff; 60 pdn->busno = (regs[0] >> 16) & 0xff;
61 pdn->devfn = (regs[0] >> 8) & 0xff; 61 pdn->devfn = (regs[0] >> 8) & 0xff;
62 } 62 }
63 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 63 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
64 u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL); 64 const u32 *busp = get_property(dn, "linux,subbus", NULL);
65 if (busp) 65 if (busp)
66 pdn->bussubno = *busp; 66 pdn->bussubno = *busp;
67 } 67 }
@@ -96,10 +96,11 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
96 96
97 /* We started with a phb, iterate all childs */ 97 /* We started with a phb, iterate all childs */
98 for (dn = start->child; dn; dn = nextdn) { 98 for (dn = start->child; dn; dn = nextdn) {
99 u32 *classp, class; 99 const u32 *classp;
100 u32 class;
100 101
101 nextdn = NULL; 102 nextdn = NULL;
102 classp = (u32 *)get_property(dn, "class-code", NULL); 103 classp = get_property(dn, "class-code", NULL);
103 class = classp ? *classp : 0; 104 class = classp ? *classp : 0;
104 105
105 if (pre && ((ret = pre(dn, data)) != NULL)) 106 if (pre && ((ret = pre(dn, data)) != NULL))
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index a1787ffb6319..2a3d84a39cb5 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -942,11 +942,11 @@ void __init early_init_devtree(void *params)
942int 942int
943prom_n_addr_cells(struct device_node* np) 943prom_n_addr_cells(struct device_node* np)
944{ 944{
945 int* ip; 945 const int *ip;
946 do { 946 do {
947 if (np->parent) 947 if (np->parent)
948 np = np->parent; 948 np = np->parent;
949 ip = (int *) get_property(np, "#address-cells", NULL); 949 ip = get_property(np, "#address-cells", NULL);
950 if (ip != NULL) 950 if (ip != NULL)
951 return *ip; 951 return *ip;
952 } while (np->parent); 952 } while (np->parent);
@@ -958,11 +958,11 @@ EXPORT_SYMBOL(prom_n_addr_cells);
958int 958int
959prom_n_size_cells(struct device_node* np) 959prom_n_size_cells(struct device_node* np)
960{ 960{
961 int* ip; 961 const int* ip;
962 do { 962 do {
963 if (np->parent) 963 if (np->parent)
964 np = np->parent; 964 np = np->parent;
965 ip = (int *) get_property(np, "#size-cells", NULL); 965 ip = get_property(np, "#size-cells", NULL);
966 if (ip != NULL) 966 if (ip != NULL)
967 return *ip; 967 return *ip;
968 } while (np->parent); 968 } while (np->parent);
@@ -1034,7 +1034,7 @@ int device_is_compatible(struct device_node *device, const char *compat)
1034 const char* cp; 1034 const char* cp;
1035 int cplen, l; 1035 int cplen, l;
1036 1036
1037 cp = (char *) get_property(device, "compatible", &cplen); 1037 cp = get_property(device, "compatible", &cplen);
1038 if (cp == NULL) 1038 if (cp == NULL)
1039 return 0; 1039 return 0;
1040 while (cplen > 0) { 1040 while (cplen > 0) {
@@ -1449,7 +1449,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1449{ 1449{
1450 struct device_node *parent = of_get_parent(node); 1450 struct device_node *parent = of_get_parent(node);
1451 int err = 0; 1451 int err = 0;
1452 phandle *ibm_phandle; 1452 const phandle *ibm_phandle;
1453 1453
1454 node->name = get_property(node, "name", NULL); 1454 node->name = get_property(node, "name", NULL);
1455 node->type = get_property(node, "device_type", NULL); 1455 node->type = get_property(node, "device_type", NULL);
@@ -1466,8 +1466,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1466 return -ENODEV; 1466 return -ENODEV;
1467 1467
1468 /* fix up new node's linux_phandle field */ 1468 /* fix up new node's linux_phandle field */
1469 if ((ibm_phandle = (unsigned int *)get_property(node, 1469 if ((ibm_phandle = get_property(node, "ibm,phandle", NULL)))
1470 "ibm,phandle", NULL)))
1471 node->linux_phandle = *ibm_phandle; 1470 node->linux_phandle = *ibm_phandle;
1472 1471
1473out: 1472out:
@@ -1658,16 +1657,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
1658 hardid = get_hard_smp_processor_id(cpu); 1657 hardid = get_hard_smp_processor_id(cpu);
1659 1658
1660 for_each_node_by_type(np, "cpu") { 1659 for_each_node_by_type(np, "cpu") {
1661 u32 *intserv; 1660 const u32 *intserv;
1662 unsigned int plen, t; 1661 unsigned int plen, t;
1663 1662
1664 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist 1663 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
1665 * fallback to "reg" property and assume no threads 1664 * fallback to "reg" property and assume no threads
1666 */ 1665 */
1667 intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", 1666 intserv = get_property(np, "ibm,ppc-interrupt-server#s",
1668 &plen); 1667 &plen);
1669 if (intserv == NULL) { 1668 if (intserv == NULL) {
1670 u32 *reg = (u32 *)get_property(np, "reg", NULL); 1669 const u32 *reg = get_property(np, "reg", NULL);
1671 if (reg == NULL) 1670 if (reg == NULL)
1672 continue; 1671 continue;
1673 if (*reg == hardid) { 1672 if (*reg == hardid) {
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index e9960170667b..cdcd5d665468 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -270,7 +270,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
270 struct of_bus *pbus, u32 *addr, 270 struct of_bus *pbus, u32 *addr,
271 int na, int ns, int pna) 271 int na, int ns, int pna)
272{ 272{
273 u32 *ranges; 273 const u32 *ranges;
274 unsigned int rlen; 274 unsigned int rlen;
275 int rone; 275 int rone;
276 u64 offset = OF_BAD_ADDR; 276 u64 offset = OF_BAD_ADDR;
@@ -287,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
287 * to translate addresses that aren't supposed to be translated in 287 * to translate addresses that aren't supposed to be translated in
288 * the first place. --BenH. 288 * the first place. --BenH.
289 */ 289 */
290 ranges = (u32 *)get_property(parent, "ranges", &rlen); 290 ranges = get_property(parent, "ranges", &rlen);
291 if (ranges == NULL || rlen == 0) { 291 if (ranges == NULL || rlen == 0) {
292 offset = of_read_number(addr, na); 292 offset = of_read_number(addr, na);
293 memset(addr, 0, pna * 4); 293 memset(addr, 0, pna * 4);
@@ -330,7 +330,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
330 * that can be mapped to a cpu physical address). This is not really specified 330 * that can be mapped to a cpu physical address). This is not really specified
331 * that way, but this is traditionally the way IBM at least do things 331 * that way, but this is traditionally the way IBM at least do things
332 */ 332 */
333u64 of_translate_address(struct device_node *dev, u32 *in_addr) 333u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
334{ 334{
335 struct device_node *parent = NULL; 335 struct device_node *parent = NULL;
336 struct of_bus *bus, *pbus; 336 struct of_bus *bus, *pbus;
@@ -407,10 +407,10 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr)
407} 407}
408EXPORT_SYMBOL(of_translate_address); 408EXPORT_SYMBOL(of_translate_address);
409 409
410u32 *of_get_address(struct device_node *dev, int index, u64 *size, 410const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
411 unsigned int *flags) 411 unsigned int *flags)
412{ 412{
413 u32 *prop; 413 const u32 *prop;
414 unsigned int psize; 414 unsigned int psize;
415 struct device_node *parent; 415 struct device_node *parent;
416 struct of_bus *bus; 416 struct of_bus *bus;
@@ -427,7 +427,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size,
427 return NULL; 427 return NULL;
428 428
429 /* Get "reg" or "assigned-addresses" property */ 429 /* Get "reg" or "assigned-addresses" property */
430 prop = (u32 *)get_property(dev, bus->addresses, &psize); 430 prop = get_property(dev, bus->addresses, &psize);
431 if (prop == NULL) 431 if (prop == NULL)
432 return NULL; 432 return NULL;
433 psize /= 4; 433 psize /= 4;
@@ -445,10 +445,10 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size,
445} 445}
446EXPORT_SYMBOL(of_get_address); 446EXPORT_SYMBOL(of_get_address);
447 447
448u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, 448const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
449 unsigned int *flags) 449 unsigned int *flags)
450{ 450{
451 u32 *prop; 451 const u32 *prop;
452 unsigned int psize; 452 unsigned int psize;
453 struct device_node *parent; 453 struct device_node *parent;
454 struct of_bus *bus; 454 struct of_bus *bus;
@@ -469,7 +469,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
469 return NULL; 469 return NULL;
470 470
471 /* Get "reg" or "assigned-addresses" property */ 471 /* Get "reg" or "assigned-addresses" property */
472 prop = (u32 *)get_property(dev, bus->addresses, &psize); 472 prop = get_property(dev, bus->addresses, &psize);
473 if (prop == NULL) 473 if (prop == NULL)
474 return NULL; 474 return NULL;
475 psize /= 4; 475 psize /= 4;
@@ -487,7 +487,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
487} 487}
488EXPORT_SYMBOL(of_get_pci_address); 488EXPORT_SYMBOL(of_get_pci_address);
489 489
490static int __of_address_to_resource(struct device_node *dev, u32 *addrp, 490static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
491 u64 size, unsigned int flags, 491 u64 size, unsigned int flags,
492 struct resource *r) 492 struct resource *r)
493{ 493{
@@ -518,7 +518,7 @@ static int __of_address_to_resource(struct device_node *dev, u32 *addrp,
518int of_address_to_resource(struct device_node *dev, int index, 518int of_address_to_resource(struct device_node *dev, int index,
519 struct resource *r) 519 struct resource *r)
520{ 520{
521 u32 *addrp; 521 const u32 *addrp;
522 u64 size; 522 u64 size;
523 unsigned int flags; 523 unsigned int flags;
524 524
@@ -532,7 +532,7 @@ EXPORT_SYMBOL_GPL(of_address_to_resource);
532int of_pci_address_to_resource(struct device_node *dev, int bar, 532int of_pci_address_to_resource(struct device_node *dev, int bar,
533 struct resource *r) 533 struct resource *r)
534{ 534{
535 u32 *addrp; 535 const u32 *addrp;
536 u64 size; 536 u64 size;
537 unsigned int flags; 537 unsigned int flags;
538 538
@@ -543,13 +543,14 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
543} 543}
544EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 544EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
545 545
546void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, 546void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
547 unsigned long *busno, unsigned long *phys, unsigned long *size) 547 unsigned long *busno, unsigned long *phys, unsigned long *size)
548{ 548{
549 u32 *dma_window, cells; 549 const u32 *dma_window;
550 unsigned char *prop; 550 u32 cells;
551 const unsigned char *prop;
551 552
552 dma_window = (u32 *)dma_window_prop; 553 dma_window = dma_window_prop;
553 554
554 /* busno is always one cell */ 555 /* busno is always one cell */
555 *busno = *(dma_window++); 556 *busno = *(dma_window++);
@@ -578,13 +579,13 @@ static struct device_node *of_irq_dflt_pic;
578static struct device_node *of_irq_find_parent(struct device_node *child) 579static struct device_node *of_irq_find_parent(struct device_node *child)
579{ 580{
580 struct device_node *p; 581 struct device_node *p;
581 phandle *parp; 582 const phandle *parp;
582 583
583 if (!of_node_get(child)) 584 if (!of_node_get(child))
584 return NULL; 585 return NULL;
585 586
586 do { 587 do {
587 parp = (phandle *)get_property(child, "interrupt-parent", NULL); 588 parp = get_property(child, "interrupt-parent", NULL);
588 if (parp == NULL) 589 if (parp == NULL)
589 p = of_get_parent(child); 590 p = of_get_parent(child);
590 else { 591 else {
@@ -646,11 +647,11 @@ void of_irq_map_init(unsigned int flags)
646 647
647} 648}
648 649
649int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr, 650int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
650 struct of_irq *out_irq) 651 const u32 *addr, struct of_irq *out_irq)
651{ 652{
652 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 653 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
653 u32 *tmp, *imap, *imask; 654 const u32 *tmp, *imap, *imask;
654 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; 655 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
655 int imaplen, match, i; 656 int imaplen, match, i;
656 657
@@ -661,7 +662,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
661 * is none, we are nice and just walk up the tree 662 * is none, we are nice and just walk up the tree
662 */ 663 */
663 do { 664 do {
664 tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL); 665 tmp = get_property(ipar, "#interrupt-cells", NULL);
665 if (tmp != NULL) { 666 if (tmp != NULL) {
666 intsize = *tmp; 667 intsize = *tmp;
667 break; 668 break;
@@ -682,7 +683,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
682 */ 683 */
683 old = of_node_get(ipar); 684 old = of_node_get(ipar);
684 do { 685 do {
685 tmp = (u32 *)get_property(old, "#address-cells", NULL); 686 tmp = get_property(old, "#address-cells", NULL);
686 tnode = of_get_parent(old); 687 tnode = of_get_parent(old);
687 of_node_put(old); 688 of_node_put(old);
688 old = tnode; 689 old = tnode;
@@ -709,7 +710,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
709 } 710 }
710 711
711 /* Now look for an interrupt-map */ 712 /* Now look for an interrupt-map */
712 imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen); 713 imap = get_property(ipar, "interrupt-map", &imaplen);
713 /* No interrupt map, check for an interrupt parent */ 714 /* No interrupt map, check for an interrupt parent */
714 if (imap == NULL) { 715 if (imap == NULL) {
715 DBG(" -> no map, getting parent\n"); 716 DBG(" -> no map, getting parent\n");
@@ -719,7 +720,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
719 imaplen /= sizeof(u32); 720 imaplen /= sizeof(u32);
720 721
721 /* Look for a mask */ 722 /* Look for a mask */
722 imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL); 723 imask = get_property(ipar, "interrupt-map-mask", NULL);
723 724
724 /* If we were passed no "reg" property and we attempt to parse 725 /* If we were passed no "reg" property and we attempt to parse
725 * an interrupt-map, then #address-cells must be 0. 726 * an interrupt-map, then #address-cells must be 0.
@@ -766,14 +767,14 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
766 /* Get #interrupt-cells and #address-cells of new 767 /* Get #interrupt-cells and #address-cells of new
767 * parent 768 * parent
768 */ 769 */
769 tmp = (u32 *)get_property(newpar, "#interrupt-cells", 770 tmp = get_property(newpar, "#interrupt-cells",
770 NULL); 771 NULL);
771 if (tmp == NULL) { 772 if (tmp == NULL) {
772 DBG(" -> parent lacks #interrupt-cells !\n"); 773 DBG(" -> parent lacks #interrupt-cells !\n");
773 goto fail; 774 goto fail;
774 } 775 }
775 newintsize = *tmp; 776 newintsize = *tmp;
776 tmp = (u32 *)get_property(newpar, "#address-cells", 777 tmp = get_property(newpar, "#address-cells",
777 NULL); 778 NULL);
778 newaddrsize = (tmp == NULL) ? 0 : *tmp; 779 newaddrsize = (tmp == NULL) ? 0 : *tmp;
779 780
@@ -819,14 +820,14 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw);
819static int of_irq_map_oldworld(struct device_node *device, int index, 820static int of_irq_map_oldworld(struct device_node *device, int index,
820 struct of_irq *out_irq) 821 struct of_irq *out_irq)
821{ 822{
822 u32 *ints; 823 const u32 *ints;
823 int intlen; 824 int intlen;
824 825
825 /* 826 /*
826 * Old machines just have a list of interrupt numbers 827 * Old machines just have a list of interrupt numbers
827 * and no interrupt-controller nodes. 828 * and no interrupt-controller nodes.
828 */ 829 */
829 ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen); 830 ints = get_property(device, "AAPL,interrupts", &intlen);
830 if (ints == NULL) 831 if (ints == NULL)
831 return -EINVAL; 832 return -EINVAL;
832 intlen /= sizeof(u32); 833 intlen /= sizeof(u32);
@@ -851,7 +852,8 @@ static int of_irq_map_oldworld(struct device_node *device, int index,
851int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) 852int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
852{ 853{
853 struct device_node *p; 854 struct device_node *p;
854 u32 *intspec, *tmp, intsize, intlen, *addr; 855 const u32 *intspec, *tmp, *addr;
856 u32 intsize, intlen;
855 int res; 857 int res;
856 858
857 DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); 859 DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index);
@@ -861,13 +863,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
861 return of_irq_map_oldworld(device, index, out_irq); 863 return of_irq_map_oldworld(device, index, out_irq);
862 864
863 /* Get the interrupts property */ 865 /* Get the interrupts property */
864 intspec = (u32 *)get_property(device, "interrupts", &intlen); 866 intspec = get_property(device, "interrupts", &intlen);
865 if (intspec == NULL) 867 if (intspec == NULL)
866 return -EINVAL; 868 return -EINVAL;
867 intlen /= sizeof(u32); 869 intlen /= sizeof(u32);
868 870
869 /* Get the reg property (if any) */ 871 /* Get the reg property (if any) */
870 addr = (u32 *)get_property(device, "reg", NULL); 872 addr = get_property(device, "reg", NULL);
871 873
872 /* Look for the interrupt parent. */ 874 /* Look for the interrupt parent. */
873 p = of_irq_find_parent(device); 875 p = of_irq_find_parent(device);
@@ -875,7 +877,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
875 return -EINVAL; 877 return -EINVAL;
876 878
877 /* Get size of interrupt specifier */ 879 /* Get size of interrupt specifier */
878 tmp = (u32 *)get_property(p, "#interrupt-cells", NULL); 880 tmp = get_property(p, "#interrupt-cells", NULL);
879 if (tmp == NULL) { 881 if (tmp == NULL) {
880 of_node_put(p); 882 of_node_put(p);
881 return -EINVAL; 883 return -EINVAL;
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 9c9ad1fa9cce..2fe82abf1c52 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -246,12 +246,12 @@ struct file_operations ppc_rtas_rmo_buf_ops = {
246 246
247static int ppc_rtas_find_all_sensors(void); 247static int ppc_rtas_find_all_sensors(void);
248static void ppc_rtas_process_sensor(struct seq_file *m, 248static void ppc_rtas_process_sensor(struct seq_file *m,
249 struct individual_sensor *s, int state, int error, char *loc); 249 struct individual_sensor *s, int state, int error, const char *loc);
250static char *ppc_rtas_process_error(int error); 250static char *ppc_rtas_process_error(int error);
251static void get_location_code(struct seq_file *m, 251static void get_location_code(struct seq_file *m,
252 struct individual_sensor *s, char *loc); 252 struct individual_sensor *s, const char *loc);
253static void check_location_string(struct seq_file *m, char *c); 253static void check_location_string(struct seq_file *m, const char *c);
254static void check_location(struct seq_file *m, char *c); 254static void check_location(struct seq_file *m, const char *c);
255 255
256static int __init proc_rtas_init(void) 256static int __init proc_rtas_init(void)
257{ 257{
@@ -446,11 +446,11 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v)
446 for (i=0; i<sensors.quant; i++) { 446 for (i=0; i<sensors.quant; i++) {
447 struct individual_sensor *p = &sensors.sensor[i]; 447 struct individual_sensor *p = &sensors.sensor[i];
448 char rstr[64]; 448 char rstr[64];
449 char *loc; 449 const char *loc;
450 int llen, offs; 450 int llen, offs;
451 451
452 sprintf (rstr, SENSOR_PREFIX"%04d", p->token); 452 sprintf (rstr, SENSOR_PREFIX"%04d", p->token);
453 loc = (char *) get_property(rtas_node, rstr, &llen); 453 loc = get_property(rtas_node, rstr, &llen);
454 454
455 /* A sensor may have multiple instances */ 455 /* A sensor may have multiple instances */
456 for (j = 0, offs = 0; j <= p->quant; j++) { 456 for (j = 0, offs = 0; j <= p->quant; j++) {
@@ -474,10 +474,10 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v)
474 474
475static int ppc_rtas_find_all_sensors(void) 475static int ppc_rtas_find_all_sensors(void)
476{ 476{
477 unsigned int *utmp; 477 const unsigned int *utmp;
478 int len, i; 478 int len, i;
479 479
480 utmp = (unsigned int *) get_property(rtas_node, "rtas-sensors", &len); 480 utmp = get_property(rtas_node, "rtas-sensors", &len);
481 if (utmp == NULL) { 481 if (utmp == NULL) {
482 printk (KERN_ERR "error: could not get rtas-sensors\n"); 482 printk (KERN_ERR "error: could not get rtas-sensors\n");
483 return 1; 483 return 1;
@@ -530,7 +530,7 @@ static char *ppc_rtas_process_error(int error)
530 */ 530 */
531 531
532static void ppc_rtas_process_sensor(struct seq_file *m, 532static void ppc_rtas_process_sensor(struct seq_file *m,
533 struct individual_sensor *s, int state, int error, char *loc) 533 struct individual_sensor *s, int state, int error, const char *loc)
534{ 534{
535 /* Defined return vales */ 535 /* Defined return vales */
536 const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", 536 const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t",
@@ -682,7 +682,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m,
682 682
683/* ****************************************************************** */ 683/* ****************************************************************** */
684 684
685static void check_location(struct seq_file *m, char *c) 685static void check_location(struct seq_file *m, const char *c)
686{ 686{
687 switch (c[0]) { 687 switch (c[0]) {
688 case LOC_PLANAR: 688 case LOC_PLANAR:
@@ -719,7 +719,7 @@ static void check_location(struct seq_file *m, char *c)
719 * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] 719 * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ]
720 * the '.' may be an abbrevation 720 * the '.' may be an abbrevation
721 */ 721 */
722static void check_location_string(struct seq_file *m, char *c) 722static void check_location_string(struct seq_file *m, const char *c)
723{ 723{
724 while (*c) { 724 while (*c) {
725 if (isalpha(*c) || *c == '.') 725 if (isalpha(*c) || *c == '.')
@@ -733,7 +733,8 @@ static void check_location_string(struct seq_file *m, char *c)
733 733
734/* ****************************************************************** */ 734/* ****************************************************************** */
735 735
736static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc) 736static void get_location_code(struct seq_file *m, struct individual_sensor *s,
737 const char *loc)
737{ 738{
738 if (!loc || !*loc) { 739 if (!loc || !*loc) {
739 seq_printf(m, "---");/* does not have a location */ 740 seq_printf(m, "---");/* does not have a location */
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 4a4cb5598402..10e10be324c9 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -177,10 +177,12 @@ void __init udbg_init_rtas_console(void)
177void rtas_progress(char *s, unsigned short hex) 177void rtas_progress(char *s, unsigned short hex)
178{ 178{
179 struct device_node *root; 179 struct device_node *root;
180 int width, *p; 180 int width;
181 const int *p;
181 char *os; 182 char *os;
182 static int display_character, set_indicator; 183 static int display_character, set_indicator;
183 static int display_width, display_lines, *row_width, form_feed; 184 static int display_width, display_lines, form_feed;
185 const static int *row_width;
184 static DEFINE_SPINLOCK(progress_lock); 186 static DEFINE_SPINLOCK(progress_lock);
185 static int current_line; 187 static int current_line;
186 static int pending_newline = 0; /* did last write end with unprinted newline? */ 188 static int pending_newline = 0; /* did last write end with unprinted newline? */
@@ -191,16 +193,16 @@ void rtas_progress(char *s, unsigned short hex)
191 if (display_width == 0) { 193 if (display_width == 0) {
192 display_width = 0x10; 194 display_width = 0x10;
193 if ((root = find_path_device("/rtas"))) { 195 if ((root = find_path_device("/rtas"))) {
194 if ((p = (unsigned int *)get_property(root, 196 if ((p = get_property(root,
195 "ibm,display-line-length", NULL))) 197 "ibm,display-line-length", NULL)))
196 display_width = *p; 198 display_width = *p;
197 if ((p = (unsigned int *)get_property(root, 199 if ((p = get_property(root,
198 "ibm,form-feed", NULL))) 200 "ibm,form-feed", NULL)))
199 form_feed = *p; 201 form_feed = *p;
200 if ((p = (unsigned int *)get_property(root, 202 if ((p = get_property(root,
201 "ibm,display-number-of-lines", NULL))) 203 "ibm,display-number-of-lines", NULL)))
202 display_lines = *p; 204 display_lines = *p;
203 row_width = (unsigned int *)get_property(root, 205 row_width = get_property(root,
204 "ibm,display-truncation-length", NULL); 206 "ibm,display-truncation-length", NULL);
205 } 207 }
206 display_character = rtas_token("display-character"); 208 display_character = rtas_token("display-character");
@@ -293,10 +295,10 @@ EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */
293 295
294int rtas_token(const char *service) 296int rtas_token(const char *service)
295{ 297{
296 int *tokp; 298 const int *tokp;
297 if (rtas.dev == NULL) 299 if (rtas.dev == NULL)
298 return RTAS_UNKNOWN_SERVICE; 300 return RTAS_UNKNOWN_SERVICE;
299 tokp = (int *) get_property(rtas.dev, service, NULL); 301 tokp = get_property(rtas.dev, service, NULL);
300 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; 302 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
301} 303}
302EXPORT_SYMBOL(rtas_token); 304EXPORT_SYMBOL(rtas_token);
@@ -824,15 +826,15 @@ void __init rtas_initialize(void)
824 */ 826 */
825 rtas.dev = of_find_node_by_name(NULL, "rtas"); 827 rtas.dev = of_find_node_by_name(NULL, "rtas");
826 if (rtas.dev) { 828 if (rtas.dev) {
827 u32 *basep, *entryp; 829 const u32 *basep, *entryp, *sizep;
828 u32 *sizep;
829 830
830 basep = (u32 *)get_property(rtas.dev, "linux,rtas-base", NULL); 831 basep = get_property(rtas.dev, "linux,rtas-base", NULL);
831 sizep = (u32 *)get_property(rtas.dev, "rtas-size", NULL); 832 sizep = get_property(rtas.dev, "rtas-size", NULL);
832 if (basep != NULL && sizep != NULL) { 833 if (basep != NULL && sizep != NULL) {
833 rtas.base = *basep; 834 rtas.base = *basep;
834 rtas.size = *sizep; 835 rtas.size = *sizep;
835 entryp = (u32 *)get_property(rtas.dev, "linux,rtas-entry", NULL); 836 entryp = get_property(rtas.dev,
837 "linux,rtas-entry", NULL);
836 if (entryp == NULL) /* Ugh */ 838 if (entryp == NULL) /* Ugh */
837 rtas.entry = rtas.base; 839 rtas.entry = rtas.base;
838 else 840 else
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index cda022657324..5a798ac6aecf 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -57,7 +57,7 @@ static inline int config_access_valid(struct pci_dn *dn, int where)
57 57
58static int of_device_available(struct device_node * dn) 58static int of_device_available(struct device_node * dn)
59{ 59{
60 char * status; 60 const char *status;
61 61
62 status = get_property(dn, "status", NULL); 62 status = get_property(dn, "status", NULL);
63 63
@@ -178,7 +178,7 @@ struct pci_ops rtas_pci_ops = {
178 178
179int is_python(struct device_node *dev) 179int is_python(struct device_node *dev)
180{ 180{
181 char *model = (char *)get_property(dev, "model", NULL); 181 const char *model = get_property(dev, "model", NULL);
182 182
183 if (model && strstr(model, "Python")) 183 if (model && strstr(model, "Python"))
184 return 1; 184 return 1;
@@ -234,7 +234,7 @@ void __init init_pci_config_tokens (void)
234unsigned long __devinit get_phb_buid (struct device_node *phb) 234unsigned long __devinit get_phb_buid (struct device_node *phb)
235{ 235{
236 int addr_cells; 236 int addr_cells;
237 unsigned int *buid_vals; 237 const unsigned int *buid_vals;
238 unsigned int len; 238 unsigned int len;
239 unsigned long buid; 239 unsigned long buid;
240 240
@@ -247,7 +247,7 @@ unsigned long __devinit get_phb_buid (struct device_node *phb)
247 if (phb->parent->parent) 247 if (phb->parent->parent)
248 return 0; 248 return 0;
249 249
250 buid_vals = (unsigned int *) get_property(phb, "reg", &len); 250 buid_vals = get_property(phb, "reg", &len);
251 if (buid_vals == NULL) 251 if (buid_vals == NULL)
252 return 0; 252 return 0;
253 253
@@ -264,10 +264,10 @@ unsigned long __devinit get_phb_buid (struct device_node *phb)
264static int phb_set_bus_ranges(struct device_node *dev, 264static int phb_set_bus_ranges(struct device_node *dev,
265 struct pci_controller *phb) 265 struct pci_controller *phb)
266{ 266{
267 int *bus_range; 267 const int *bus_range;
268 unsigned int len; 268 unsigned int len;
269 269
270 bus_range = (int *) get_property(dev, "bus-range", &len); 270 bus_range = get_property(dev, "bus-range", &len);
271 if (bus_range == NULL || len < 2 * sizeof(int)) { 271 if (bus_range == NULL || len < 2 * sizeof(int)) {
272 return 1; 272 return 1;
273 } 273 }
@@ -325,15 +325,15 @@ unsigned long __init find_and_init_phbs(void)
325 * in chosen. 325 * in chosen.
326 */ 326 */
327 if (of_chosen) { 327 if (of_chosen) {
328 int *prop; 328 const int *prop;
329 329
330 prop = (int *)get_property(of_chosen, "linux,pci-probe-only", 330 prop = get_property(of_chosen,
331 NULL); 331 "linux,pci-probe-only", NULL);
332 if (prop) 332 if (prop)
333 pci_probe_only = *prop; 333 pci_probe_only = *prop;
334 334
335 prop = (int *)get_property(of_chosen, 335 prop = get_property(of_chosen,
336 "linux,pci-assign-all-buses", NULL); 336 "linux,pci-assign-all-buses", NULL);
337 if (prop) 337 if (prop)
338 pci_assign_all_buses = *prop; 338 pci_assign_all_buses = *prop;
339 } 339 }
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index c6d7b98af7d5..aaf1727b3570 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -304,16 +304,15 @@ struct seq_operations cpuinfo_op = {
304void __init check_for_initrd(void) 304void __init check_for_initrd(void)
305{ 305{
306#ifdef CONFIG_BLK_DEV_INITRD 306#ifdef CONFIG_BLK_DEV_INITRD
307 unsigned long *prop; 307 const unsigned long *prop;
308 308
309 DBG(" -> check_for_initrd()\n"); 309 DBG(" -> check_for_initrd()\n");
310 310
311 if (of_chosen) { 311 if (of_chosen) {
312 prop = (unsigned long *)get_property(of_chosen, 312 prop = get_property(of_chosen, "linux,initrd-start", NULL);
313 "linux,initrd-start", NULL);
314 if (prop != NULL) { 313 if (prop != NULL) {
315 initrd_start = (unsigned long)__va(*prop); 314 initrd_start = (unsigned long)__va(*prop);
316 prop = (unsigned long *)get_property(of_chosen, 315 prop = get_property(of_chosen,
317 "linux,initrd-end", NULL); 316 "linux,initrd-end", NULL);
318 if (prop != NULL) { 317 if (prop != NULL) {
319 initrd_end = (unsigned long)__va(*prop); 318 initrd_end = (unsigned long)__va(*prop);
@@ -366,15 +365,14 @@ void __init smp_setup_cpu_maps(void)
366 int cpu = 0; 365 int cpu = 0;
367 366
368 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { 367 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
369 int *intserv; 368 const int *intserv;
370 int j, len = sizeof(u32), nthreads = 1; 369 int j, len = sizeof(u32), nthreads = 1;
371 370
372 intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s", 371 intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len);
373 &len);
374 if (intserv) 372 if (intserv)
375 nthreads = len / sizeof(int); 373 nthreads = len / sizeof(int);
376 else { 374 else {
377 intserv = (int *) get_property(dn, "reg", NULL); 375 intserv = get_property(dn, "reg", NULL);
378 if (!intserv) 376 if (!intserv)
379 intserv = &cpu; /* assume logical == phys */ 377 intserv = &cpu; /* assume logical == phys */
380 } 378 }
@@ -395,13 +393,12 @@ void __init smp_setup_cpu_maps(void)
395 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && 393 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
396 (dn = of_find_node_by_path("/rtas"))) { 394 (dn = of_find_node_by_path("/rtas"))) {
397 int num_addr_cell, num_size_cell, maxcpus; 395 int num_addr_cell, num_size_cell, maxcpus;
398 unsigned int *ireg; 396 const unsigned int *ireg;
399 397
400 num_addr_cell = prom_n_addr_cells(dn); 398 num_addr_cell = prom_n_addr_cells(dn);
401 num_size_cell = prom_n_size_cells(dn); 399 num_size_cell = prom_n_size_cells(dn);
402 400
403 ireg = (unsigned int *) 401 ireg = get_property(dn, "ibm,lrdr-capacity", NULL);
404 get_property(dn, "ibm,lrdr-capacity", NULL);
405 402
406 if (!ireg) 403 if (!ireg)
407 goto out; 404 goto out;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index e2447aef3a8f..77efe19ccd2c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -106,7 +106,7 @@ static int smt_enabled_cmdline;
106static void check_smt_enabled(void) 106static void check_smt_enabled(void)
107{ 107{
108 struct device_node *dn; 108 struct device_node *dn;
109 char *smt_option; 109 const char *smt_option;
110 110
111 /* Allow the command line to overrule the OF option */ 111 /* Allow the command line to overrule the OF option */
112 if (smt_enabled_cmdline) 112 if (smt_enabled_cmdline)
@@ -115,7 +115,7 @@ static void check_smt_enabled(void)
115 dn = of_find_node_by_path("/options"); 115 dn = of_find_node_by_path("/options");
116 116
117 if (dn) { 117 if (dn) {
118 smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); 118 smt_option = get_property(dn, "ibm,smt-enabled", NULL);
119 119
120 if (smt_option) { 120 if (smt_option) {
121 if (!strcmp(smt_option, "on")) 121 if (!strcmp(smt_option, "on"))
@@ -292,7 +292,7 @@ static void __init initialize_cache_info(void)
292 */ 292 */
293 293
294 if ( num_cpus == 1 ) { 294 if ( num_cpus == 1 ) {
295 u32 *sizep, *lsizep; 295 const u32 *sizep, *lsizep;
296 u32 size, lsize; 296 u32 size, lsize;
297 const char *dc, *ic; 297 const char *dc, *ic;
298 298
@@ -307,10 +307,10 @@ static void __init initialize_cache_info(void)
307 307
308 size = 0; 308 size = 0;
309 lsize = cur_cpu_spec->dcache_bsize; 309 lsize = cur_cpu_spec->dcache_bsize;
310 sizep = (u32 *)get_property(np, "d-cache-size", NULL); 310 sizep = get_property(np, "d-cache-size", NULL);
311 if (sizep != NULL) 311 if (sizep != NULL)
312 size = *sizep; 312 size = *sizep;
313 lsizep = (u32 *) get_property(np, dc, NULL); 313 lsizep = get_property(np, dc, NULL);
314 if (lsizep != NULL) 314 if (lsizep != NULL)
315 lsize = *lsizep; 315 lsize = *lsizep;
316 if (sizep == 0 || lsizep == 0) 316 if (sizep == 0 || lsizep == 0)
@@ -324,10 +324,10 @@ static void __init initialize_cache_info(void)
324 324
325 size = 0; 325 size = 0;
326 lsize = cur_cpu_spec->icache_bsize; 326 lsize = cur_cpu_spec->icache_bsize;
327 sizep = (u32 *)get_property(np, "i-cache-size", NULL); 327 sizep = get_property(np, "i-cache-size", NULL);
328 if (sizep != NULL) 328 if (sizep != NULL)
329 size = *sizep; 329 size = *sizep;
330 lsizep = (u32 *)get_property(np, ic, NULL); 330 lsizep = get_property(np, ic, NULL);
331 if (lsizep != NULL) 331 if (lsizep != NULL)
332 lsize = *lsizep; 332 lsize = *lsizep;
333 if (sizep == 0 || lsizep == 0) 333 if (sizep == 0 || lsizep == 0)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 010435095550..1d724aef438a 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -60,7 +60,7 @@ static int smt_snooze_cmdline;
60static int __init smt_setup(void) 60static int __init smt_setup(void)
61{ 61{
62 struct device_node *options; 62 struct device_node *options;
63 unsigned int *val; 63 const unsigned int *val;
64 unsigned int cpu; 64 unsigned int cpu;
65 65
66 if (!cpu_has_feature(CPU_FTR_SMT)) 66 if (!cpu_has_feature(CPU_FTR_SMT))
@@ -70,8 +70,7 @@ static int __init smt_setup(void)
70 if (!options) 70 if (!options)
71 return -ENODEV; 71 return -ENODEV;
72 72
73 val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay", 73 val = get_property(options, "ibm,smt-snooze-delay", NULL);
74 NULL);
75 if (!smt_snooze_cmdline && val) { 74 if (!smt_snooze_cmdline && val) {
76 for_each_possible_cpu(cpu) 75 for_each_possible_cpu(cpu)
77 per_cpu(smt_snooze_delay, cpu) = *val; 76 per_cpu(smt_snooze_delay, cpu) = *val;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 774c0a3c5019..8d4ccf061a4d 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -859,14 +859,14 @@ EXPORT_SYMBOL(do_settimeofday);
859static int __init get_freq(char *name, int cells, unsigned long *val) 859static int __init get_freq(char *name, int cells, unsigned long *val)
860{ 860{
861 struct device_node *cpu; 861 struct device_node *cpu;
862 unsigned int *fp; 862 const unsigned int *fp;
863 int found = 0; 863 int found = 0;
864 864
865 /* The cpu node should have timebase and clock frequency properties */ 865 /* The cpu node should have timebase and clock frequency properties */
866 cpu = of_find_node_by_type(NULL, "cpu"); 866 cpu = of_find_node_by_type(NULL, "cpu");
867 867
868 if (cpu) { 868 if (cpu) {
869 fp = (unsigned int *)get_property(cpu, name, NULL); 869 fp = get_property(cpu, name, NULL);
870 if (fp) { 870 if (fp) {
871 found = 1; 871 found = 1;
872 *val = 0; 872 *val = 0;
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index fad8580f9081..cb87e71eec66 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -77,7 +77,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
77 } else 77 } else
78#endif 78#endif
79 { 79 {
80 unsigned char *dma_window; 80 const unsigned char *dma_window;
81 struct iommu_table *tbl; 81 struct iommu_table *tbl;
82 unsigned long offset, size; 82 unsigned long offset, size;
83 83
@@ -217,7 +217,7 @@ static void __devinit vio_dev_release(struct device *dev)
217struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) 217struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
218{ 218{
219 struct vio_dev *viodev; 219 struct vio_dev *viodev;
220 unsigned int *unit_address; 220 const unsigned int *unit_address;
221 221
222 /* we need the 'device_type' property, in order to match with drivers */ 222 /* we need the 'device_type' property, in order to match with drivers */
223 if (of_node->type == NULL) { 223 if (of_node->type == NULL) {
@@ -227,7 +227,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
227 return NULL; 227 return NULL;
228 } 228 }
229 229
230 unit_address = (unsigned int *)get_property(of_node, "reg", NULL); 230 unit_address = get_property(of_node, "reg", NULL);
231 if (unit_address == NULL) { 231 if (unit_address == NULL) {
232 printk(KERN_WARNING "%s: node %s missing 'reg'\n", 232 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
233 __FUNCTION__, 233 __FUNCTION__,
@@ -249,7 +249,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
249 viodev->type = of_node->type; 249 viodev->type = of_node->type;
250 viodev->unit_address = *unit_address; 250 viodev->unit_address = *unit_address;
251 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 251 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
252 unit_address = (unsigned int *)get_property(of_node, 252 unit_address = get_property(of_node,
253 "linux,unit_address", NULL); 253 "linux,unit_address", NULL);
254 if (unit_address != NULL) 254 if (unit_address != NULL)
255 viodev->unit_address = *unit_address; 255 viodev->unit_address = *unit_address;
@@ -423,7 +423,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
423{ 423{
424 const struct vio_dev *vio_dev = to_vio_dev(dev); 424 const struct vio_dev *vio_dev = to_vio_dev(dev);
425 struct device_node *dn = dev->platform_data; 425 struct device_node *dn = dev->platform_data;
426 char *cp; 426 const char *cp;
427 int length; 427 int length;
428 428
429 if (!num_envp) 429 if (!num_envp)
@@ -431,7 +431,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
431 431
432 if (!dn) 432 if (!dn)
433 return -ENODEV; 433 return -ENODEV;
434 cp = (char *)get_property(dn, "compatible", &length); 434 cp = get_property(dn, "compatible", &length);
435 if (!cp) 435 if (!cp)
436 return -ENODEV; 436 return -ENODEV;
437 437
@@ -493,11 +493,11 @@ static struct vio_dev *vio_find_name(const char *kobj_name)
493 */ 493 */
494struct vio_dev *vio_find_node(struct device_node *vnode) 494struct vio_dev *vio_find_node(struct device_node *vnode)
495{ 495{
496 uint32_t *unit_address; 496 const uint32_t *unit_address;
497 char kobj_name[BUS_ID_SIZE]; 497 char kobj_name[BUS_ID_SIZE];
498 498
499 /* construct the kobject name from the device node */ 499 /* construct the kobject name from the device node */
500 unit_address = (uint32_t *)get_property(vnode, "reg", NULL); 500 unit_address = get_property(vnode, "reg", NULL);
501 if (!unit_address) 501 if (!unit_address)
502 return NULL; 502 return NULL;
503 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); 503 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);