summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjruoho <jruoho@NetBSD.org>2010-03-01 13:16:21 +0000
committerjruoho <jruoho@NetBSD.org>2010-03-01 13:16:21 +0000
commitda6a111dbe6500be9453a3d2ef5fd65fdf04b8cf (patch)
treed1428721ccaaf6467f87cd3c14b860864180ba12 /sys/dev
parent510a73e003d73cee5a9e0a1b287150f5f9477a4f (diff)
Destroy the callout(9) when detaching. Also evaluate the removal of the
notify handler before going to demolishing business.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/smbus_acpi.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/acpi/smbus_acpi.c b/sys/dev/acpi/smbus_acpi.c
index af4408dea39..9a2ad7dc199 100644
--- a/sys/dev/acpi/smbus_acpi.c
+++ b/sys/dev/acpi/smbus_acpi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: smbus_acpi.c,v 1.2 2010/03/01 05:37:37 jruoho Exp $ */
+/* $NetBSD: smbus_acpi.c,v 1.3 2010/03/01 13:16:21 jruoho Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbus_acpi.c,v 1.2 2010/03/01 05:37:37 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbus_acpi.c,v 1.3 2010/03/01 13:16:21 jruoho Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -274,18 +274,16 @@ acpi_smbus_detach(device_t self, int flags)
struct acpi_smbus_softc *sc = device_private(self);
ACPI_STATUS rv;
- pmf_device_deregister(self);
-
- callout_halt(&sc->sc_callout, NULL);
-
rv = AcpiRemoveNotifyHandler(sc->sc_devnode->ad_handle,
ACPI_DEVICE_NOTIFY, acpi_smbus_notify_handler);
- if (ACPI_FAILURE(rv)) {
- aprint_error_dev(self,
- "unable to deregister DEVICE NOTIFY handler: %s\n",
- AcpiFormatException(rv));
+
+ if (ACPI_FAILURE(rv))
return EBUSY;
- }
+
+ pmf_device_deregister(self);
+
+ callout_halt(&sc->sc_callout, NULL);
+ callout_destroy(&sc->sc_callout);
mutex_destroy(&sc->sc_i2c_mutex);