diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2001-06-24 02:39:08 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2001-06-24 02:39:08 +0000 |
commit | 4127c8a65926144ea34c530e54ceba7b329bec88 (patch) | |
tree | 0a4e7afcec0b3648bbed1cce98584e9b4a619293 /sys | |
parent | 15e02533aaf6825758a4c50aca693adaeb3d3c84 (diff) | |
download | FreeBSD-src-4127c8a65926144ea34c530e54ceba7b329bec88.zip FreeBSD-src-4127c8a65926144ea34c530e54ceba7b329bec88.tar.gz |
Reset timestamps of battery info. and status by thier notify handler.
Suggested by: takawata
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/acpica/acpi_cmbat.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c index 5a714a8..25ba9a6 100644 --- a/sys/dev/acpica/acpi_cmbat.c +++ b/sys/dev/acpica/acpi_cmbat.c @@ -132,6 +132,10 @@ acpi_cmbat_info_expired(struct timespec *lastupdated) return (1); } + if (!timespecisset(lastupdated)) { + return (1); + } + getnanotime(&curtime); timespecsub(&curtime, lastupdated); return ((curtime.tv_sec < 0 || curtime.tv_sec > BATTERY_INFO_EXPIRE)); @@ -277,22 +281,21 @@ end: static void acpi_cmbat_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) { + device_t dev; + struct acpi_cmbat_softc *sc; + + dev = (device_t)context; + if ((sc = device_get_softc(dev)) == NULL) { + return; + } switch (notify) { -#if 0 - /* XXX - * AML method execution is somewhat heavy even using swi. - * better to disable them until we fix the problem. - */ case ACPI_BATTERY_BST_CHANGE: - AcpiOsQueueForExecution(OSD_PRIORITY_LO, - acpi_cmbat_get_bst, context); + timespecclear(&sc->bst_lastupdated); break; case ACPI_BATTERY_BIF_CHANGE: - AcpiOsQueueForExecution(OSD_PRIORITY_LO, - acpi_cmbat_get_bif, context); + timespecclear(&sc->bif_lastupdated); break; -#endif default: break; } |