Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Add a detachment routine.
details: https://anonhg.NetBSD.org/src/rev/f086655f37b7
branches: trunk
changeset: 751321:f086655f37b7
user: jruoho <jruoho%NetBSD.org@localhost>
date: Sun Jan 31 19:49:29 2010 +0000
description:
Add a detachment routine.
diffstat:
sys/dev/acpi/dalb_acpi.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diffs (60 lines):
diff -r 759fe37933ad -r f086655f37b7 sys/dev/acpi/dalb_acpi.c
--- a/sys/dev/acpi/dalb_acpi.c Sun Jan 31 18:51:33 2010 +0000
+++ b/sys/dev/acpi/dalb_acpi.c Sun Jan 31 19:49:29 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dalb_acpi.c,v 1.5 2010/01/08 20:40:41 dyoung Exp $ */
+/* $NetBSD: dalb_acpi.c,v 1.6 2010/01/31 19:49:29 jruoho Exp $ */
/*-
* Copyright (c) 2008 Christoph Egger <cegger%netbsd.org@localhost>
@@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dalb_acpi.c,v 1.5 2010/01/08 20:40:41 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dalb_acpi.c,v 1.6 2010/01/31 19:49:29 jruoho Exp $");
/*
* Direct Application Launch Button:
@@ -68,6 +68,7 @@
static int acpi_dalb_match(device_t, cfdata_t, void *);
static void acpi_dalb_attach(device_t, device_t, void *);
+static int acpi_dalb_detach(device_t, int);
static void acpi_dalb_notify_handler(ACPI_HANDLE, UINT32, void *);
static bool acpi_dalb_resume(device_t, pmf_qual_t);
@@ -75,7 +76,7 @@
static void acpi_dalb_get_runtime_hotkeys(void *opaque);
CFATTACH_DECL_NEW(acpidalb, sizeof(struct acpi_dalb_softc),
- acpi_dalb_match, acpi_dalb_attach, NULL, NULL);
+ acpi_dalb_match, acpi_dalb_attach, acpi_dalb_detach, NULL);
static const char * const acpi_dalb_ids[] = {
"PNP0C32", /* Direct Application Launch Button */
@@ -190,6 +191,24 @@
aprint_error_dev(self, "couldn't establish power handler\n");
}
+static int
+acpi_dalb_detach(device_t self, int flags)
+{
+ struct acpi_dalb_softc *sc = device_private(self);
+ ACPI_STATUS rv;
+
+ rv = AcpiRemoveNotifyHandler(sc->sc_node->ad_handle,
+ ACPI_ALL_NOTIFY, acpi_dalb_notify_handler);
+
+ if (ACPI_FAILURE(rv))
+ return EBUSY;
+
+ pmf_device_deregister(self);
+ sysmon_pswitch_unregister(&sc->sc_smpsw);
+
+ return 0;
+}
+
static void
acpi_dalb_notify_handler(ACPI_HANDLE hdl, UINT32 notify, void *opaque)
{
Home |
Main Index |
Thread Index |
Old Index