[PATCH] windfarm: add PowerMac 12,1 support

David Woodhouse dwmw2 at infradead.org
Sun Mar 23 10:31:13 EST 2008


On Sun, 2008-03-23 at 10:25 +1100, Stephen Rothwell wrote:
> Why would you expect otherwise (from the C standard):
> 
> "Unlike the bitwise binary & operator, the && operator guarantees
> left-to-right evaluation; there is a sequence point after the evaluation
> of the first operand. If the first operand compares equal to 0, the
> second operand is not evaluated."

Because it's Saturday night, I wasn't expecting that construct there
(because it seems to require that the sensors/controls are detected in
the precise order that they're checked for, otherwise it'll never match
the ones which are found out of order), and mostly because I'm stupid.

This seems to fix it (note the change of the control names too):

--- drivers/macintosh/windfarm_pm121.c~	2008-03-22 19:13:22.000000000 +0000
+++ drivers/macintosh/windfarm_pm121.c	2008-03-22 23:23:44.000000000 +0000
@@ -867,7 +867,7 @@ static struct wf_control* pm121_register
 {
 	if (controls[id] == NULL && !strcmp(ct->name, match)) {
 		if (wf_get_control(ct) == 0)
-			controls[FAN_OD] = ct;
+			controls[id] = ct;
 	}
 	return controls[id];
 }
@@ -879,10 +879,10 @@ static void pm121_new_control(struct wf_
 	if (pm121_all_controls_ok)
 		return;
 
-	all = all && pm121_register_control(ct, "optical-driver-fan", FAN_OD);
-	all = all && pm121_register_control(ct, "hard-driver-fan", FAN_HD);
-	all = all && pm121_register_control(ct, "cpu-driver-fan", FAN_CPU);
-	all = all && pm121_register_control(ct, "cpufreq-clamp", CPUFREQ);
+	all = pm121_register_control(ct, "optical-drive-fan", FAN_OD) && all;
+	all = pm121_register_control(ct, "hard-drive-fan", FAN_HD) && all;
+	all = pm121_register_control(ct, "cpu-fan", FAN_CPU) && all;
+	all = pm121_register_control(ct, "cpufreq-clamp", CPUFREQ) && all;
 
 	if (all)
 		pm121_all_controls_ok = 1;
@@ -909,24 +909,24 @@ static void pm121_new_sensor(struct wf_s
 	if (pm121_all_sensors_ok)
 		return;
 
-	all = all && pm121_register_sensor(sr, "cpu-temp",
-					   &sensor_cpu_temp);
-	all = all && pm121_register_sensor(sr, "cpu-current",
-					   &sensor_cpu_current);
-	all = all && pm121_register_sensor(sr, "cpu-voltage",
-					   &sensor_cpu_voltage);
-	all = all && pm121_register_sensor(sr, "cpu-power",
-					   &sensor_cpu_power);
-	all = all && pm121_register_sensor(sr, "hard-drive-temp",
-					   &sensor_hard_drive_temp);
-	all = all && pm121_register_sensor(sr, "optical-drive-temp",
-					   &sensor_optical_drive_temp);
-	all = all && pm121_register_sensor(sr, "incoming-air-temp",
-					   &sensor_incoming_air_temp);
-	all = all && pm121_register_sensor(sr, "north-bridge-temp",
-					   &sensor_north_bridge_temp);
-	all = all && pm121_register_sensor(sr, "gpu-temp",
-					   &sensor_gpu_temp);
+	all = pm121_register_sensor(sr, "cpu-temp",
+				    &sensor_cpu_temp) && all;
+	all = pm121_register_sensor(sr, "cpu-current",
+				    &sensor_cpu_current) && all;
+	all = pm121_register_sensor(sr, "cpu-voltage",
+				    &sensor_cpu_voltage) && all;
+	all = pm121_register_sensor(sr, "cpu-power",
+				    &sensor_cpu_power) && all;
+	all = pm121_register_sensor(sr, "hard-drive-temp",
+				    &sensor_hard_drive_temp) && all;
+	all = pm121_register_sensor(sr, "optical-drive-temp",
+				    &sensor_optical_drive_temp) && all;
+	all = pm121_register_sensor(sr, "incoming-air-temp",
+				    &sensor_incoming_air_temp) && all;
+	all = pm121_register_sensor(sr, "north-bridge-temp",
+				    &sensor_north_bridge_temp) && all;
+	all = pm121_register_sensor(sr, "gpu-temp",
+				    &sensor_gpu_temp) && all;
 
 	if (all)
 		pm121_all_sensors_ok = 1;


-- 
dwmw2




More information about the Linuxppc-dev mailing list