On 10/3/05, Benjamin Herrenschmidt <[email protected]> wrote:
> This is the actual thermal control support for PowerMac8,1, PowerMac8,2
> and PowerMac9,1 machines (SMU based), that is iMac G5 and single CPU desktop.
> It requires CPUFREQ to be enabled to properly deal with overtemp conditions.
> The new thermal control code implements a new framework (nicknamed "windfarm")
> to which I expect to port the old G5 thermal control, and possibly some of the
> powerbook thermal control drivers as well in the future.
<snip>
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/drivers/macintosh/windfarm_core.c 2005-10-04 15:17:33.000000000 +1000
<snip>
> +static int wf_thread_func(void *data)
> +{
> + unsigned long next, delay;
> +
> + next = jiffies;
> +
> + DBG("wf: thread started\n");
> +
> + while(!kthread_should_stop()) {
> + try_to_freeze();
> +
> + if (time_after_eq(jiffies, next)) {
> + wf_notify(WF_EVENT_TICK, NULL);
> + if (wf_overtemp) {
> + wf_overtemp_counter++;
> + /* 10 seconds overtemp, notify userland */
> + if (wf_overtemp_counter > 10)
> + wf_critical_overtemp();
> + /* 30 seconds, shutdown */
> + if (wf_overtemp_counter > 30) {
> + printk(KERN_ERR "windfarm: Overtemp "
> + "for more than 30"
> + " seconds, shutting down\n");
> + machine_power_off();
> + }
> + }
> + next += HZ;
> + }
> +
> + set_current_state(TASK_INTERRUPTIBLE);
> + delay = next - jiffies;
> + if (delay <= HZ)
> + schedule_timeout(delay);
> + set_current_state(TASK_RUNNING);
This can be schedule_timeout_interruptible(delay); and then you can
get rid of the set_current_state(TASK_RUNNING);
Thanks,
NIsh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]