diff options
author | jhb <jhb@FreeBSD.org> | 2013-04-29 18:54:31 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2013-04-29 18:54:31 +0000 |
commit | 60b12604e144fa117ef1c25fb4fe0181b589ad96 (patch) | |
tree | a0fefba460746c5776ab66afa70819911c2e3827 /sys/dev/acpi_support/acpi_hp.c | |
parent | ff2219e128048c33c241feda9bce2dfb31817458 (diff) | |
download | FreeBSD-src-60b12604e144fa117ef1c25fb4fe0181b589ad96.zip FreeBSD-src-60b12604e144fa117ef1c25fb4fe0181b589ad96.tar.gz |
Only cleanup CMI-related state on detach if the system supports CMI.
PR: kern/163268
MFC after: 1 week
Diffstat (limited to 'sys/dev/acpi_support/acpi_hp.c')
-rw-r--r-- | sys/dev/acpi_support/acpi_hp.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/dev/acpi_support/acpi_hp.c b/sys/dev/acpi_support/acpi_hp.c index c190166..deb01a4 100644 --- a/sys/dev/acpi_support/acpi_hp.c +++ b/sys/dev/acpi_support/acpi_hp.c @@ -574,28 +574,26 @@ acpi_hp_attach(device_t dev) static int acpi_hp_detach(device_t dev) { - int ret; + struct acpi_hp_softc *sc; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); - struct acpi_hp_softc *sc = device_get_softc(dev); - if (sc->has_cmi && sc->hpcmi_open_pid != 0) { - ret = EBUSY; - } - else { - if (sc->has_notify) { - ACPI_WMI_REMOVE_EVENT_HANDLER(dev, - ACPI_HP_WMI_EVENT_GUID); - } + sc = device_get_softc(dev); + if (sc->has_cmi && sc->hpcmi_open_pid != 0) + return (EBUSY); + + if (sc->has_notify) + ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID); + + if (sc->has_cmi) { if (sc->hpcmi_bufptr != -1) { sbuf_delete(&sc->hpcmi_sbuf); sc->hpcmi_bufptr = -1; } sc->hpcmi_open_pid = 0; destroy_dev(sc->hpcmi_dev_t); - ret = 0; } - return (ret); + return (0); } static int |