diff options
| author | xtraeme <xtraeme@NetBSD.org> | 2007-10-11 16:51:48 +0000 |
|---|---|---|
| committer | xtraeme <xtraeme@NetBSD.org> | 2007-10-11 16:51:48 +0000 |
| commit | 752d116414873c8300a799e708ec8b762e7b94b5 (patch) | |
| tree | 19ed3caddc73c67ef33f53466339d3d5a24ebaa0 /sys/dev/sysmon | |
| parent | b96c4fd9a6fa84bb246b213f53f53740a1ba9e7b (diff) | |
Check for the low power condition only when a new battery state sensor
changed its state, there's no need to check this in all cases.
Diffstat (limited to 'sys/dev/sysmon')
| -rw-r--r-- | sys/dev/sysmon/sysmon_envsys_events.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sys/dev/sysmon/sysmon_envsys_events.c b/sys/dev/sysmon/sysmon_envsys_events.c index a451b203daa..a8b4c9deb6b 100644 --- a/sys/dev/sysmon/sysmon_envsys_events.c +++ b/sys/dev/sysmon/sysmon_envsys_events.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys_events.c,v 1.38 2007/10/10 23:25:39 xtraeme Exp $ */ +/* $NetBSD: sysmon_envsys_events.c,v 1.39 2007/10/11 16:51:48 xtraeme Exp $ */ /*- * Copyright (c) 2007 Juan Romero Pardines. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.38 2007/10/10 23:25:39 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.39 2007/10/11 16:51:48 xtraeme Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -531,19 +531,6 @@ do { \ sysmon_penvsys_event(&see->pes, (type)); \ } while (/* CONSTCOND */ 0) - /* - * Check if the system is running in low power and send the - * event to powerd (if running) or shutdown the system otherwise. - */ - if (!sysmon_low_power && sme_event_check_low_power()) { - struct penvsys_state pes; - - pes.pes_type = PENVSYS_TYPE_BATTERY; - sysmon_penvsys_event(&pes, PENVSYS_EVENT_LOW_POWER); - sysmon_low_power = true; - callout_stop(&seeco); - goto out; - } switch (see->type) { /* @@ -632,6 +619,20 @@ do { \ sysmon_penvsys_event(&see->pes, see->type); } + /* + * Check if the system is running in low power and send the + * event to powerd (if running) or shutdown the system + * otherwise. + */ + if (!sysmon_low_power && sme_event_check_low_power()) { + struct penvsys_state pes; + + pes.pes_type = PENVSYS_TYPE_BATTERY; + sysmon_penvsys_event(&pes, PENVSYS_EVENT_LOW_POWER); + sysmon_low_power = true; + callout_stop(&seeco); + } + break; } out: |
