From: David Woodhouse <dwmw2@infradead.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: "Étienne Bersac" <bersace03@gmail.com>,
linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] windfarm: add PowerMac 12,1 support
Date: Sat, 22 Mar 2008 23:31:13 +0000 [thread overview]
Message-ID: <1206228673.9540.115.camel@pmac.infradead.org> (raw)
In-Reply-To: <20080323102502.e0754062.sfr@canb.auug.org.au>
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
next prev parent reply other threads:[~2008-03-22 23:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-26 11:55 [PATCH] windfarm: add PowerMac 12,1 support Étienne Bersac
2008-03-22 19:35 ` David Woodhouse
2008-03-22 22:13 ` Benjamin Herrenschmidt
2008-03-22 23:02 ` David Woodhouse
2008-03-22 23:14 ` David Woodhouse
2008-03-22 23:25 ` Benjamin Herrenschmidt
2008-03-22 23:25 ` Stephen Rothwell
2008-03-22 23:31 ` David Woodhouse [this message]
2008-03-23 1:01 ` Andreas Schwab
2008-03-23 5:38 ` Stephen Rothwell
-- strict thread matches above, loose matches on Subject: below --
2008-04-29 5:39 Benjamin Herrenschmidt
2007-12-06 1:20 Étienne Bersac
2007-12-06 15:30 ` Étienne Bersac
2007-12-10 15:11 ` Étienne Bersac
2007-12-10 15:39 ` Arnd Bergmann
2007-12-10 17:17 ` Étienne Bersac
2007-12-10 17:22 ` Étienne Bersac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1206228673.9540.115.camel@pmac.infradead.org \
--to=dwmw2@infradead.org \
--cc=bersace03@gmail.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).