mempolicy: ERR_PTR dereference in mpol_shared_policy_init()
[safe/jmp/linux-2.6] / drivers / macintosh / windfarm_smu_controls.c
index bff1f37..43137b4 100644 (file)
@@ -56,7 +56,7 @@ static int smu_set_fan(int pwm, u8 id, u16 value)
 {
        struct smu_cmd cmd;
        u8 buffer[16];
-       DECLARE_COMPLETION(comp);
+       DECLARE_COMPLETION_ONSTACK(comp);
        int rc;
 
        /* Fill SMU command structure */
@@ -167,12 +167,13 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
        if (fct == NULL)
                return NULL;
        fct->ctrl.ops = &smu_fan_ops;
-       l = get_property(node, "location", NULL);
+       l = of_get_property(node, "location", NULL);
        if (l == NULL)
                goto fail;
 
        fct->fan_type = pwm_fan;
        fct->ctrl.type = pwm_fan ? WF_CONTROL_PWM_FAN : WF_CONTROL_RPM_FAN;
+       sysfs_attr_init(&fct->ctrl.attr.attr);
 
        /* We use the name & location here the same way we do for SMU sensors,
         * see the comment in windfarm_smu_sensors.c. The locations are a bit
@@ -202,6 +203,8 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
                fct->ctrl.name = "cpu-front-fan-1";
        else if (!strcmp(l, "CPU A PUMP"))
                fct->ctrl.name = "cpu-pump-0";
+       else if (!strcmp(l, "CPU B PUMP"))
+               fct->ctrl.name = "cpu-pump-1";
        else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") ||
                 !strcmp(l, "EXPANSION SLOTS INTAKE"))
                fct->ctrl.name = "slots-fan";
@@ -218,23 +221,27 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
                fct->ctrl.name = "cpu-fan";
        else if (!strcmp(l, "Hard Drive") || !strcmp(l, "Hard drive"))
                fct->ctrl.name = "drive-bay-fan";
+       else if (!strcmp(l, "HDD Fan")) /* seen on iMac G5 iSight */
+               fct->ctrl.name = "hard-drive-fan";
+       else if (!strcmp(l, "ODD Fan")) /* same */
+               fct->ctrl.name = "optical-drive-fan";
 
        /* Unrecognized fan, bail out */
        if (fct->ctrl.name == NULL)
                goto fail;
 
        /* Get min & max values*/
-       v = get_property(node, "min-value", NULL);
+       v = of_get_property(node, "min-value", NULL);
        if (v == NULL)
                goto fail;
        fct->min = *v;
-       v = get_property(node, "max-value", NULL);
+       v = of_get_property(node, "max-value", NULL);
        if (v == NULL)
                goto fail;
        fct->max = *v;
 
        /* Get "reg" value */
-       reg = get_property(node, "reg", NULL);
+       reg = of_get_property(node, "reg", NULL);
        if (reg == NULL)
                goto fail;
        fct->reg = *reg;
@@ -263,7 +270,7 @@ static int __init smu_controls_init(void)
        /* Look for RPM fans */
        for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;)
                if (!strcmp(fans->name, "rpm-fans") ||
-                   device_is_compatible(fans, "smu-rpm-fans"))
+                   of_device_is_compatible(fans, "smu-rpm-fans"))
                        break;
        for (fan = NULL;
             fans && (fan = of_get_next_child(fans, fan)) != NULL;) {