Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi/wmi add rescan support
details: https://anonhg.NetBSD.org/src/rev/ee74f7e933da
branches: trunk
changeset: 758174:ee74f7e933da
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Oct 24 15:07:20 2010 +0000
description:
add rescan support
diffstat:
sys/dev/acpi/wmi/wmi_acpi.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diffs (77 lines):
diff -r d542e17c41f3 -r ee74f7e933da sys/dev/acpi/wmi/wmi_acpi.c
--- a/sys/dev/acpi/wmi/wmi_acpi.c Sun Oct 24 13:34:27 2010 +0000
+++ b/sys/dev/acpi/wmi/wmi_acpi.c Sun Oct 24 15:07:20 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_acpi.c,v 1.7 2010/08/06 22:45:00 jruoho Exp $ */
+/* $NetBSD: wmi_acpi.c,v 1.8 2010/10/24 15:07:20 jmcneill Exp $ */
/*-
* Copyright (c) 2009, 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.7 2010/08/06 22:45:00 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.8 2010/10/24 15:07:20 jmcneill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -54,6 +54,8 @@
static int acpi_wmi_match(device_t, cfdata_t, void *);
static void acpi_wmi_attach(device_t, device_t, void *);
static int acpi_wmi_detach(device_t, int);
+static int acpi_wmi_rescan(device_t, const char *, const int *);
+static void acpi_wmi_childdet(device_t, device_t);
static int acpi_wmi_print(void *, const char *);
static bool acpi_wmi_init(struct acpi_wmi_softc *);
static bool acpi_wmi_add(struct acpi_wmi_softc *, ACPI_OBJECT *);
@@ -76,8 +78,9 @@
NULL
};
-CFATTACH_DECL_NEW(acpiwmi, sizeof(struct acpi_wmi_softc),
- acpi_wmi_match, acpi_wmi_attach, acpi_wmi_detach, NULL);
+CFATTACH_DECL2_NEW(acpiwmi, sizeof(struct acpi_wmi_softc),
+ acpi_wmi_match, acpi_wmi_attach, acpi_wmi_detach, NULL,
+ acpi_wmi_rescan, acpi_wmi_childdet);
static int
acpi_wmi_match(device_t parent, cfdata_t match, void *aux)
@@ -111,8 +114,7 @@
acpi_wmi_dump(sc);
acpi_wmi_event_add(sc);
- sc->sc_child = config_found_ia(self, "acpiwmibus",
- NULL, acpi_wmi_print);
+ acpi_wmi_rescan(self, NULL, NULL);
(void)pmf_device_register(self, acpi_wmi_suspend, acpi_wmi_resume);
}
@@ -134,6 +136,27 @@
}
static int
+acpi_wmi_rescan(device_t self, const char *ifattr, const int *locators)
+{
+ struct acpi_wmi_softc *sc = device_private(self);
+
+ if (ifattr_match(ifattr, "acpiwmibus") && sc->sc_child == NULL)
+ sc->sc_child = config_found_ia(self, "acpiwmibus",
+ NULL, acpi_wmi_print);
+
+ return 0;
+}
+
+static void
+acpi_wmi_childdet(device_t self, device_t child)
+{
+ struct acpi_wmi_softc *sc = device_private(self);
+
+ if (sc->sc_child == child)
+ sc->sc_child = NULL;
+}
+
+static int
acpi_wmi_print(void *aux, const char *pnp)
{
Home |
Main Index |
Thread Index |
Old Index