aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/macintosh/macio_asic.c4
-rw-r--r--drivers/macintosh/macio_sysfs.c18
-rw-r--r--drivers/macintosh/windfarm_fcu_controls.c8
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c9
-rw-r--r--drivers/macintosh/windfarm_smu_sensors.c13
5 files changed, 22 insertions, 30 deletions
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index 17d3bc917562..bc8418801224 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -220,8 +220,8 @@ static int macio_resource_quirks(struct device_node *np, struct resource *res,
220 return 1; 220 return 1;
221 221
222 /* Some older IDE resources have bogus sizes */ 222 /* Some older IDE resources have bogus sizes */
223 if (!(strcmp(np->name, "IDE") && strcmp(np->name, "ATA") && 223 if (!strcmp(np->name, "IDE") || !strcmp(np->name, "ATA") ||
224 strcmp(np->type, "ide") && strcmp(np->type, "ata"))) { 224 of_node_is_type(np, "ide") || of_node_is_type(np, "ata")) {
225 if (index == 0 && (res->end - res->start) > 0xfff) 225 if (index == 0 && (res->end - res->start) > 0xfff)
226 res->end = res->start + 0xfff; 226 res->end = res->start + 0xfff;
227 if (index == 1 && (res->end - res->start) > 0xff) 227 if (index == 1 && (res->end - res->start) > 0xff)
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index d2451e58acb9..27f5eefc508f 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -3,17 +3,6 @@
3#include <linux/stat.h> 3#include <linux/stat.h>
4#include <asm/macio.h> 4#include <asm/macio.h>
5 5
6
7#define macio_config_of_attr(field, format_string) \
8static ssize_t \
9field##_show (struct device *dev, struct device_attribute *attr, \
10 char *buf) \
11{ \
12 struct macio_dev *mdev = to_macio_device (dev); \
13 return sprintf (buf, format_string, mdev->ofdev.dev.of_node->field); \
14} \
15static DEVICE_ATTR_RO(field);
16
17static ssize_t 6static ssize_t
18compatible_show (struct device *dev, struct device_attribute *attr, char *buf) 7compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
19{ 8{
@@ -65,7 +54,12 @@ static ssize_t name_show(struct device *dev,
65} 54}
66static DEVICE_ATTR_RO(name); 55static DEVICE_ATTR_RO(name);
67 56
68macio_config_of_attr (type, "%s\n"); 57static ssize_t type_show(struct device *dev,
58 struct device_attribute *attr, char *buf)
59{
60 return sprintf(buf, "%s\n", of_node_get_device_type(dev->of_node));
61}
62static DEVICE_ATTR_RO(type);
69 63
70static struct attribute *macio_dev_attrs[] = { 64static struct attribute *macio_dev_attrs[] = {
71 &dev_attr_name.attr, 65 &dev_attr_name.attr,
diff --git a/drivers/macintosh/windfarm_fcu_controls.c b/drivers/macintosh/windfarm_fcu_controls.c
index 2b3ca628a650..629f19875d7f 100644
--- a/drivers/macintosh/windfarm_fcu_controls.c
+++ b/drivers/macintosh/windfarm_fcu_controls.c
@@ -439,11 +439,11 @@ static void wf_fcu_lookup_fans(struct wf_fcu_priv *pv)
439 DBG(" control: %pOFn, type: %s\n", np, of_node_get_device_type(np)); 439 DBG(" control: %pOFn, type: %s\n", np, of_node_get_device_type(np));
440 440
441 /* Detect control type */ 441 /* Detect control type */
442 if (!strcmp(np->type, "fan-rpm-control") || 442 if (of_node_is_type(np, "fan-rpm-control") ||
443 !strcmp(np->type, "fan-rpm")) 443 of_node_is_type(np, "fan-rpm"))
444 type = FCU_FAN_RPM; 444 type = FCU_FAN_RPM;
445 if (!strcmp(np->type, "fan-pwm-control") || 445 if (of_node_is_type(np, "fan-pwm-control") ||
446 !strcmp(np->type, "fan-pwm")) 446 of_node_is_type(np, "fan-pwm"))
447 type = FCU_FAN_PWM; 447 type = FCU_FAN_PWM;
448 /* Only care about fans for now */ 448 /* Only care about fans for now */
449 if (type == -1) 449 if (type == -1)
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index a0f61eb853c5..b4be718beba8 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -197,7 +197,7 @@ static int wf_sat_probe(struct i2c_client *client,
197 struct wf_sat *sat; 197 struct wf_sat *sat;
198 struct wf_sat_sensor *sens; 198 struct wf_sat_sensor *sens;
199 const u32 *reg; 199 const u32 *reg;
200 const char *loc, *type; 200 const char *loc;
201 u8 chip, core; 201 u8 chip, core;
202 struct device_node *child; 202 struct device_node *child;
203 int shift, cpu, index; 203 int shift, cpu, index;
@@ -220,7 +220,6 @@ static int wf_sat_probe(struct i2c_client *client,
220 child = NULL; 220 child = NULL;
221 while ((child = of_get_next_child(dev, child)) != NULL) { 221 while ((child = of_get_next_child(dev, child)) != NULL) {
222 reg = of_get_property(child, "reg", NULL); 222 reg = of_get_property(child, "reg", NULL);
223 type = of_get_property(child, "device_type", NULL);
224 loc = of_get_property(child, "location", NULL); 223 loc = of_get_property(child, "location", NULL);
225 if (reg == NULL || loc == NULL) 224 if (reg == NULL || loc == NULL)
226 continue; 225 continue;
@@ -249,15 +248,15 @@ static int wf_sat_probe(struct i2c_client *client,
249 continue; 248 continue;
250 } 249 }
251 250
252 if (strcmp(type, "voltage-sensor") == 0) { 251 if (of_node_is_type(child, "voltage-sensor")) {
253 name = "cpu-voltage"; 252 name = "cpu-voltage";
254 shift = 4; 253 shift = 4;
255 vsens[core] = index; 254 vsens[core] = index;
256 } else if (strcmp(type, "current-sensor") == 0) { 255 } else if (of_node_is_type(child, "current-sensor")) {
257 name = "cpu-current"; 256 name = "cpu-current";
258 shift = 8; 257 shift = 8;
259 isens[core] = index; 258 isens[core] = index;
260 } else if (strcmp(type, "temp-sensor") == 0) { 259 } else if (of_node_is_type(child, "temp-sensor")) {
261 name = "cpu-temp"; 260 name = "cpu-temp";
262 shift = 10; 261 shift = 10;
263 } else 262 } else
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c
index 172fd267dcf6..1ba86de93f92 100644
--- a/drivers/macintosh/windfarm_smu_sensors.c
+++ b/drivers/macintosh/windfarm_smu_sensors.c
@@ -197,15 +197,14 @@ static const struct wf_sensor_ops smu_slotspow_ops = {
197static struct smu_ad_sensor *smu_ads_create(struct device_node *node) 197static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
198{ 198{
199 struct smu_ad_sensor *ads; 199 struct smu_ad_sensor *ads;
200 const char *c, *l; 200 const char *l;
201 const u32 *v; 201 const u32 *v;
202 202
203 ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL); 203 ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL);
204 if (ads == NULL) 204 if (ads == NULL)
205 return NULL; 205 return NULL;
206 c = of_get_property(node, "device_type", NULL);
207 l = of_get_property(node, "location", NULL); 206 l = of_get_property(node, "location", NULL);
208 if (c == NULL || l == NULL) 207 if (l == NULL)
209 goto fail; 208 goto fail;
210 209
211 /* We currently pick the sensors based on the OF name and location 210 /* We currently pick the sensors based on the OF name and location
@@ -215,7 +214,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
215 * the names and locations consistents so I'll stick with the names 214 * the names and locations consistents so I'll stick with the names
216 * and locations for now. 215 * and locations for now.
217 */ 216 */
218 if (!strcmp(c, "temp-sensor") && 217 if (of_node_is_type(node, "temp-sensor") &&
219 !strcmp(l, "CPU T-Diode")) { 218 !strcmp(l, "CPU T-Diode")) {
220 ads->sens.ops = &smu_cputemp_ops; 219 ads->sens.ops = &smu_cputemp_ops;
221 ads->sens.name = "cpu-temp"; 220 ads->sens.name = "cpu-temp";
@@ -224,7 +223,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
224 SMU_SDB_CPUDIODE_ID); 223 SMU_SDB_CPUDIODE_ID);
225 goto fail; 224 goto fail;
226 } 225 }
227 } else if (!strcmp(c, "current-sensor") && 226 } else if (of_node_is_type(node, "current-sensor") &&
228 !strcmp(l, "CPU Current")) { 227 !strcmp(l, "CPU Current")) {
229 ads->sens.ops = &smu_cpuamp_ops; 228 ads->sens.ops = &smu_cpuamp_ops;
230 ads->sens.name = "cpu-current"; 229 ads->sens.name = "cpu-current";
@@ -233,7 +232,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
233 SMU_SDB_CPUVCP_ID); 232 SMU_SDB_CPUVCP_ID);
234 goto fail; 233 goto fail;
235 } 234 }
236 } else if (!strcmp(c, "voltage-sensor") && 235 } else if (of_node_is_type(node, "voltage-sensor") &&
237 !strcmp(l, "CPU Voltage")) { 236 !strcmp(l, "CPU Voltage")) {
238 ads->sens.ops = &smu_cpuvolt_ops; 237 ads->sens.ops = &smu_cpuvolt_ops;
239 ads->sens.name = "cpu-voltage"; 238 ads->sens.name = "cpu-voltage";
@@ -242,7 +241,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
242 SMU_SDB_CPUVCP_ID); 241 SMU_SDB_CPUVCP_ID);
243 goto fail; 242 goto fail;
244 } 243 }
245 } else if (!strcmp(c, "power-sensor") && 244 } else if (of_node_is_type(node, "power-sensor") &&
246 !strcmp(l, "Slots Power")) { 245 !strcmp(l, "Slots Power")) {
247 ads->sens.ops = &smu_slotspow_ops; 246 ads->sens.ops = &smu_slotspow_ops;
248 ads->sens.name = "slots-power"; 247 ads->sens.name = "slots-power";