diff options
author | njl <njl@FreeBSD.org> | 2003-08-15 02:17:23 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2003-08-15 02:17:23 +0000 |
commit | 7b44cdc0742ef8f74717dde69fb8db8211fff173 (patch) | |
tree | cdbfe75fa56588341cb87882c592b78943a9a491 /sys/dev/acpica/acpi_acad.c | |
parent | a387b17a37a60983898b652a3a2635ea7da4400d (diff) | |
download | FreeBSD-src-7b44cdc0742ef8f74717dde69fb8db8211fff173.zip FreeBSD-src-7b44cdc0742ef8f74717dde69fb8db8211fff173.tar.gz |
Don't install a system notify handler. Move the device notify handler
installation to just before we're ready to handle events. Make a loop
more readable (no functional change).
Diffstat (limited to 'sys/dev/acpica/acpi_acad.c')
-rw-r--r-- | sys/dev/acpica/acpi_acad.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c index bc3ea38..9370fdb 100644 --- a/sys/dev/acpica/acpi_acad.c +++ b/sys/dev/acpica/acpi_acad.c @@ -151,15 +151,10 @@ acpi_acad_attach(device_t dev) ACPI_HANDLE handle; int error; - handle = acpi_get_handle(dev); - AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY, - acpi_acad_notify_handler, dev); - /* XXX Installing system notify is not so good */ - AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, - acpi_acad_notify_handler, dev); - - if ((sc = device_get_softc(dev)) == NULL) + sc = device_get_softc(dev); + if (sc == NULL) return (ENXIO); + handle = acpi_get_handle(dev); error = acpi_register_ioctl(ACPIIO_ACAD_GET_STATUS, acpi_acad_ioctl, dev); if (error != 0) @@ -177,6 +172,8 @@ acpi_acad_attach(device_t dev) sc->status = -1; sc->initializing = 0; + AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY, + acpi_acad_notify_handler, dev); AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_acad_init_acline, dev); return (0); @@ -189,8 +186,9 @@ acpi_acad_ioctl(u_long cmd, caddr_t addr, void *arg) device_t dev; dev = (device_t)arg; - if ((sc = device_get_softc(dev)) == NULL) - return(ENXIO); + sc = device_get_softc(dev); + if (sc == NULL) + return (ENXIO); /* * No security check required: information retrieval only. If @@ -238,15 +236,16 @@ acpi_acad_init_acline(void *arg) "acline initialization start\n"); status = 0; - for (retry = 0; retry < ACPI_ACAD_RETRY_MAX; retry++, AcpiOsSleep(10, 0)) { + for (retry = 0; retry < ACPI_ACAD_RETRY_MAX; retry++) { acpi_acad_get_status(dev); if (status != sc->status) break; + AcpiOsSleep(10, 0); } sc->initializing = 0; ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), - "acline initialization done, tried %d times\n", retry+1); + "acline initialization done, tried %d times\n", retry + 1); } /* |