aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2006-07-12 01:40:29 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-31 01:55:05 -0400
commit018a3d1db7cdb6127656c1622ee1d2302e16436d (patch)
tree5b6714fa9fcd1441f7c1b30e0391484c095925b6 /drivers/macintosh
parenteeb2b723ef5100fafa381d92eb70d83e98516a44 (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>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/macio_asic.c10
-rw-r--r--drivers/macintosh/macio_sysfs.c8
-rw-r--r--drivers/macintosh/smu.c19
-rw-r--r--drivers/macintosh/therm_adt746x.c8
-rw-r--r--drivers/macintosh/therm_pm72.c14
-rw-r--r--drivers/macintosh/therm_windtunnel.c4
-rw-r--r--drivers/macintosh/via-cuda.c4
-rw-r--r--drivers/macintosh/via-pmu-led.c2
-rw-r--r--drivers/macintosh/via-pmu.c10
-rw-r--r--drivers/macintosh/windfarm_pm81.c4
-rw-r--r--drivers/macintosh/windfarm_pm91.c2
-rw-r--r--drivers/macintosh/windfarm_smu_controls.c13
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c8
-rw-r--r--drivers/macintosh/windfarm_smu_sensors.c12
14 files changed, 60 insertions, 58 deletions
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
16compatible_show (struct device *dev, struct device_attribute *attr, char *buf) 16compatible_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);
447int __init smu_init (void) 447int __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 */
962struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, 962const 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
995struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) 994const 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
48static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ 48static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */
49static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ 49static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */
50static char *sensor_location[3] = {NULL, NULL, NULL}; 50static const char *sensor_location[3] = {NULL, NULL, NULL};
51 51
52static int limit_adjust = 0; 52static int limit_adjust = 0;
53static int fan_speed = -1; 53static int fan_speed = -1;
@@ -553,7 +553,7 @@ static int __init
553thermostat_init(void) 553thermostat_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 {
484static int __init 484static int __init
485g4fan_init( void ) 485g4fan_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[] = {
287int __init find_via_pmu(void) 287int __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)
396static void wf_smu_create_cpu_fans(void) 396static 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
703static int wf_init_pm(void) 703static 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;
144static void wf_smu_create_cpu_fans(void) 144static 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 = {
198static struct smu_ad_sensor *smu_ads_create(struct device_node *node) 198static 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
383static void smu_fetch_param_partitions(void) 383static 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);