macintosh: Use device_type helpers to access the node type
Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
15b680c474
commit
bf82d3758d
@@ -197,15 +197,14 @@ static const struct wf_sensor_ops smu_slotspow_ops = {
|
||||
static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
|
||||
{
|
||||
struct smu_ad_sensor *ads;
|
||||
const char *c, *l;
|
||||
const char *l;
|
||||
const u32 *v;
|
||||
|
||||
ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL);
|
||||
if (ads == NULL)
|
||||
return NULL;
|
||||
c = of_get_property(node, "device_type", NULL);
|
||||
l = of_get_property(node, "location", NULL);
|
||||
if (c == NULL || l == NULL)
|
||||
if (l == NULL)
|
||||
goto fail;
|
||||
|
||||
/* 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)
|
||||
* the names and locations consistents so I'll stick with the names
|
||||
* and locations for now.
|
||||
*/
|
||||
if (!strcmp(c, "temp-sensor") &&
|
||||
if (of_node_is_type(node, "temp-sensor") &&
|
||||
!strcmp(l, "CPU T-Diode")) {
|
||||
ads->sens.ops = &smu_cputemp_ops;
|
||||
ads->sens.name = "cpu-temp";
|
||||
@@ -224,7 +223,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
|
||||
SMU_SDB_CPUDIODE_ID);
|
||||
goto fail;
|
||||
}
|
||||
} else if (!strcmp(c, "current-sensor") &&
|
||||
} else if (of_node_is_type(node, "current-sensor") &&
|
||||
!strcmp(l, "CPU Current")) {
|
||||
ads->sens.ops = &smu_cpuamp_ops;
|
||||
ads->sens.name = "cpu-current";
|
||||
@@ -233,7 +232,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
|
||||
SMU_SDB_CPUVCP_ID);
|
||||
goto fail;
|
||||
}
|
||||
} else if (!strcmp(c, "voltage-sensor") &&
|
||||
} else if (of_node_is_type(node, "voltage-sensor") &&
|
||||
!strcmp(l, "CPU Voltage")) {
|
||||
ads->sens.ops = &smu_cpuvolt_ops;
|
||||
ads->sens.name = "cpu-voltage";
|
||||
@@ -242,7 +241,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
|
||||
SMU_SDB_CPUVCP_ID);
|
||||
goto fail;
|
||||
}
|
||||
} else if (!strcmp(c, "power-sensor") &&
|
||||
} else if (of_node_is_type(node, "power-sensor") &&
|
||||
!strcmp(l, "Slots Power")) {
|
||||
ads->sens.ops = &smu_slotspow_ops;
|
||||
ads->sens.name = "slots-power";
|
||||
|
Reference in New Issue
Block a user