aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-07-12 01:39:54 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-31 01:55:04 -0400
commitc61c27d58af61e5b78257019b173732c29ce0c64 (patch)
tree259c64446662670d36b40f26dd702b5006a97e1d /arch/powerpc/platforms
parent8efca49329a50710d656a8bb78d6f0f0e2f48a26 (diff)
[POWERPC] cell: 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. cell platform changes. Built for cell_defconfig Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.c8
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c5
-rw-r--r--arch/powerpc/platforms/cell/iommu.c22
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c10
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c18
5 files changed, 31 insertions, 32 deletions
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c
index ce696c1cca75..3f3859d12e00 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.c
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -97,7 +97,7 @@ void __init cbe_regs_init(void)
97 struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++]; 97 struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++];
98 98
99 /* That hack must die die die ! */ 99 /* That hack must die die die ! */
100 struct address_prop { 100 const struct address_prop {
101 unsigned long address; 101 unsigned long address;
102 unsigned int len; 102 unsigned int len;
103 } __attribute__((packed)) *prop; 103 } __attribute__((packed)) *prop;
@@ -114,13 +114,11 @@ void __init cbe_regs_init(void)
114 if (cbe_thread_map[i].cpu_node == cpu) 114 if (cbe_thread_map[i].cpu_node == cpu)
115 cbe_thread_map[i].regs = map; 115 cbe_thread_map[i].regs = map;
116 116
117 prop = (struct address_prop *)get_property(cpu, "pervasive", 117 prop = get_property(cpu, "pervasive", NULL);
118 NULL);
119 if (prop != NULL) 118 if (prop != NULL)
120 map->pmd_regs = ioremap(prop->address, prop->len); 119 map->pmd_regs = ioremap(prop->address, prop->len);
121 120
122 prop = (struct address_prop *)get_property(cpu, "iic", 121 prop = get_property(cpu, "iic", NULL);
123 NULL);
124 if (prop != NULL) 122 if (prop != NULL)
125 map->iic_regs = ioremap(prop->address, prop->len); 123 map->iic_regs = ioremap(prop->address, prop->len);
126 } 124 }
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 9d5da7896892..b26b496f6548 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -250,15 +250,14 @@ static int __init setup_iic(void)
250 struct resource r0, r1; 250 struct resource r0, r1;
251 struct irq_host *host; 251 struct irq_host *host;
252 int found = 0; 252 int found = 0;
253 u32 *np; 253 const u32 *np;
254 254
255 for (dn = NULL; 255 for (dn = NULL;
256 (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) { 256 (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) {
257 if (!device_is_compatible(dn, 257 if (!device_is_compatible(dn,
258 "IBM,CBEA-Internal-Interrupt-Controller")) 258 "IBM,CBEA-Internal-Interrupt-Controller"))
259 continue; 259 continue;
260 np = (u32 *)get_property(dn, "ibm,interrupt-server-ranges", 260 np = get_property(dn, "ibm,interrupt-server-ranges", NULL);
261 NULL);
262 if (np == NULL) { 261 if (np == NULL) {
263 printk(KERN_WARNING "IIC: CPU association not found\n"); 262 printk(KERN_WARNING "IIC: CPU association not found\n");
264 of_node_put(dn); 263 of_node_put(dn);
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index a35004e14c69..d2b20eba5b87 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -308,15 +308,16 @@ static void cell_do_map_iommu(struct cell_iommu *iommu,
308 308
309static void iommu_devnode_setup(struct device_node *d) 309static void iommu_devnode_setup(struct device_node *d)
310{ 310{
311 unsigned int *ioid; 311 const unsigned int *ioid;
312 unsigned long *dma_window, map_start, map_size, token; 312 unsigned long map_start, map_size, token;
313 const unsigned long *dma_window;
313 struct cell_iommu *iommu; 314 struct cell_iommu *iommu;
314 315
315 ioid = (unsigned int *)get_property(d, "ioid", NULL); 316 ioid = get_property(d, "ioid", NULL);
316 if (!ioid) 317 if (!ioid)
317 pr_debug("No ioid entry found !\n"); 318 pr_debug("No ioid entry found !\n");
318 319
319 dma_window = (unsigned long *)get_property(d, "ibm,dma-window", NULL); 320 dma_window = get_property(d, "ibm,dma-window", NULL);
320 if (!dma_window) 321 if (!dma_window)
321 pr_debug("No ibm,dma-window entry found !\n"); 322 pr_debug("No ibm,dma-window entry found !\n");
322 323
@@ -371,8 +372,9 @@ static int cell_map_iommu_hardcoded(int num_nodes)
371 372
372static int cell_map_iommu(void) 373static int cell_map_iommu(void)
373{ 374{
374 unsigned int num_nodes = 0, *node_id; 375 unsigned int num_nodes = 0;
375 unsigned long *base, *mmio_base; 376 const unsigned int *node_id;
377 const unsigned long *base, *mmio_base;
376 struct device_node *dn; 378 struct device_node *dn;
377 struct cell_iommu *iommu = NULL; 379 struct cell_iommu *iommu = NULL;
378 380
@@ -381,7 +383,7 @@ static int cell_map_iommu(void)
381 for(dn = of_find_node_by_type(NULL, "cpu"); 383 for(dn = of_find_node_by_type(NULL, "cpu");
382 dn; 384 dn;
383 dn = of_find_node_by_type(dn, "cpu")) { 385 dn = of_find_node_by_type(dn, "cpu")) {
384 node_id = (unsigned int *)get_property(dn, "node-id", NULL); 386 node_id = get_property(dn, "node-id", NULL);
385 387
386 if (num_nodes < *node_id) 388 if (num_nodes < *node_id)
387 num_nodes = *node_id; 389 num_nodes = *node_id;
@@ -396,9 +398,9 @@ static int cell_map_iommu(void)
396 dn; 398 dn;
397 dn = of_find_node_by_type(dn, "cpu")) { 399 dn = of_find_node_by_type(dn, "cpu")) {
398 400
399 node_id = (unsigned int *)get_property(dn, "node-id", NULL); 401 node_id = get_property(dn, "node-id", NULL);
400 base = (unsigned long *)get_property(dn, "ioc-cache", NULL); 402 base = get_property(dn, "ioc-cache", NULL);
401 mmio_base = (unsigned long *)get_property(dn, "ioc-translation", NULL); 403 mmio_base = get_property(dn, "ioc-translation", NULL);
402 404
403 if (!base || !mmio_base || !node_id) 405 if (!base || !mmio_base || !node_id)
404 return cell_map_iommu_hardcoded(num_nodes); 406 return cell_map_iommu_hardcoded(num_nodes);
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index ae7ef88f1a37..ab4c252a4d9b 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -230,7 +230,7 @@ static void spider_irq_cascade(unsigned int irq, struct irq_desc *desc,
230static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) 230static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
231{ 231{
232 unsigned int virq; 232 unsigned int virq;
233 u32 *imap, *tmp; 233 const u32 *imap, *tmp;
234 int imaplen, intsize, unit; 234 int imaplen, intsize, unit;
235 struct device_node *iic; 235 struct device_node *iic;
236 struct irq_host *iic_host; 236 struct irq_host *iic_host;
@@ -248,25 +248,25 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
248#endif 248#endif
249 249
250 /* Now do the horrible hacks */ 250 /* Now do the horrible hacks */
251 tmp = (u32 *)get_property(pic->of_node, "#interrupt-cells", NULL); 251 tmp = get_property(pic->of_node, "#interrupt-cells", NULL);
252 if (tmp == NULL) 252 if (tmp == NULL)
253 return NO_IRQ; 253 return NO_IRQ;
254 intsize = *tmp; 254 intsize = *tmp;
255 imap = (u32 *)get_property(pic->of_node, "interrupt-map", &imaplen); 255 imap = get_property(pic->of_node, "interrupt-map", &imaplen);
256 if (imap == NULL || imaplen < (intsize + 1)) 256 if (imap == NULL || imaplen < (intsize + 1))
257 return NO_IRQ; 257 return NO_IRQ;
258 iic = of_find_node_by_phandle(imap[intsize]); 258 iic = of_find_node_by_phandle(imap[intsize]);
259 if (iic == NULL) 259 if (iic == NULL)
260 return NO_IRQ; 260 return NO_IRQ;
261 imap += intsize + 1; 261 imap += intsize + 1;
262 tmp = (u32 *)get_property(iic, "#interrupt-cells", NULL); 262 tmp = get_property(iic, "#interrupt-cells", NULL);
263 if (tmp == NULL) 263 if (tmp == NULL)
264 return NO_IRQ; 264 return NO_IRQ;
265 intsize = *tmp; 265 intsize = *tmp;
266 /* Assume unit is last entry of interrupt specifier */ 266 /* Assume unit is last entry of interrupt specifier */
267 unit = imap[intsize - 1]; 267 unit = imap[intsize - 1];
268 /* Ok, we have a unit, now let's try to get the node */ 268 /* Ok, we have a unit, now let's try to get the node */
269 tmp = (u32 *)get_property(iic, "ibm,interrupt-server-ranges", NULL); 269 tmp = get_property(iic, "ibm,interrupt-server-ranges", NULL);
270 if (tmp == NULL) { 270 if (tmp == NULL) {
271 of_node_put(iic); 271 of_node_put(iic);
272 return NO_IRQ; 272 return NO_IRQ;
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 5d2313a6c82b..86d55675e1d2 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -488,10 +488,10 @@ int spu_irq_class_1_bottom(struct spu *spu)
488 488
489static int __init find_spu_node_id(struct device_node *spe) 489static int __init find_spu_node_id(struct device_node *spe)
490{ 490{
491 unsigned int *id; 491 const unsigned int *id;
492 struct device_node *cpu; 492 struct device_node *cpu;
493 cpu = spe->parent->parent; 493 cpu = spe->parent->parent;
494 id = (unsigned int *)get_property(cpu, "node-id", NULL); 494 id = get_property(cpu, "node-id", NULL);
495 return id ? *id : 0; 495 return id ? *id : 0;
496} 496}
497 497
@@ -500,7 +500,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
500{ 500{
501 static DEFINE_MUTEX(add_spumem_mutex); 501 static DEFINE_MUTEX(add_spumem_mutex);
502 502
503 struct address_prop { 503 const struct address_prop {
504 unsigned long address; 504 unsigned long address;
505 unsigned int len; 505 unsigned int len;
506 } __attribute__((packed)) *p; 506 } __attribute__((packed)) *p;
@@ -511,7 +511,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
511 struct zone *zone; 511 struct zone *zone;
512 int ret; 512 int ret;
513 513
514 p = (void*)get_property(spe, prop, &proplen); 514 p = get_property(spe, prop, &proplen);
515 WARN_ON(proplen != sizeof (*p)); 515 WARN_ON(proplen != sizeof (*p));
516 516
517 start_pfn = p->address >> PAGE_SHIFT; 517 start_pfn = p->address >> PAGE_SHIFT;
@@ -531,12 +531,12 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
531static void __iomem * __init map_spe_prop(struct spu *spu, 531static void __iomem * __init map_spe_prop(struct spu *spu,
532 struct device_node *n, const char *name) 532 struct device_node *n, const char *name)
533{ 533{
534 struct address_prop { 534 const struct address_prop {
535 unsigned long address; 535 unsigned long address;
536 unsigned int len; 536 unsigned int len;
537 } __attribute__((packed)) *prop; 537 } __attribute__((packed)) *prop;
538 538
539 void *p; 539 const void *p;
540 int proplen; 540 int proplen;
541 void* ret = NULL; 541 void* ret = NULL;
542 int err = 0; 542 int err = 0;
@@ -570,14 +570,14 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
570{ 570{
571 struct irq_host *host; 571 struct irq_host *host;
572 unsigned int isrc; 572 unsigned int isrc;
573 u32 *tmp; 573 const u32 *tmp;
574 574
575 host = iic_get_irq_host(spu->node); 575 host = iic_get_irq_host(spu->node);
576 if (host == NULL) 576 if (host == NULL)
577 return -ENODEV; 577 return -ENODEV;
578 578
579 /* Get the interrupt source from the device-tree */ 579 /* Get the interrupt source from the device-tree */
580 tmp = (u32 *)get_property(np, "isrc", NULL); 580 tmp = get_property(np, "isrc", NULL);
581 if (!tmp) 581 if (!tmp)
582 return -ENODEV; 582 return -ENODEV;
583 spu->isrc = isrc = tmp[0]; 583 spu->isrc = isrc = tmp[0];
@@ -593,7 +593,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
593 593
594static int __init spu_map_device(struct spu *spu, struct device_node *node) 594static int __init spu_map_device(struct spu *spu, struct device_node *node)
595{ 595{
596 char *prop; 596 const char *prop;
597 int ret; 597 int ret;
598 598
599 ret = -ENODEV; 599 ret = -ENODEV;