summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_button.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-06-29 19:02:27 +0000
committernjl <njl@FreeBSD.org>2004-06-29 19:02:27 +0000
commit72ad681e8442865d104086e9a6961818cc435085 (patch)
tree6f1a0ff9b933c25a9eb2bf967f62e708efe64c5f /sys/dev/acpica/acpi_button.c
parent2a43f50bb099f7154fa37e95153f1432d00c8667 (diff)
downloadFreeBSD-src-72ad681e8442865d104086e9a6961818cc435085.zip
FreeBSD-src-72ad681e8442865d104086e9a6961818cc435085.tar.gz
Use the acpi_id_probe() method instead of acpi_MatchHid(), which is now
static.
Diffstat (limited to 'sys/dev/acpica/acpi_button.c')
-rw-r--r--sys/dev/acpica/acpi_button.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c
index 4ea77db..17fe84a 100644
--- a/sys/dev/acpica/acpi_button.c
+++ b/sys/dev/acpica/acpi_button.c
@@ -64,6 +64,11 @@ static ACPI_STATUS
static void acpi_button_notify_sleep(void *arg);
static void acpi_button_notify_wakeup(void *arg);
+static char *btn_ids[] = {
+ "PNP0C0C", "ACPI_FPB", "PNP0C0E", "ACPI_FSB",
+ NULL
+};
+
static device_method_t acpi_button_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, acpi_button_probe),
@@ -89,34 +94,31 @@ MODULE_DEPEND(acpi_button, acpi, 1, 1, 1);
static int
acpi_button_probe(device_t dev)
{
- struct acpi_button_softc *sc;
- ACPI_HANDLE h;
- int ret = ENXIO;
+ struct acpi_button_softc *sc;
+ char *str;
+
+ if (acpi_disabled("button") ||
+ (str = ACPI_ID_PROBE(device_get_parent(dev), dev, btn_ids)) == NULL)
+ return (ENXIO);
- h = acpi_get_handle(dev);
sc = device_get_softc(dev);
- if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("button")) {
- if (acpi_MatchHid(h, "PNP0C0C")) {
- device_set_desc(dev, "Power Button");
- sc->button_type = ACPI_POWER_BUTTON;
- ret = 0;
- } else if (acpi_MatchHid(h, "ACPI_FPB")) {
- device_set_desc(dev, "Power Button (fixed)");
- sc->button_type = ACPI_POWER_BUTTON;
- sc->fixed = 1;
- ret = 0;
- } else if (acpi_MatchHid(h, "PNP0C0E")) {
- device_set_desc(dev, "Sleep Button");
- sc->button_type = ACPI_SLEEP_BUTTON;
- ret = 0;
- } else if (acpi_MatchHid(h, "ACPI_FSB")) {
- device_set_desc(dev, "Sleep Button (fixed)");
- sc->button_type = ACPI_SLEEP_BUTTON;
- sc->fixed = 1;
- ret = 0;
- }
+ if (strcmp(str, "PNP0C0C") == 0) {
+ device_set_desc(dev, "Power Button");
+ sc->button_type = ACPI_POWER_BUTTON;
+ } else if (strcmp(str, "ACPI_FPB") == 0) {
+ device_set_desc(dev, "Power Button (fixed)");
+ sc->button_type = ACPI_POWER_BUTTON;
+ sc->fixed = 1;
+ } else if (strcmp(str, "PNP0C0E") == 0) {
+ device_set_desc(dev, "Sleep Button");
+ sc->button_type = ACPI_SLEEP_BUTTON;
+ } else if (strcmp(str, "ACPI_FSB") == 0) {
+ device_set_desc(dev, "Sleep Button (fixed)");
+ sc->button_type = ACPI_SLEEP_BUTTON;
+ sc->fixed = 1;
}
- return (ret);
+
+ return (0);
}
static int
OpenPOWER on IntegriCloud