diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2006-07-12 01:40:29 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-31 01:55:05 -0400 |
commit | 018a3d1db7cdb6127656c1622ee1d2302e16436d (patch) | |
tree | 5b6714fa9fcd1441f7c1b30e0391484c095925b6 | |
parent | eeb2b723ef5100fafa381d92eb70d83e98516a44 (diff) |
[POWERPC] powermac: 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.
powermac platform & macintosh driver changes.
Built for pmac32_defconfig, g5_defconfig
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
29 files changed, 166 insertions, 158 deletions
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c index 69f65e215a5c..205b4a392862 100644 --- a/arch/powerpc/platforms/powermac/backlight.c +++ b/arch/powerpc/platforms/powermac/backlight.c | |||
@@ -38,7 +38,8 @@ int pmac_has_backlight_type(const char *type) | |||
38 | struct device_node* bk_node = find_devices("backlight"); | 38 | struct device_node* bk_node = find_devices("backlight"); |
39 | 39 | ||
40 | if (bk_node) { | 40 | if (bk_node) { |
41 | char *prop = get_property(bk_node, "backlight-control", NULL); | 41 | const char *prop = get_property(bk_node, |
42 | "backlight-control", NULL); | ||
42 | if (prop && strncmp(prop, type, strlen(type)) == 0) | 43 | if (prop && strncmp(prop, type, strlen(type)) == 0) |
43 | return 1; | 44 | return 1; |
44 | } | 45 | } |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c index 62926248bdb8..c2b6b4134f68 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_32.c +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c | |||
@@ -421,7 +421,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
421 | 421 | ||
422 | static u32 read_gpio(struct device_node *np) | 422 | static u32 read_gpio(struct device_node *np) |
423 | { | 423 | { |
424 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 424 | const u32 *reg = get_property(np, "reg", NULL); |
425 | u32 offset; | 425 | u32 offset; |
426 | 426 | ||
427 | if (reg == NULL) | 427 | if (reg == NULL) |
@@ -497,7 +497,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
497 | "frequency-gpio"); | 497 | "frequency-gpio"); |
498 | struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL, | 498 | struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL, |
499 | "slewing-done"); | 499 | "slewing-done"); |
500 | u32 *value; | 500 | const u32 *value; |
501 | 501 | ||
502 | /* | 502 | /* |
503 | * Check to see if it's GPIO driven or PMU only | 503 | * Check to see if it's GPIO driven or PMU only |
@@ -519,15 +519,15 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
519 | */ | 519 | */ |
520 | if (frequency_gpio && slew_done_gpio) { | 520 | if (frequency_gpio && slew_done_gpio) { |
521 | int lenp, rc; | 521 | int lenp, rc; |
522 | u32 *freqs, *ratio; | 522 | const u32 *freqs, *ratio; |
523 | 523 | ||
524 | freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp); | 524 | freqs = get_property(cpunode, "bus-frequencies", &lenp); |
525 | lenp /= sizeof(u32); | 525 | lenp /= sizeof(u32); |
526 | if (freqs == NULL || lenp != 2) { | 526 | if (freqs == NULL || lenp != 2) { |
527 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); | 527 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); |
528 | return 1; | 528 | return 1; |
529 | } | 529 | } |
530 | ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL); | 530 | ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL); |
531 | if (ratio == NULL) { | 531 | if (ratio == NULL) { |
532 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); | 532 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); |
533 | return 1; | 533 | return 1; |
@@ -562,7 +562,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
562 | /* If we use the PMU, look for the min & max frequencies in the | 562 | /* If we use the PMU, look for the min & max frequencies in the |
563 | * device-tree | 563 | * device-tree |
564 | */ | 564 | */ |
565 | value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL); | 565 | value = get_property(cpunode, "min-clock-frequency", NULL); |
566 | if (!value) | 566 | if (!value) |
567 | return 1; | 567 | return 1; |
568 | low_freq = (*value) / 1000; | 568 | low_freq = (*value) / 1000; |
@@ -571,7 +571,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
571 | if (low_freq < 100000) | 571 | if (low_freq < 100000) |
572 | low_freq *= 10; | 572 | low_freq *= 10; |
573 | 573 | ||
574 | value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL); | 574 | value = get_property(cpunode, "max-clock-frequency", NULL); |
575 | if (!value) | 575 | if (!value) |
576 | return 1; | 576 | return 1; |
577 | hi_freq = (*value) / 1000; | 577 | hi_freq = (*value) / 1000; |
@@ -611,13 +611,14 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) | |||
611 | static int pmac_cpufreq_init_750FX(struct device_node *cpunode) | 611 | static int pmac_cpufreq_init_750FX(struct device_node *cpunode) |
612 | { | 612 | { |
613 | struct device_node *volt_gpio_np; | 613 | struct device_node *volt_gpio_np; |
614 | u32 pvr, *value; | 614 | u32 pvr; |
615 | const u32 *value; | ||
615 | 616 | ||
616 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) | 617 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) |
617 | return 1; | 618 | return 1; |
618 | 619 | ||
619 | hi_freq = cur_freq; | 620 | hi_freq = cur_freq; |
620 | value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL); | 621 | value = get_property(cpunode, "reduced-clock-frequency", NULL); |
621 | if (!value) | 622 | if (!value) |
622 | return 1; | 623 | return 1; |
623 | low_freq = (*value) / 1000; | 624 | low_freq = (*value) / 1000; |
@@ -650,7 +651,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) | |||
650 | static int __init pmac_cpufreq_setup(void) | 651 | static int __init pmac_cpufreq_setup(void) |
651 | { | 652 | { |
652 | struct device_node *cpunode; | 653 | struct device_node *cpunode; |
653 | u32 *value; | 654 | const u32 *value; |
654 | 655 | ||
655 | if (strstr(cmd_line, "nocpufreq")) | 656 | if (strstr(cmd_line, "nocpufreq")) |
656 | return 0; | 657 | return 0; |
@@ -661,7 +662,7 @@ static int __init pmac_cpufreq_setup(void) | |||
661 | goto out; | 662 | goto out; |
662 | 663 | ||
663 | /* Get current cpu clock freq */ | 664 | /* Get current cpu clock freq */ |
664 | value = (u32 *)get_property(cpunode, "clock-frequency", NULL); | 665 | value = get_property(cpunode, "clock-frequency", NULL); |
665 | if (!value) | 666 | if (!value) |
666 | goto out; | 667 | goto out; |
667 | cur_freq = (*value) / 1000; | 668 | cur_freq = (*value) / 1000; |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index a6a84ac5433e..c364c89adb4e 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -89,7 +89,7 @@ static DEFINE_MUTEX(g5_switch_mutex); | |||
89 | 89 | ||
90 | #ifdef CONFIG_PPC_SMU | 90 | #ifdef CONFIG_PPC_SMU |
91 | 91 | ||
92 | static u32 *g5_pmode_data; | 92 | static const u32 *g5_pmode_data; |
93 | static int g5_pmode_max; | 93 | static int g5_pmode_max; |
94 | 94 | ||
95 | static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ | 95 | static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ |
@@ -391,7 +391,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
391 | unsigned int psize, ssize; | 391 | unsigned int psize, ssize; |
392 | unsigned long max_freq; | 392 | unsigned long max_freq; |
393 | char *freq_method, *volt_method; | 393 | char *freq_method, *volt_method; |
394 | u32 *valp, pvr_hi; | 394 | const u32 *valp; |
395 | u32 pvr_hi; | ||
395 | int use_volts_vdnap = 0; | 396 | int use_volts_vdnap = 0; |
396 | int use_volts_smu = 0; | 397 | int use_volts_smu = 0; |
397 | int rc = -ENODEV; | 398 | int rc = -ENODEV; |
@@ -409,8 +410,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
409 | /* Get first CPU node */ | 410 | /* Get first CPU node */ |
410 | for (cpunode = NULL; | 411 | for (cpunode = NULL; |
411 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { | 412 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { |
412 | u32 *reg = | 413 | const u32 *reg = get_property(cpunode, "reg", NULL); |
413 | (u32 *)get_property(cpunode, "reg", NULL); | ||
414 | if (reg == NULL || (*reg) != 0) | 414 | if (reg == NULL || (*reg) != 0) |
415 | continue; | 415 | continue; |
416 | if (!strcmp(cpunode->type, "cpu")) | 416 | if (!strcmp(cpunode->type, "cpu")) |
@@ -422,7 +422,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* Check 970FX for now */ | 424 | /* Check 970FX for now */ |
425 | valp = (u32 *)get_property(cpunode, "cpu-version", NULL); | 425 | valp = get_property(cpunode, "cpu-version", NULL); |
426 | if (!valp) { | 426 | if (!valp) { |
427 | DBG("No cpu-version property !\n"); | 427 | DBG("No cpu-version property !\n"); |
428 | goto bail_noprops; | 428 | goto bail_noprops; |
@@ -434,7 +434,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | /* Look for the powertune data in the device-tree */ | 436 | /* Look for the powertune data in the device-tree */ |
437 | g5_pmode_data = (u32 *)get_property(cpunode, "power-mode-data",&psize); | 437 | g5_pmode_data = get_property(cpunode, "power-mode-data",&psize); |
438 | if (!g5_pmode_data) { | 438 | if (!g5_pmode_data) { |
439 | DBG("No power-mode-data !\n"); | 439 | DBG("No power-mode-data !\n"); |
440 | goto bail_noprops; | 440 | goto bail_noprops; |
@@ -442,7 +442,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
442 | g5_pmode_max = psize / sizeof(u32) - 1; | 442 | g5_pmode_max = psize / sizeof(u32) - 1; |
443 | 443 | ||
444 | if (use_volts_smu) { | 444 | if (use_volts_smu) { |
445 | struct smu_sdbp_header *shdr; | 445 | const struct smu_sdbp_header *shdr; |
446 | 446 | ||
447 | /* Look for the FVT table */ | 447 | /* Look for the FVT table */ |
448 | shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL); | 448 | shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL); |
@@ -493,7 +493,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
493 | * half freq in this version. So far, I haven't yet seen a machine | 493 | * half freq in this version. So far, I haven't yet seen a machine |
494 | * supporting anything else. | 494 | * supporting anything else. |
495 | */ | 495 | */ |
496 | valp = (u32 *)get_property(cpunode, "clock-frequency", NULL); | 496 | valp = get_property(cpunode, "clock-frequency", NULL); |
497 | if (!valp) | 497 | if (!valp) |
498 | return -ENODEV; | 498 | return -ENODEV; |
499 | max_freq = (*valp)/1000; | 499 | max_freq = (*valp)/1000; |
@@ -541,8 +541,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
541 | static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | 541 | static int __init g5_pm72_cpufreq_init(struct device_node *cpus) |
542 | { | 542 | { |
543 | struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; | 543 | struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; |
544 | u8 *eeprom = NULL; | 544 | const u8 *eeprom = NULL; |
545 | u32 *valp; | 545 | const u32 *valp; |
546 | u64 max_freq, min_freq, ih, il; | 546 | u64 max_freq, min_freq, ih, il; |
547 | int has_volt = 1, rc = 0; | 547 | int has_volt = 1, rc = 0; |
548 | 548 | ||
@@ -563,7 +563,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
563 | /* Lookup the cpuid eeprom node */ | 563 | /* Lookup the cpuid eeprom node */ |
564 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); | 564 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); |
565 | if (cpuid != NULL) | 565 | if (cpuid != NULL) |
566 | eeprom = (u8 *)get_property(cpuid, "cpuid", NULL); | 566 | eeprom = get_property(cpuid, "cpuid", NULL); |
567 | if (eeprom == NULL) { | 567 | if (eeprom == NULL) { |
568 | printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); | 568 | printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); |
569 | rc = -ENODEV; | 569 | rc = -ENODEV; |
@@ -573,7 +573,8 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
573 | /* Lookup the i2c hwclock */ | 573 | /* Lookup the i2c hwclock */ |
574 | for (hwclock = NULL; | 574 | for (hwclock = NULL; |
575 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ | 575 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ |
576 | char *loc = get_property(hwclock, "hwctrl-location", NULL); | 576 | const char *loc = get_property(hwclock, |
577 | "hwctrl-location", NULL); | ||
577 | if (loc == NULL) | 578 | if (loc == NULL) |
578 | continue; | 579 | continue; |
579 | if (strcmp(loc, "CPU CLOCK")) | 580 | if (strcmp(loc, "CPU CLOCK")) |
@@ -637,7 +638,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
637 | */ | 638 | */ |
638 | 639 | ||
639 | /* Get max frequency from device-tree */ | 640 | /* Get max frequency from device-tree */ |
640 | valp = (u32 *)get_property(cpunode, "clock-frequency", NULL); | 641 | valp = get_property(cpunode, "clock-frequency", NULL); |
641 | if (!valp) { | 642 | if (!valp) { |
642 | printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); | 643 | printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); |
643 | rc = -ENODEV; | 644 | rc = -ENODEV; |
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index f8313bf9a9f7..13fcaf5b1796 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c | |||
@@ -1058,8 +1058,8 @@ core99_reset_cpu(struct device_node *node, long param, long value) | |||
1058 | if (np == NULL) | 1058 | if (np == NULL) |
1059 | return -ENODEV; | 1059 | return -ENODEV; |
1060 | for (np = np->child; np != NULL; np = np->sibling) { | 1060 | for (np = np->child; np != NULL; np = np->sibling) { |
1061 | u32 *num = (u32 *)get_property(np, "reg", NULL); | 1061 | u32 *num = get_property(np, "reg", NULL); |
1062 | u32 *rst = (u32 *)get_property(np, "soft-reset", NULL); | 1062 | u32 *rst = get_property(np, "soft-reset", NULL); |
1063 | if (num == NULL || rst == NULL) | 1063 | if (num == NULL || rst == NULL) |
1064 | continue; | 1064 | continue; |
1065 | if (param == *num) { | 1065 | if (param == *num) { |
@@ -1087,7 +1087,7 @@ core99_usb_enable(struct device_node *node, long param, long value) | |||
1087 | { | 1087 | { |
1088 | struct macio_chip *macio; | 1088 | struct macio_chip *macio; |
1089 | unsigned long flags; | 1089 | unsigned long flags; |
1090 | char *prop; | 1090 | const char *prop; |
1091 | int number; | 1091 | int number; |
1092 | u32 reg; | 1092 | u32 reg; |
1093 | 1093 | ||
@@ -1096,7 +1096,7 @@ core99_usb_enable(struct device_node *node, long param, long value) | |||
1096 | macio->type != macio_intrepid) | 1096 | macio->type != macio_intrepid) |
1097 | return -ENODEV; | 1097 | return -ENODEV; |
1098 | 1098 | ||
1099 | prop = (char *)get_property(node, "AAPL,clock-id", NULL); | 1099 | prop = get_property(node, "AAPL,clock-id", NULL); |
1100 | if (!prop) | 1100 | if (!prop) |
1101 | return -ENODEV; | 1101 | return -ENODEV; |
1102 | if (strncmp(prop, "usb0u048", 8) == 0) | 1102 | if (strncmp(prop, "usb0u048", 8) == 0) |
@@ -1507,8 +1507,8 @@ static long g5_reset_cpu(struct device_node *node, long param, long value) | |||
1507 | if (np == NULL) | 1507 | if (np == NULL) |
1508 | return -ENODEV; | 1508 | return -ENODEV; |
1509 | for (np = np->child; np != NULL; np = np->sibling) { | 1509 | for (np = np->child; np != NULL; np = np->sibling) { |
1510 | u32 *num = (u32 *)get_property(np, "reg", NULL); | 1510 | const u32 *num = get_property(np, "reg", NULL); |
1511 | u32 *rst = (u32 *)get_property(np, "soft-reset", NULL); | 1511 | const u32 *rst = get_property(np, "soft-reset", NULL); |
1512 | if (num == NULL || rst == NULL) | 1512 | if (num == NULL || rst == NULL) |
1513 | continue; | 1513 | continue; |
1514 | if (param == *num) { | 1514 | if (param == *num) { |
@@ -2408,7 +2408,7 @@ static int __init probe_motherboard(void) | |||
2408 | */ | 2408 | */ |
2409 | dt = find_devices("device-tree"); | 2409 | dt = find_devices("device-tree"); |
2410 | if (dt != NULL) | 2410 | if (dt != NULL) |
2411 | model = (const char *) get_property(dt, "model", NULL); | 2411 | model = get_property(dt, "model", NULL); |
2412 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { | 2412 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { |
2413 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { | 2413 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { |
2414 | pmac_mb = pmac_mb_defs[i]; | 2414 | pmac_mb = pmac_mb_defs[i]; |
@@ -2536,7 +2536,7 @@ found: | |||
2536 | */ | 2536 | */ |
2537 | static void __init probe_uninorth(void) | 2537 | static void __init probe_uninorth(void) |
2538 | { | 2538 | { |
2539 | u32 *addrp; | 2539 | const u32 *addrp; |
2540 | phys_addr_t address; | 2540 | phys_addr_t address; |
2541 | unsigned long actrl; | 2541 | unsigned long actrl; |
2542 | 2542 | ||
@@ -2555,7 +2555,7 @@ static void __init probe_uninorth(void) | |||
2555 | if (uninorth_node == NULL) | 2555 | if (uninorth_node == NULL) |
2556 | return; | 2556 | return; |
2557 | 2557 | ||
2558 | addrp = (u32 *)get_property(uninorth_node, "reg", NULL); | 2558 | addrp = get_property(uninorth_node, "reg", NULL); |
2559 | if (addrp == NULL) | 2559 | if (addrp == NULL) |
2560 | return; | 2560 | return; |
2561 | address = of_translate_address(uninorth_node, addrp); | 2561 | address = of_translate_address(uninorth_node, addrp); |
@@ -2596,7 +2596,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2596 | struct device_node* node; | 2596 | struct device_node* node; |
2597 | int i; | 2597 | int i; |
2598 | volatile u32 __iomem *base; | 2598 | volatile u32 __iomem *base; |
2599 | u32 *addrp, *revp; | 2599 | const u32 *addrp, *revp; |
2600 | phys_addr_t addr; | 2600 | phys_addr_t addr; |
2601 | u64 size; | 2601 | u64 size; |
2602 | 2602 | ||
@@ -2639,7 +2639,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2639 | return; | 2639 | return; |
2640 | } | 2640 | } |
2641 | if (type == macio_keylargo || type == macio_keylargo2) { | 2641 | if (type == macio_keylargo || type == macio_keylargo2) { |
2642 | u32 *did = (u32 *)get_property(node, "device-id", NULL); | 2642 | const u32 *did = get_property(node, "device-id", NULL); |
2643 | if (*did == 0x00000025) | 2643 | if (*did == 0x00000025) |
2644 | type = macio_pangea; | 2644 | type = macio_pangea; |
2645 | if (*did == 0x0000003e) | 2645 | if (*did == 0x0000003e) |
@@ -2652,7 +2652,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2652 | macio_chips[i].base = base; | 2652 | macio_chips[i].base = base; |
2653 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; | 2653 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; |
2654 | macio_chips[i].name = macio_names[type]; | 2654 | macio_chips[i].name = macio_names[type]; |
2655 | revp = (u32 *)get_property(node, "revision-id", NULL); | 2655 | revp = get_property(node, "revision-id", NULL); |
2656 | if (revp) | 2656 | if (revp) |
2657 | macio_chips[i].rev = *revp; | 2657 | macio_chips[i].rev = *revp; |
2658 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", | 2658 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", |
@@ -2695,15 +2695,15 @@ static void __init | |||
2695 | initial_serial_shutdown(struct device_node *np) | 2695 | initial_serial_shutdown(struct device_node *np) |
2696 | { | 2696 | { |
2697 | int len; | 2697 | int len; |
2698 | struct slot_names_prop { | 2698 | const struct slot_names_prop { |
2699 | int count; | 2699 | int count; |
2700 | char name[1]; | 2700 | char name[1]; |
2701 | } *slots; | 2701 | } *slots; |
2702 | char *conn; | 2702 | const char *conn; |
2703 | int port_type = PMAC_SCC_ASYNC; | 2703 | int port_type = PMAC_SCC_ASYNC; |
2704 | int modem = 0; | 2704 | int modem = 0; |
2705 | 2705 | ||
2706 | slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); | 2706 | slots = get_property(np, "slot-names", &len); |
2707 | conn = get_property(np, "AAPL,connector", &len); | 2707 | conn = get_property(np, "AAPL,connector", &len); |
2708 | if (conn && (strcmp(conn, "infrared") == 0)) | 2708 | if (conn && (strcmp(conn, "infrared") == 0)) |
2709 | port_type = PMAC_SCC_IRDA; | 2709 | port_type = PMAC_SCC_IRDA; |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index 8677f50c2586..c2c7cf75dd5f 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
@@ -477,7 +477,8 @@ static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, | |||
477 | static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | 477 | static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) |
478 | { | 478 | { |
479 | struct pmac_i2c_host_kw *host; | 479 | struct pmac_i2c_host_kw *host; |
480 | u32 *psteps, *prate, *addrp, steps; | 480 | const u32 *psteps, *prate, *addrp; |
481 | u32 steps; | ||
481 | 482 | ||
482 | host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL); | 483 | host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL); |
483 | if (host == NULL) { | 484 | if (host == NULL) { |
@@ -490,7 +491,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
490 | * on all i2c keywest nodes so far ... we would have to fallback | 491 | * on all i2c keywest nodes so far ... we would have to fallback |
491 | * to macio parsing if that wasn't the case | 492 | * to macio parsing if that wasn't the case |
492 | */ | 493 | */ |
493 | addrp = (u32 *)get_property(np, "AAPL,address", NULL); | 494 | addrp = get_property(np, "AAPL,address", NULL); |
494 | if (addrp == NULL) { | 495 | if (addrp == NULL) { |
495 | printk(KERN_ERR "low_i2c: Can't find address for %s\n", | 496 | printk(KERN_ERR "low_i2c: Can't find address for %s\n", |
496 | np->full_name); | 497 | np->full_name); |
@@ -504,13 +505,13 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
504 | host->timeout_timer.function = kw_i2c_timeout; | 505 | host->timeout_timer.function = kw_i2c_timeout; |
505 | host->timeout_timer.data = (unsigned long)host; | 506 | host->timeout_timer.data = (unsigned long)host; |
506 | 507 | ||
507 | psteps = (u32 *)get_property(np, "AAPL,address-step", NULL); | 508 | psteps = get_property(np, "AAPL,address-step", NULL); |
508 | steps = psteps ? (*psteps) : 0x10; | 509 | steps = psteps ? (*psteps) : 0x10; |
509 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) | 510 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) |
510 | steps >>= 1; | 511 | steps >>= 1; |
511 | /* Select interface rate */ | 512 | /* Select interface rate */ |
512 | host->speed = KW_I2C_MODE_25KHZ; | 513 | host->speed = KW_I2C_MODE_25KHZ; |
513 | prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL); | 514 | prate = get_property(np, "AAPL,i2c-rate", NULL); |
514 | if (prate) switch(*prate) { | 515 | if (prate) switch(*prate) { |
515 | case 100: | 516 | case 100: |
516 | host->speed = KW_I2C_MODE_100KHZ; | 517 | host->speed = KW_I2C_MODE_100KHZ; |
@@ -618,8 +619,8 @@ static void __init kw_i2c_probe(void) | |||
618 | } else { | 619 | } else { |
619 | for (child = NULL; | 620 | for (child = NULL; |
620 | (child = of_get_next_child(np, child)) != NULL;) { | 621 | (child = of_get_next_child(np, child)) != NULL;) { |
621 | u32 *reg = | 622 | const u32 *reg = get_property(child, |
622 | (u32 *)get_property(child, "reg", NULL); | 623 | "reg", NULL); |
623 | if (reg == NULL) | 624 | if (reg == NULL) |
624 | continue; | 625 | continue; |
625 | kw_i2c_add(host, np, child, *reg); | 626 | kw_i2c_add(host, np, child, *reg); |
@@ -881,7 +882,7 @@ static void __init smu_i2c_probe(void) | |||
881 | { | 882 | { |
882 | struct device_node *controller, *busnode; | 883 | struct device_node *controller, *busnode; |
883 | struct pmac_i2c_bus *bus; | 884 | struct pmac_i2c_bus *bus; |
884 | u32 *reg; | 885 | const u32 *reg; |
885 | int sz; | 886 | int sz; |
886 | 887 | ||
887 | if (!smu_present()) | 888 | if (!smu_present()) |
@@ -904,7 +905,7 @@ static void __init smu_i2c_probe(void) | |||
904 | if (strcmp(busnode->type, "i2c") && | 905 | if (strcmp(busnode->type, "i2c") && |
905 | strcmp(busnode->type, "i2c-bus")) | 906 | strcmp(busnode->type, "i2c-bus")) |
906 | continue; | 907 | continue; |
907 | reg = (u32 *)get_property(busnode, "reg", NULL); | 908 | reg = get_property(busnode, "reg", NULL); |
908 | if (reg == NULL) | 909 | if (reg == NULL) |
909 | continue; | 910 | continue; |
910 | 911 | ||
@@ -948,9 +949,8 @@ struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node) | |||
948 | list_for_each_entry(bus, &pmac_i2c_busses, link) { | 949 | list_for_each_entry(bus, &pmac_i2c_busses, link) { |
949 | if (p == bus->busnode) { | 950 | if (p == bus->busnode) { |
950 | if (prev && bus->flags & pmac_i2c_multibus) { | 951 | if (prev && bus->flags & pmac_i2c_multibus) { |
951 | u32 *reg; | 952 | const u32 *reg; |
952 | reg = (u32 *)get_property(prev, "reg", | 953 | reg = get_property(prev, "reg", NULL); |
953 | NULL); | ||
954 | if (!reg) | 954 | if (!reg) |
955 | continue; | 955 | continue; |
956 | if (((*reg) >> 8) != bus->channel) | 956 | if (((*reg) >> 8) != bus->channel) |
@@ -971,7 +971,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_find_bus); | |||
971 | 971 | ||
972 | u8 pmac_i2c_get_dev_addr(struct device_node *device) | 972 | u8 pmac_i2c_get_dev_addr(struct device_node *device) |
973 | { | 973 | { |
974 | u32 *reg = (u32 *)get_property(device, "reg", NULL); | 974 | const u32 *reg = get_property(device, "reg", NULL); |
975 | 975 | ||
976 | if (reg == NULL) | 976 | if (reg == NULL) |
977 | return 0; | 977 | return 0; |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 556b349797e8..787ffd999bc2 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -69,16 +69,16 @@ struct device_node *k2_skiplist[2]; | |||
69 | static int __init fixup_one_level_bus_range(struct device_node *node, int higher) | 69 | static int __init fixup_one_level_bus_range(struct device_node *node, int higher) |
70 | { | 70 | { |
71 | for (; node != 0;node = node->sibling) { | 71 | for (; node != 0;node = node->sibling) { |
72 | int * bus_range; | 72 | const int * bus_range; |
73 | unsigned int *class_code; | 73 | const unsigned int *class_code; |
74 | int len; | 74 | int len; |
75 | 75 | ||
76 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ | 76 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ |
77 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 77 | class_code = get_property(node, "class-code", NULL); |
78 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 78 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
79 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 79 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
80 | continue; | 80 | continue; |
81 | bus_range = (int *) get_property(node, "bus-range", &len); | 81 | bus_range = get_property(node, "bus-range", &len); |
82 | if (bus_range != NULL && len > 2 * sizeof(int)) { | 82 | if (bus_range != NULL && len > 2 * sizeof(int)) { |
83 | if (bus_range[1] > higher) | 83 | if (bus_range[1] > higher) |
84 | higher = bus_range[1]; | 84 | higher = bus_range[1]; |
@@ -96,13 +96,15 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher | |||
96 | */ | 96 | */ |
97 | static void __init fixup_bus_range(struct device_node *bridge) | 97 | static void __init fixup_bus_range(struct device_node *bridge) |
98 | { | 98 | { |
99 | int * bus_range; | 99 | int *bus_range, len; |
100 | int len; | 100 | struct property *prop; |
101 | 101 | ||
102 | /* Lookup the "bus-range" property for the hose */ | 102 | /* Lookup the "bus-range" property for the hose */ |
103 | bus_range = (int *) get_property(bridge, "bus-range", &len); | 103 | prop = of_find_property(bridge, "bus-range", &len); |
104 | if (bus_range == NULL || len < 2 * sizeof(int)) | 104 | if (prop == NULL || prop->length < 2 * sizeof(int)) |
105 | return; | 105 | return; |
106 | |||
107 | bus_range = (int *)prop->value; | ||
106 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); | 108 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); |
107 | } | 109 | } |
108 | 110 | ||
@@ -240,7 +242,7 @@ static struct pci_ops macrisc_pci_ops = | |||
240 | static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) | 242 | static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) |
241 | { | 243 | { |
242 | struct device_node *np; | 244 | struct device_node *np; |
243 | u32 *vendor, *device; | 245 | const u32 *vendor, *device; |
244 | 246 | ||
245 | if (offset >= 0x100) | 247 | if (offset >= 0x100) |
246 | return PCIBIOS_BAD_REGISTER_NUMBER; | 248 | return PCIBIOS_BAD_REGISTER_NUMBER; |
@@ -248,8 +250,8 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) | |||
248 | if (np == NULL) | 250 | if (np == NULL) |
249 | return PCIBIOS_DEVICE_NOT_FOUND; | 251 | return PCIBIOS_DEVICE_NOT_FOUND; |
250 | 252 | ||
251 | vendor = (u32 *)get_property(np, "vendor-id", NULL); | 253 | vendor = get_property(np, "vendor-id", NULL); |
252 | device = (u32 *)get_property(np, "device-id", NULL); | 254 | device = get_property(np, "device-id", NULL); |
253 | if (vendor == NULL || device == NULL) | 255 | if (vendor == NULL || device == NULL) |
254 | return PCIBIOS_DEVICE_NOT_FOUND; | 256 | return PCIBIOS_DEVICE_NOT_FOUND; |
255 | 257 | ||
@@ -689,20 +691,21 @@ static void __init fixup_nec_usb2(void) | |||
689 | 691 | ||
690 | for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { | 692 | for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { |
691 | struct pci_controller *hose; | 693 | struct pci_controller *hose; |
692 | u32 data, *prop; | 694 | u32 data; |
695 | const u32 *prop; | ||
693 | u8 bus, devfn; | 696 | u8 bus, devfn; |
694 | 697 | ||
695 | prop = (u32 *)get_property(nec, "vendor-id", NULL); | 698 | prop = get_property(nec, "vendor-id", NULL); |
696 | if (prop == NULL) | 699 | if (prop == NULL) |
697 | continue; | 700 | continue; |
698 | if (0x1033 != *prop) | 701 | if (0x1033 != *prop) |
699 | continue; | 702 | continue; |
700 | prop = (u32 *)get_property(nec, "device-id", NULL); | 703 | prop = get_property(nec, "device-id", NULL); |
701 | if (prop == NULL) | 704 | if (prop == NULL) |
702 | continue; | 705 | continue; |
703 | if (0x0035 != *prop) | 706 | if (0x0035 != *prop) |
704 | continue; | 707 | continue; |
705 | prop = (u32 *)get_property(nec, "reg", NULL); | 708 | prop = get_property(nec, "reg", NULL); |
706 | if (prop == NULL) | 709 | if (prop == NULL) |
707 | continue; | 710 | continue; |
708 | devfn = (prop[0] >> 8) & 0xff; | 711 | devfn = (prop[0] >> 8) & 0xff; |
@@ -901,7 +904,7 @@ static int __init add_bridge(struct device_node *dev) | |||
901 | struct pci_controller *hose; | 904 | struct pci_controller *hose; |
902 | struct resource rsrc; | 905 | struct resource rsrc; |
903 | char *disp_name; | 906 | char *disp_name; |
904 | int *bus_range; | 907 | const int *bus_range; |
905 | int primary = 1, has_address = 0; | 908 | int primary = 1, has_address = 0; |
906 | 909 | ||
907 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 910 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
@@ -910,7 +913,7 @@ static int __init add_bridge(struct device_node *dev) | |||
910 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 913 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
911 | 914 | ||
912 | /* Get bus range if any */ | 915 | /* Get bus range if any */ |
913 | bus_range = (int *) get_property(dev, "bus-range", &len); | 916 | bus_range = get_property(dev, "bus-range", &len); |
914 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 917 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
915 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 918 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
916 | " bus 0\n", dev->full_name); | 919 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c index 6d66359ec8c8..829dacec96e5 100644 --- a/arch/powerpc/platforms/powermac/pfunc_base.c +++ b/arch/powerpc/platforms/powermac/pfunc_base.c | |||
@@ -114,7 +114,7 @@ static void macio_gpio_init_one(struct macio_chip *macio) | |||
114 | * we just create them all | 114 | * we just create them all |
115 | */ | 115 | */ |
116 | for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { | 116 | for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { |
117 | u32 *reg = (u32 *)get_property(gp, "reg", NULL); | 117 | const u32 *reg = get_property(gp, "reg", NULL); |
118 | unsigned long offset; | 118 | unsigned long offset; |
119 | if (reg == NULL) | 119 | if (reg == NULL) |
120 | continue; | 120 | continue; |
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index b117adbf9571..7651f278615a 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c | |||
@@ -813,14 +813,15 @@ struct pmf_function *__pmf_find_function(struct device_node *target, | |||
813 | struct pmf_device *dev; | 813 | struct pmf_device *dev; |
814 | struct pmf_function *func, *result = NULL; | 814 | struct pmf_function *func, *result = NULL; |
815 | char fname[64]; | 815 | char fname[64]; |
816 | u32 *prop, ph; | 816 | const u32 *prop; |
817 | u32 ph; | ||
817 | 818 | ||
818 | /* | 819 | /* |
819 | * Look for a "platform-*" function reference. If we can't find | 820 | * Look for a "platform-*" function reference. If we can't find |
820 | * one, then we fallback to a direct call attempt | 821 | * one, then we fallback to a direct call attempt |
821 | */ | 822 | */ |
822 | snprintf(fname, 63, "platform-%s", name); | 823 | snprintf(fname, 63, "platform-%s", name); |
823 | prop = (u32 *)get_property(target, fname, NULL); | 824 | prop = get_property(target, fname, NULL); |
824 | if (prop == NULL) | 825 | if (prop == NULL) |
825 | goto find_it; | 826 | goto find_it; |
826 | ph = *prop; | 827 | ph = *prop; |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 31a9da769fa2..824a618396ab 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -116,7 +116,7 @@ extern struct smp_ops_t core99_smp_ops; | |||
116 | static void pmac_show_cpuinfo(struct seq_file *m) | 116 | static void pmac_show_cpuinfo(struct seq_file *m) |
117 | { | 117 | { |
118 | struct device_node *np; | 118 | struct device_node *np; |
119 | char *pp; | 119 | const char *pp; |
120 | int plen; | 120 | int plen; |
121 | int mbmodel; | 121 | int mbmodel; |
122 | unsigned int mbflags; | 122 | unsigned int mbflags; |
@@ -134,12 +134,12 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
134 | seq_printf(m, "machine\t\t: "); | 134 | seq_printf(m, "machine\t\t: "); |
135 | np = of_find_node_by_path("/"); | 135 | np = of_find_node_by_path("/"); |
136 | if (np != NULL) { | 136 | if (np != NULL) { |
137 | pp = (char *) get_property(np, "model", NULL); | 137 | pp = get_property(np, "model", NULL); |
138 | if (pp != NULL) | 138 | if (pp != NULL) |
139 | seq_printf(m, "%s\n", pp); | 139 | seq_printf(m, "%s\n", pp); |
140 | else | 140 | else |
141 | seq_printf(m, "PowerMac\n"); | 141 | seq_printf(m, "PowerMac\n"); |
142 | pp = (char *) get_property(np, "compatible", &plen); | 142 | pp = get_property(np, "compatible", &plen); |
143 | if (pp != NULL) { | 143 | if (pp != NULL) { |
144 | seq_printf(m, "motherboard\t:"); | 144 | seq_printf(m, "motherboard\t:"); |
145 | while (plen > 0) { | 145 | while (plen > 0) { |
@@ -163,10 +163,8 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
163 | if (np == NULL) | 163 | if (np == NULL) |
164 | np = of_find_node_by_type(NULL, "cache"); | 164 | np = of_find_node_by_type(NULL, "cache"); |
165 | if (np != NULL) { | 165 | if (np != NULL) { |
166 | unsigned int *ic = (unsigned int *) | 166 | const unsigned int *ic = get_property(np, "i-cache-size", NULL); |
167 | get_property(np, "i-cache-size", NULL); | 167 | const unsigned int *dc = get_property(np, "d-cache-size", NULL); |
168 | unsigned int *dc = (unsigned int *) | ||
169 | get_property(np, "d-cache-size", NULL); | ||
170 | seq_printf(m, "L2 cache\t:"); | 168 | seq_printf(m, "L2 cache\t:"); |
171 | has_l2cache = 1; | 169 | has_l2cache = 1; |
172 | if (get_property(np, "cache-unified", NULL) != 0 && dc) { | 170 | if (get_property(np, "cache-unified", NULL) != 0 && dc) { |
@@ -254,7 +252,7 @@ static void __init l2cr_init(void) | |||
254 | if (np == 0) | 252 | if (np == 0) |
255 | np = find_type_devices("cpu"); | 253 | np = find_type_devices("cpu"); |
256 | if (np != 0) { | 254 | if (np != 0) { |
257 | unsigned int *l2cr = (unsigned int *) | 255 | const unsigned int *l2cr = |
258 | get_property(np, "l2cr-value", NULL); | 256 | get_property(np, "l2cr-value", NULL); |
259 | if (l2cr != 0) { | 257 | if (l2cr != 0) { |
260 | ppc_override_l2cr = 1; | 258 | ppc_override_l2cr = 1; |
@@ -277,7 +275,7 @@ static void __init l2cr_init(void) | |||
277 | static void __init pmac_setup_arch(void) | 275 | static void __init pmac_setup_arch(void) |
278 | { | 276 | { |
279 | struct device_node *cpu, *ic; | 277 | struct device_node *cpu, *ic; |
280 | int *fp; | 278 | const int *fp; |
281 | unsigned long pvr; | 279 | unsigned long pvr; |
282 | 280 | ||
283 | pvr = PVR_VER(mfspr(SPRN_PVR)); | 281 | pvr = PVR_VER(mfspr(SPRN_PVR)); |
@@ -287,7 +285,7 @@ static void __init pmac_setup_arch(void) | |||
287 | loops_per_jiffy = 50000000 / HZ; | 285 | loops_per_jiffy = 50000000 / HZ; |
288 | cpu = of_find_node_by_type(NULL, "cpu"); | 286 | cpu = of_find_node_by_type(NULL, "cpu"); |
289 | if (cpu != NULL) { | 287 | if (cpu != NULL) { |
290 | fp = (int *) get_property(cpu, "clock-frequency", NULL); | 288 | fp = get_property(cpu, "clock-frequency", NULL); |
291 | if (fp != NULL) { | 289 | if (fp != NULL) { |
292 | if (pvr >= 0x30 && pvr < 0x80) | 290 | if (pvr >= 0x30 && pvr < 0x80) |
293 | /* PPC970 etc. */ | 291 | /* PPC970 etc. */ |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index 827b7121ffb8..653eeb64d1e2 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -548,7 +548,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) | |||
548 | struct device_node *cc = NULL; | 548 | struct device_node *cc = NULL; |
549 | struct device_node *p; | 549 | struct device_node *p; |
550 | const char *name = NULL; | 550 | const char *name = NULL; |
551 | u32 *reg; | 551 | const u32 *reg; |
552 | int ok; | 552 | int ok; |
553 | 553 | ||
554 | /* Look for the clock chip */ | 554 | /* Look for the clock chip */ |
@@ -562,7 +562,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) | |||
562 | pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); | 562 | pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); |
563 | if (pmac_tb_clock_chip_host == NULL) | 563 | if (pmac_tb_clock_chip_host == NULL) |
564 | continue; | 564 | continue; |
565 | reg = (u32 *)get_property(cc, "reg", NULL); | 565 | reg = get_property(cc, "reg", NULL); |
566 | if (reg == NULL) | 566 | if (reg == NULL) |
567 | continue; | 567 | continue; |
568 | switch (*reg) { | 568 | switch (*reg) { |
@@ -707,8 +707,7 @@ static void __init smp_core99_setup(int ncpus) | |||
707 | core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ | 707 | core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ |
708 | cpu = of_find_node_by_type(NULL, "cpu"); | 708 | cpu = of_find_node_by_type(NULL, "cpu"); |
709 | if (cpu != NULL) { | 709 | if (cpu != NULL) { |
710 | tbprop = (u32 *)get_property(cpu, "timebase-enable", | 710 | tbprop = get_property(cpu, "timebase-enable", NULL); |
711 | NULL); | ||
712 | if (tbprop) | 711 | if (tbprop) |
713 | core99_tb_gpio = *tbprop; | 712 | core99_tb_gpio = *tbprop; |
714 | of_node_put(cpu); | 713 | of_node_put(cpu); |
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c index 37e5b1eff911..ce1a235855f7 100644 --- a/arch/powerpc/platforms/powermac/udbg_scc.c +++ b/arch/powerpc/platforms/powermac/udbg_scc.c | |||
@@ -68,11 +68,11 @@ static unsigned char scc_inittab[] = { | |||
68 | 68 | ||
69 | void udbg_scc_init(int force_scc) | 69 | void udbg_scc_init(int force_scc) |
70 | { | 70 | { |
71 | u32 *reg; | 71 | const u32 *reg; |
72 | unsigned long addr; | 72 | unsigned long addr; |
73 | struct device_node *stdout = NULL, *escc = NULL, *macio = NULL; | 73 | struct device_node *stdout = NULL, *escc = NULL, *macio = NULL; |
74 | struct device_node *ch, *ch_def = NULL, *ch_a = NULL; | 74 | struct device_node *ch, *ch_def = NULL, *ch_a = NULL; |
75 | char *path; | 75 | const char *path; |
76 | int i, x; | 76 | int i, x; |
77 | 77 | ||
78 | escc = of_find_node_by_name(NULL, "escc"); | 78 | escc = of_find_node_by_name(NULL, "escc"); |
@@ -81,7 +81,7 @@ void udbg_scc_init(int force_scc) | |||
81 | macio = of_get_parent(escc); | 81 | macio = of_get_parent(escc); |
82 | if (macio == NULL) | 82 | if (macio == NULL) |
83 | goto bail; | 83 | goto bail; |
84 | path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 84 | path = get_property(of_chosen, "linux,stdout-path", NULL); |
85 | if (path != NULL) | 85 | if (path != NULL) |
86 | stdout = of_find_node_by_path(path); | 86 | stdout = of_find_node_by_path(path); |
87 | for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { | 87 | for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { |
@@ -96,13 +96,13 @@ void udbg_scc_init(int force_scc) | |||
96 | ch = ch_def ? ch_def : ch_a; | 96 | ch = ch_def ? ch_def : ch_a; |
97 | 97 | ||
98 | /* Get address within mac-io ASIC */ | 98 | /* Get address within mac-io ASIC */ |
99 | reg = (u32 *)get_property(escc, "reg", NULL); | 99 | reg = get_property(escc, "reg", NULL); |
100 | if (reg == NULL) | 100 | if (reg == NULL) |
101 | goto bail; | 101 | goto bail; |
102 | addr = reg[0]; | 102 | addr = reg[0]; |
103 | 103 | ||
104 | /* Get address of mac-io PCI itself */ | 104 | /* Get address of mac-io PCI itself */ |
105 | reg = (u32 *)get_property(macio, "assigned-addresses", NULL); | 105 | reg = get_property(macio, "assigned-addresses", NULL); |
106 | if (reg == NULL) | 106 | if (reg == NULL) |
107 | goto bail; | 107 | goto bail; |
108 | addr += reg[2]; | 108 | addr += reg[2]; |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 2a0b3be7cdd0..e8a6de5a1517 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -209,7 +209,8 @@ static int i2c_powermac_probe(struct device *dev) | |||
209 | struct pmac_i2c_bus *bus = dev->platform_data; | 209 | struct pmac_i2c_bus *bus = dev->platform_data; |
210 | struct device_node *parent = NULL; | 210 | struct device_node *parent = NULL; |
211 | struct i2c_adapter *adapter; | 211 | struct i2c_adapter *adapter; |
212 | char name[32], *basename; | 212 | char name[32]; |
213 | const char *basename; | ||
213 | int rc; | 214 | int rc; |
214 | 215 | ||
215 | if (bus == NULL) | 216 | if (bus == NULL) |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index ebf961f1718d..fa46856e8068 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1154,7 +1154,7 @@ static int | |||
1154 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | 1154 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) |
1155 | { | 1155 | { |
1156 | struct device_node *np = pmif->node; | 1156 | struct device_node *np = pmif->node; |
1157 | int *bidp; | 1157 | const int *bidp; |
1158 | 1158 | ||
1159 | pmif->cable_80 = 0; | 1159 | pmif->cable_80 = 0; |
1160 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1160 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
@@ -1176,14 +1176,14 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1176 | pmif->broken_dma = 1; | 1176 | pmif->broken_dma = 1; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | bidp = (int *)get_property(np, "AAPL,bus-id", NULL); | 1179 | bidp = get_property(np, "AAPL,bus-id", NULL); |
1180 | pmif->aapl_bus_id = bidp ? *bidp : 0; | 1180 | pmif->aapl_bus_id = bidp ? *bidp : 0; |
1181 | 1181 | ||
1182 | /* Get cable type from device-tree */ | 1182 | /* Get cable type from device-tree */ |
1183 | if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 | 1183 | if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 |
1184 | || pmif->kind == controller_k2_ata6 | 1184 | || pmif->kind == controller_k2_ata6 |
1185 | || pmif->kind == controller_sh_ata6) { | 1185 | || pmif->kind == controller_sh_ata6) { |
1186 | char* cable = get_property(np, "cable-type", NULL); | 1186 | const char* cable = get_property(np, "cable-type", NULL); |
1187 | if (cable && !strncmp(cable, "80-", 3)) | 1187 | if (cable && !strncmp(cable, "80-", 3)) |
1188 | pmif->cable_80 = 1; | 1188 | pmif->cable_80 = 1; |
1189 | } | 1189 | } |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 80c0c665b5f6..7817cf286d0c 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -139,7 +139,9 @@ static int macio_uevent(struct device *dev, char **envp, int num_envp, | |||
139 | { | 139 | { |
140 | struct macio_dev * macio_dev; | 140 | struct macio_dev * macio_dev; |
141 | struct of_device * of; | 141 | struct of_device * of; |
142 | char *scratch, *compat, *compat2; | 142 | char *scratch; |
143 | const char *compat, *compat2; | ||
144 | |||
143 | int i = 0; | 145 | int i = 0; |
144 | int length, cplen, cplen2, seen = 0; | 146 | int length, cplen, cplen2, seen = 0; |
145 | 147 | ||
@@ -173,7 +175,7 @@ static int macio_uevent(struct device *dev, char **envp, int num_envp, | |||
173 | * it's not really legal to split it out with commas. We split it | 175 | * it's not really legal to split it out with commas. We split it |
174 | * up using a number of environment variables instead. */ | 176 | * up using a number of environment variables instead. */ |
175 | 177 | ||
176 | compat = (char *) get_property(of->node, "compatible", &cplen); | 178 | compat = get_property(of->node, "compatible", &cplen); |
177 | compat2 = compat; | 179 | compat2 = compat; |
178 | cplen2= cplen; | 180 | cplen2= cplen; |
179 | while (compat && cplen > 0) { | 181 | while (compat && cplen > 0) { |
@@ -454,7 +456,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, | |||
454 | struct resource *parent_res) | 456 | struct resource *parent_res) |
455 | { | 457 | { |
456 | struct macio_dev *dev; | 458 | struct macio_dev *dev; |
457 | u32 *reg; | 459 | const u32 *reg; |
458 | 460 | ||
459 | if (np == NULL) | 461 | if (np == NULL) |
460 | return NULL; | 462 | return NULL; |
@@ -489,7 +491,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, | |||
489 | #endif | 491 | #endif |
490 | MAX_NODE_NAME_SIZE, np->name); | 492 | MAX_NODE_NAME_SIZE, np->name); |
491 | } else { | 493 | } else { |
492 | reg = (u32 *)get_property(np, "reg", NULL); | 494 | reg = get_property(np, "reg", NULL); |
493 | sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", | 495 | sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", |
494 | chip->lbus.index, | 496 | chip->lbus.index, |
495 | reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); | 497 | reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index cae24a13526a..8566bdfdd4b8 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -16,12 +16,12 @@ static ssize_t | |||
16 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | 16 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) |
17 | { | 17 | { |
18 | struct of_device *of; | 18 | struct of_device *of; |
19 | char *compat; | 19 | const char *compat; |
20 | int cplen; | 20 | int cplen; |
21 | int length = 0; | 21 | int length = 0; |
22 | 22 | ||
23 | of = &to_macio_device (dev)->ofdev; | 23 | of = &to_macio_device (dev)->ofdev; |
24 | compat = (char *) get_property(of->node, "compatible", &cplen); | 24 | compat = get_property(of->node, "compatible", &cplen); |
25 | if (!compat) { | 25 | if (!compat) { |
26 | *buf = '\0'; | 26 | *buf = '\0'; |
27 | return 0; | 27 | return 0; |
@@ -42,12 +42,12 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | |||
42 | char *buf) | 42 | char *buf) |
43 | { | 43 | { |
44 | struct of_device *of; | 44 | struct of_device *of; |
45 | char *compat; | 45 | const char *compat; |
46 | int cplen; | 46 | int cplen; |
47 | int length; | 47 | int length; |
48 | 48 | ||
49 | of = &to_macio_device (dev)->ofdev; | 49 | of = &to_macio_device (dev)->ofdev; |
50 | compat = (char *) get_property (of->node, "compatible", &cplen); | 50 | compat = get_property(of->node, "compatible", &cplen); |
51 | if (!compat) compat = "", cplen = 1; | 51 | if (!compat) compat = "", cplen = 1; |
52 | length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); | 52 | length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); |
53 | buf += length; | 53 | buf += length; |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index f139a74696fe..6f358600536e 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -447,7 +447,7 @@ EXPORT_SYMBOL(smu_present); | |||
447 | int __init smu_init (void) | 447 | int __init smu_init (void) |
448 | { | 448 | { |
449 | struct device_node *np; | 449 | struct device_node *np; |
450 | u32 *data; | 450 | const u32 *data; |
451 | 451 | ||
452 | np = of_find_node_by_type(NULL, "smu"); | 452 | np = of_find_node_by_type(NULL, "smu"); |
453 | if (np == NULL) | 453 | if (np == NULL) |
@@ -483,7 +483,7 @@ int __init smu_init (void) | |||
483 | printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); | 483 | printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); |
484 | goto fail; | 484 | goto fail; |
485 | } | 485 | } |
486 | data = (u32 *)get_property(np, "reg", NULL); | 486 | data = get_property(np, "reg", NULL); |
487 | if (data == NULL) { | 487 | if (data == NULL) { |
488 | of_node_put(np); | 488 | of_node_put(np); |
489 | printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); | 489 | printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); |
@@ -506,7 +506,7 @@ int __init smu_init (void) | |||
506 | np = of_find_node_by_name(NULL, "smu-interrupt"); | 506 | np = of_find_node_by_name(NULL, "smu-interrupt"); |
507 | if (np == NULL) | 507 | if (np == NULL) |
508 | break; | 508 | break; |
509 | data = (u32 *)get_property(np, "reg", NULL); | 509 | data = get_property(np, "reg", NULL); |
510 | if (data == NULL) { | 510 | if (data == NULL) { |
511 | of_node_put(np); | 511 | of_node_put(np); |
512 | break; | 512 | break; |
@@ -959,11 +959,11 @@ static struct smu_sdbp_header *smu_create_sdb_partition(int id) | |||
959 | /* Note: Only allowed to return error code in pointers (using ERR_PTR) | 959 | /* Note: Only allowed to return error code in pointers (using ERR_PTR) |
960 | * when interruptible is 1 | 960 | * when interruptible is 1 |
961 | */ | 961 | */ |
962 | struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | 962 | const struct smu_sdbp_header *__smu_get_sdb_partition(int id, |
963 | int interruptible) | 963 | unsigned int *size, int interruptible) |
964 | { | 964 | { |
965 | char pname[32]; | 965 | char pname[32]; |
966 | struct smu_sdbp_header *part; | 966 | const struct smu_sdbp_header *part; |
967 | 967 | ||
968 | if (!smu) | 968 | if (!smu) |
969 | return NULL; | 969 | return NULL; |
@@ -980,8 +980,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | |||
980 | } else | 980 | } else |
981 | mutex_lock(&smu_part_access); | 981 | mutex_lock(&smu_part_access); |
982 | 982 | ||
983 | part = (struct smu_sdbp_header *)get_property(smu->of_node, | 983 | part = get_property(smu->of_node, pname, size); |
984 | pname, size); | ||
985 | if (part == NULL) { | 984 | if (part == NULL) { |
986 | DPRINTK("trying to extract from SMU ...\n"); | 985 | DPRINTK("trying to extract from SMU ...\n"); |
987 | part = smu_create_sdb_partition(id); | 986 | part = smu_create_sdb_partition(id); |
@@ -992,7 +991,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | |||
992 | return part; | 991 | return part; |
993 | } | 992 | } |
994 | 993 | ||
995 | struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) | 994 | const struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) |
996 | { | 995 | { |
997 | return __smu_get_sdb_partition(id, size, 0); | 996 | return __smu_get_sdb_partition(id, size, 0); |
998 | } | 997 | } |
@@ -1071,7 +1070,7 @@ static ssize_t smu_write(struct file *file, const char __user *buf, | |||
1071 | pp->mode = smu_file_events; | 1070 | pp->mode = smu_file_events; |
1072 | return 0; | 1071 | return 0; |
1073 | } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) { | 1072 | } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) { |
1074 | struct smu_sdbp_header *part; | 1073 | const struct smu_sdbp_header *part; |
1075 | part = __smu_get_sdb_partition(hdr.cmd, NULL, 1); | 1074 | part = __smu_get_sdb_partition(hdr.cmd, NULL, 1); |
1076 | if (part == NULL) | 1075 | if (part == NULL) |
1077 | return -EINVAL; | 1076 | return -EINVAL; |
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 7f86478bdd36..a0f30d0853ea 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -47,7 +47,7 @@ static u8 FAN_SPD_SET[2] = {0x30, 0x31}; | |||
47 | 47 | ||
48 | static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ | 48 | static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ |
49 | static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ | 49 | static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ |
50 | static char *sensor_location[3] = {NULL, NULL, NULL}; | 50 | static const char *sensor_location[3] = {NULL, NULL, NULL}; |
51 | 51 | ||
52 | static int limit_adjust = 0; | 52 | static int limit_adjust = 0; |
53 | static int fan_speed = -1; | 53 | static int fan_speed = -1; |
@@ -553,7 +553,7 @@ static int __init | |||
553 | thermostat_init(void) | 553 | thermostat_init(void) |
554 | { | 554 | { |
555 | struct device_node* np; | 555 | struct device_node* np; |
556 | u32 *prop; | 556 | const u32 *prop; |
557 | int i = 0, offset = 0; | 557 | int i = 0, offset = 0; |
558 | 558 | ||
559 | np = of_find_node_by_name(NULL, "fan"); | 559 | np = of_find_node_by_name(NULL, "fan"); |
@@ -566,13 +566,13 @@ thermostat_init(void) | |||
566 | else | 566 | else |
567 | return -ENODEV; | 567 | return -ENODEV; |
568 | 568 | ||
569 | prop = (u32 *)get_property(np, "hwsensor-params-version", NULL); | 569 | prop = get_property(np, "hwsensor-params-version", NULL); |
570 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, | 570 | printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, |
571 | (*prop == 1)?"":"un"); | 571 | (*prop == 1)?"":"un"); |
572 | if (*prop != 1) | 572 | if (*prop != 1) |
573 | return -ENODEV; | 573 | return -ENODEV; |
574 | 574 | ||
575 | prop = (u32 *)get_property(np, "reg", NULL); | 575 | prop = get_property(np, "reg", NULL); |
576 | if (!prop) | 576 | if (!prop) |
577 | return -ENODEV; | 577 | return -ENODEV; |
578 | 578 | ||
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 20bf67244e2c..d00c0c37a12e 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -660,7 +660,7 @@ static int read_eeprom(int cpu, struct mpu_data *out) | |||
660 | { | 660 | { |
661 | struct device_node *np; | 661 | struct device_node *np; |
662 | char nodename[64]; | 662 | char nodename[64]; |
663 | u8 *data; | 663 | const u8 *data; |
664 | int len; | 664 | int len; |
665 | 665 | ||
666 | /* prom.c routine for finding a node by path is a bit brain dead | 666 | /* prom.c routine for finding a node by path is a bit brain dead |
@@ -673,7 +673,7 @@ static int read_eeprom(int cpu, struct mpu_data *out) | |||
673 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n"); | 673 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n"); |
674 | return -ENODEV; | 674 | return -ENODEV; |
675 | } | 675 | } |
676 | data = (u8 *)get_property(np, "cpuid", &len); | 676 | data = get_property(np, "cpuid", &len); |
677 | if (data == NULL) { | 677 | if (data == NULL) { |
678 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n"); | 678 | printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n"); |
679 | of_node_put(np); | 679 | of_node_put(np); |
@@ -1336,7 +1336,7 @@ static int init_backside_state(struct backside_pid_state *state) | |||
1336 | */ | 1336 | */ |
1337 | u3 = of_find_node_by_path("/u3@0,f8000000"); | 1337 | u3 = of_find_node_by_path("/u3@0,f8000000"); |
1338 | if (u3 != NULL) { | 1338 | if (u3 != NULL) { |
1339 | u32 *vers = (u32 *)get_property(u3, "device-rev", NULL); | 1339 | const u32 *vers = get_property(u3, "device-rev", NULL); |
1340 | if (vers) | 1340 | if (vers) |
1341 | if (((*vers) & 0x3f) < 0x34) | 1341 | if (((*vers) & 0x3f) < 0x34) |
1342 | u3h = 0; | 1342 | u3h = 0; |
@@ -2111,8 +2111,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
2111 | 2111 | ||
2112 | while ((np = of_get_next_child(fcu_node, np)) != NULL) { | 2112 | while ((np = of_get_next_child(fcu_node, np)) != NULL) { |
2113 | int type = -1; | 2113 | int type = -1; |
2114 | char *loc; | 2114 | const char *loc; |
2115 | u32 *reg; | 2115 | const u32 *reg; |
2116 | 2116 | ||
2117 | DBG(" control: %s, type: %s\n", np->name, np->type); | 2117 | DBG(" control: %s, type: %s\n", np->name, np->type); |
2118 | 2118 | ||
@@ -2128,8 +2128,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
2128 | continue; | 2128 | continue; |
2129 | 2129 | ||
2130 | /* Lookup for a matching location */ | 2130 | /* Lookup for a matching location */ |
2131 | loc = (char *)get_property(np, "location", NULL); | 2131 | loc = get_property(np, "location", NULL); |
2132 | reg = (u32 *)get_property(np, "reg", NULL); | 2132 | reg = get_property(np, "reg", NULL); |
2133 | if (loc == NULL || reg == NULL) | 2133 | if (loc == NULL || reg == NULL) |
2134 | continue; | 2134 | continue; |
2135 | DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg); | 2135 | DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg); |
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index c7d1c290cb0c..738faab1b22c 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
@@ -484,14 +484,14 @@ struct apple_thermal_info { | |||
484 | static int __init | 484 | static int __init |
485 | g4fan_init( void ) | 485 | g4fan_init( void ) |
486 | { | 486 | { |
487 | struct apple_thermal_info *info; | 487 | const struct apple_thermal_info *info; |
488 | struct device_node *np; | 488 | struct device_node *np; |
489 | 489 | ||
490 | init_MUTEX( &x.lock ); | 490 | init_MUTEX( &x.lock ); |
491 | 491 | ||
492 | if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) | 492 | if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) |
493 | return -ENODEV; | 493 | return -ENODEV; |
494 | info = (struct apple_thermal_info*)get_property(np, "thermal-info", NULL); | 494 | info = get_property(np, "thermal-info", NULL); |
495 | of_node_put(np); | 495 | of_node_put(np); |
496 | 496 | ||
497 | if( !info || !machine_is_compatible("PowerMac3,6") ) | 497 | if( !info || !machine_is_compatible("PowerMac3,6") ) |
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index 69d5452fd22f..7512d1c15207 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c | |||
@@ -123,7 +123,7 @@ int __init find_via_cuda(void) | |||
123 | { | 123 | { |
124 | struct adb_request req; | 124 | struct adb_request req; |
125 | phys_addr_t taddr; | 125 | phys_addr_t taddr; |
126 | u32 *reg; | 126 | const u32 *reg; |
127 | int err; | 127 | int err; |
128 | 128 | ||
129 | if (vias != 0) | 129 | if (vias != 0) |
@@ -132,7 +132,7 @@ int __init find_via_cuda(void) | |||
132 | if (vias == 0) | 132 | if (vias == 0) |
133 | return 0; | 133 | return 0; |
134 | 134 | ||
135 | reg = (u32 *)get_property(vias, "reg", NULL); | 135 | reg = get_property(vias, "reg", NULL); |
136 | if (reg == NULL) { | 136 | if (reg == NULL) { |
137 | printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); | 137 | printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); |
138 | goto fail; | 138 | goto fail; |
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c index 5189d5454b1f..179af10105d9 100644 --- a/drivers/macintosh/via-pmu-led.c +++ b/drivers/macintosh/via-pmu-led.c | |||
@@ -120,7 +120,7 @@ static int __init via_pmu_led_init(void) | |||
120 | dt = of_find_node_by_path("/"); | 120 | dt = of_find_node_by_path("/"); |
121 | if (dt == NULL) | 121 | if (dt == NULL) |
122 | return -ENODEV; | 122 | return -ENODEV; |
123 | model = (const char *)get_property(dt, "model", NULL); | 123 | model = get_property(dt, "model", NULL); |
124 | if (model == NULL) | 124 | if (model == NULL) |
125 | return -ENODEV; | 125 | return -ENODEV; |
126 | if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && | 126 | if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 06ca80bfd6b9..80e88b4a1d07 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -287,7 +287,7 @@ static char *pbook_type[] = { | |||
287 | int __init find_via_pmu(void) | 287 | int __init find_via_pmu(void) |
288 | { | 288 | { |
289 | u64 taddr; | 289 | u64 taddr; |
290 | u32 *reg; | 290 | const u32 *reg; |
291 | 291 | ||
292 | if (via != 0) | 292 | if (via != 0) |
293 | return 1; | 293 | return 1; |
@@ -295,7 +295,7 @@ int __init find_via_pmu(void) | |||
295 | if (vias == NULL) | 295 | if (vias == NULL) |
296 | return 0; | 296 | return 0; |
297 | 297 | ||
298 | reg = (u32 *)get_property(vias, "reg", NULL); | 298 | reg = get_property(vias, "reg", NULL); |
299 | if (reg == NULL) { | 299 | if (reg == NULL) { |
300 | printk(KERN_ERR "via-pmu: No \"reg\" property !\n"); | 300 | printk(KERN_ERR "via-pmu: No \"reg\" property !\n"); |
301 | goto fail; | 301 | goto fail; |
@@ -337,7 +337,7 @@ int __init find_via_pmu(void) | |||
337 | 337 | ||
338 | gpiop = of_find_node_by_name(NULL, "gpio"); | 338 | gpiop = of_find_node_by_name(NULL, "gpio"); |
339 | if (gpiop) { | 339 | if (gpiop) { |
340 | reg = (u32 *)get_property(gpiop, "reg", NULL); | 340 | reg = get_property(gpiop, "reg", NULL); |
341 | if (reg) | 341 | if (reg) |
342 | gaddr = of_translate_address(gpiop, reg); | 342 | gaddr = of_translate_address(gpiop, reg); |
343 | if (gaddr != OF_BAD_ADDR) | 343 | if (gaddr != OF_BAD_ADDR) |
@@ -486,9 +486,9 @@ static int __init via_pmu_dev_init(void) | |||
486 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; | 486 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; |
487 | } else { | 487 | } else { |
488 | struct device_node* prim = find_devices("power-mgt"); | 488 | struct device_node* prim = find_devices("power-mgt"); |
489 | u32 *prim_info = NULL; | 489 | const u32 *prim_info = NULL; |
490 | if (prim) | 490 | if (prim) |
491 | prim_info = (u32 *)get_property(prim, "prim-info", NULL); | 491 | prim_info = get_property(prim, "prim-info", NULL); |
492 | if (prim_info) { | 492 | if (prim_info) { |
493 | /* Other stuffs here yet unknown */ | 493 | /* Other stuffs here yet unknown */ |
494 | pmu_battery_count = (prim_info[6] >> 16) & 0xff; | 494 | pmu_battery_count = (prim_info[6] >> 16) & 0xff; |
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c index f1df6efcbe68..2ff546e4c92f 100644 --- a/drivers/macintosh/windfarm_pm81.c +++ b/drivers/macintosh/windfarm_pm81.c | |||
@@ -396,7 +396,7 @@ static void wf_smu_sys_fans_tick(struct wf_smu_sys_fans_state *st) | |||
396 | static void wf_smu_create_cpu_fans(void) | 396 | static void wf_smu_create_cpu_fans(void) |
397 | { | 397 | { |
398 | struct wf_cpu_pid_param pid_param; | 398 | struct wf_cpu_pid_param pid_param; |
399 | struct smu_sdbp_header *hdr; | 399 | const struct smu_sdbp_header *hdr; |
400 | struct smu_sdbp_cpupiddata *piddata; | 400 | struct smu_sdbp_cpupiddata *piddata; |
401 | struct smu_sdbp_fvt *fvt; | 401 | struct smu_sdbp_fvt *fvt; |
402 | s32 tmax, tdelta, maxpow, powadj; | 402 | s32 tmax, tdelta, maxpow, powadj; |
@@ -702,7 +702,7 @@ static struct notifier_block wf_smu_events = { | |||
702 | 702 | ||
703 | static int wf_init_pm(void) | 703 | static int wf_init_pm(void) |
704 | { | 704 | { |
705 | struct smu_sdbp_header *hdr; | 705 | const struct smu_sdbp_header *hdr; |
706 | 706 | ||
707 | hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL); | 707 | hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL); |
708 | if (hdr != 0) { | 708 | if (hdr != 0) { |
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c index 0d6372e96d32..59e9ffe37c39 100644 --- a/drivers/macintosh/windfarm_pm91.c +++ b/drivers/macintosh/windfarm_pm91.c | |||
@@ -144,7 +144,7 @@ static struct wf_smu_slots_fans_state *wf_smu_slots_fans; | |||
144 | static void wf_smu_create_cpu_fans(void) | 144 | static void wf_smu_create_cpu_fans(void) |
145 | { | 145 | { |
146 | struct wf_cpu_pid_param pid_param; | 146 | struct wf_cpu_pid_param pid_param; |
147 | struct smu_sdbp_header *hdr; | 147 | const struct smu_sdbp_header *hdr; |
148 | struct smu_sdbp_cpupiddata *piddata; | 148 | struct smu_sdbp_cpupiddata *piddata; |
149 | struct smu_sdbp_fvt *fvt; | 149 | struct smu_sdbp_fvt *fvt; |
150 | s32 tmax, tdelta, maxpow, powadj; | 150 | s32 tmax, tdelta, maxpow, powadj; |
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c index a9e88edc0c72..bff1f372f188 100644 --- a/drivers/macintosh/windfarm_smu_controls.c +++ b/drivers/macintosh/windfarm_smu_controls.c | |||
@@ -159,14 +159,15 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, | |||
159 | int pwm_fan) | 159 | int pwm_fan) |
160 | { | 160 | { |
161 | struct smu_fan_control *fct; | 161 | struct smu_fan_control *fct; |
162 | s32 *v; u32 *reg; | 162 | const s32 *v; |
163 | char *l; | 163 | const u32 *reg; |
164 | const char *l; | ||
164 | 165 | ||
165 | fct = kmalloc(sizeof(struct smu_fan_control), GFP_KERNEL); | 166 | fct = kmalloc(sizeof(struct smu_fan_control), GFP_KERNEL); |
166 | if (fct == NULL) | 167 | if (fct == NULL) |
167 | return NULL; | 168 | return NULL; |
168 | fct->ctrl.ops = &smu_fan_ops; | 169 | fct->ctrl.ops = &smu_fan_ops; |
169 | l = (char *)get_property(node, "location", NULL); | 170 | l = get_property(node, "location", NULL); |
170 | if (l == NULL) | 171 | if (l == NULL) |
171 | goto fail; | 172 | goto fail; |
172 | 173 | ||
@@ -223,17 +224,17 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, | |||
223 | goto fail; | 224 | goto fail; |
224 | 225 | ||
225 | /* Get min & max values*/ | 226 | /* Get min & max values*/ |
226 | v = (s32 *)get_property(node, "min-value", NULL); | 227 | v = get_property(node, "min-value", NULL); |
227 | if (v == NULL) | 228 | if (v == NULL) |
228 | goto fail; | 229 | goto fail; |
229 | fct->min = *v; | 230 | fct->min = *v; |
230 | v = (s32 *)get_property(node, "max-value", NULL); | 231 | v = get_property(node, "max-value", NULL); |
231 | if (v == NULL) | 232 | if (v == NULL) |
232 | goto fail; | 233 | goto fail; |
233 | fct->max = *v; | 234 | fct->max = *v; |
234 | 235 | ||
235 | /* Get "reg" value */ | 236 | /* Get "reg" value */ |
236 | reg = (u32 *)get_property(node, "reg", NULL); | 237 | reg = get_property(node, "reg", NULL); |
237 | if (reg == NULL) | 238 | if (reg == NULL) |
238 | goto fail; | 239 | goto fail; |
239 | fct->reg = *reg; | 240 | fct->reg = *reg; |
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c index e295a07a1ebc..aceb61d9fbc8 100644 --- a/drivers/macintosh/windfarm_smu_sat.c +++ b/drivers/macintosh/windfarm_smu_sat.c | |||
@@ -233,15 +233,15 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) | |||
233 | { | 233 | { |
234 | struct wf_sat *sat; | 234 | struct wf_sat *sat; |
235 | struct wf_sat_sensor *sens; | 235 | struct wf_sat_sensor *sens; |
236 | u32 *reg; | 236 | const u32 *reg; |
237 | char *loc, *type; | 237 | const char *loc, *type; |
238 | u8 addr, chip, core; | 238 | u8 addr, chip, core; |
239 | struct device_node *child; | 239 | struct device_node *child; |
240 | int shift, cpu, index; | 240 | int shift, cpu, index; |
241 | char *name; | 241 | char *name; |
242 | int vsens[2], isens[2]; | 242 | int vsens[2], isens[2]; |
243 | 243 | ||
244 | reg = (u32 *) get_property(dev, "reg", NULL); | 244 | reg = get_property(dev, "reg", NULL); |
245 | if (reg == NULL) | 245 | if (reg == NULL) |
246 | return; | 246 | return; |
247 | addr = *reg; | 247 | addr = *reg; |
@@ -268,7 +268,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) | |||
268 | isens[0] = isens[1] = -1; | 268 | isens[0] = isens[1] = -1; |
269 | child = NULL; | 269 | child = NULL; |
270 | while ((child = of_get_next_child(dev, child)) != NULL) { | 270 | while ((child = of_get_next_child(dev, child)) != NULL) { |
271 | reg = (u32 *) get_property(child, "reg", NULL); | 271 | reg = get_property(child, "reg", NULL); |
272 | type = get_property(child, "device_type", NULL); | 272 | type = get_property(child, "device_type", NULL); |
273 | loc = get_property(child, "location", NULL); | 273 | loc = get_property(child, "location", NULL); |
274 | if (reg == NULL || loc == NULL) | 274 | if (reg == NULL || loc == NULL) |
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c index bed25dcf8a1e..defe9922ebd1 100644 --- a/drivers/macintosh/windfarm_smu_sensors.c +++ b/drivers/macintosh/windfarm_smu_sensors.c | |||
@@ -198,14 +198,14 @@ static struct wf_sensor_ops smu_slotspow_ops = { | |||
198 | static struct smu_ad_sensor *smu_ads_create(struct device_node *node) | 198 | static struct smu_ad_sensor *smu_ads_create(struct device_node *node) |
199 | { | 199 | { |
200 | struct smu_ad_sensor *ads; | 200 | struct smu_ad_sensor *ads; |
201 | char *c, *l; | 201 | const char *c, *l; |
202 | u32 *v; | 202 | const u32 *v; |
203 | 203 | ||
204 | ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL); | 204 | ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL); |
205 | if (ads == NULL) | 205 | if (ads == NULL) |
206 | return NULL; | 206 | return NULL; |
207 | c = (char *)get_property(node, "device_type", NULL); | 207 | c = get_property(node, "device_type", NULL); |
208 | l = (char *)get_property(node, "location", NULL); | 208 | l = get_property(node, "location", NULL); |
209 | if (c == NULL || l == NULL) | 209 | if (c == NULL || l == NULL) |
210 | goto fail; | 210 | goto fail; |
211 | 211 | ||
@@ -255,7 +255,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node) | |||
255 | } else | 255 | } else |
256 | goto fail; | 256 | goto fail; |
257 | 257 | ||
258 | v = (u32 *)get_property(node, "reg", NULL); | 258 | v = get_property(node, "reg", NULL); |
259 | if (v == NULL) | 259 | if (v == NULL) |
260 | goto fail; | 260 | goto fail; |
261 | ads->reg = *v; | 261 | ads->reg = *v; |
@@ -382,7 +382,7 @@ smu_cpu_power_create(struct wf_sensor *volts, struct wf_sensor *amps) | |||
382 | 382 | ||
383 | static void smu_fetch_param_partitions(void) | 383 | static void smu_fetch_param_partitions(void) |
384 | { | 384 | { |
385 | struct smu_sdbp_header *hdr; | 385 | const struct smu_sdbp_header *hdr; |
386 | 386 | ||
387 | /* Get CPU voltage/current/power calibration data */ | 387 | /* Get CPU voltage/current/power calibration data */ |
388 | hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); | 388 | hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index bfd2a22759eb..a3b99caf80e6 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -1400,8 +1400,8 @@ static struct uart_ops pmz_pops = { | |||
1400 | static int __init pmz_init_port(struct uart_pmac_port *uap) | 1400 | static int __init pmz_init_port(struct uart_pmac_port *uap) |
1401 | { | 1401 | { |
1402 | struct device_node *np = uap->node; | 1402 | struct device_node *np = uap->node; |
1403 | char *conn; | 1403 | const char *conn; |
1404 | struct slot_names_prop { | 1404 | const struct slot_names_prop { |
1405 | int count; | 1405 | int count; |
1406 | char name[1]; | 1406 | char name[1]; |
1407 | } *slots; | 1407 | } *slots; |
@@ -1458,7 +1458,7 @@ no_dma: | |||
1458 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; | 1458 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; |
1459 | uap->port_type = PMAC_SCC_ASYNC; | 1459 | uap->port_type = PMAC_SCC_ASYNC; |
1460 | /* 1999 Powerbook G3 has slot-names property instead */ | 1460 | /* 1999 Powerbook G3 has slot-names property instead */ |
1461 | slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); | 1461 | slots = get_property(np, "slot-names", &len); |
1462 | if (slots && slots->count > 0) { | 1462 | if (slots && slots->count > 0) { |
1463 | if (strcmp(slots->name, "IrDA") == 0) | 1463 | if (strcmp(slots->name, "IrDA") == 0) |
1464 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; | 1464 | uap->flags |= PMACZILOG_FLAG_IS_IRDA; |
@@ -1470,7 +1470,8 @@ no_dma: | |||
1470 | if (ZS_IS_INTMODEM(uap)) { | 1470 | if (ZS_IS_INTMODEM(uap)) { |
1471 | struct device_node* i2c_modem = find_devices("i2c-modem"); | 1471 | struct device_node* i2c_modem = find_devices("i2c-modem"); |
1472 | if (i2c_modem) { | 1472 | if (i2c_modem) { |
1473 | char* mid = get_property(i2c_modem, "modem-id", NULL); | 1473 | const char* mid = |
1474 | get_property(i2c_modem, "modem-id", NULL); | ||
1474 | if (mid) switch(*mid) { | 1475 | if (mid) switch(*mid) { |
1475 | case 0x04 : | 1476 | case 0x04 : |
1476 | case 0x05 : | 1477 | case 0x05 : |
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h index 51e65fc46a03..e49f644ca63a 100644 --- a/include/asm-powerpc/smu.h +++ b/include/asm-powerpc/smu.h | |||
@@ -517,7 +517,7 @@ struct smu_sdbp_cpupiddata { | |||
517 | * This returns the pointer to an SMU "sdb" partition data or NULL | 517 | * This returns the pointer to an SMU "sdb" partition data or NULL |
518 | * if not found. The data format is described below | 518 | * if not found. The data format is described below |
519 | */ | 519 | */ |
520 | extern struct smu_sdbp_header *smu_get_sdb_partition(int id, | 520 | extern const struct smu_sdbp_header *smu_get_sdb_partition(int id, |
521 | unsigned int *size); | 521 | unsigned int *size); |
522 | 522 | ||
523 | /* Get "sdb" partition data from an SMU satellite */ | 523 | /* Get "sdb" partition data from an SMU satellite */ |