From 6a2110dbf8af8aa0f369d92bfaca3d40d98a3dcd Mon Sep 17 00:00:00 2001 From: njl Date: Tue, 29 Jun 2004 19:05:20 +0000 Subject: [PATCH] Update for acpi_id_probe() --- sys/dev/acpi_support/acpi_asus.c | 4 ++-- sys/dev/acpi_support/acpi_toshiba.c | 37 ++++++++++++----------------- sys/i386/acpica/acpi_asus.c | 4 ++-- sys/i386/acpica/acpi_toshiba.c | 37 ++++++++++++----------------- 4 files changed, 34 insertions(+), 48 deletions(-) diff --git a/sys/dev/acpi_support/acpi_asus.c b/sys/dev/acpi_support/acpi_asus.c index 10d97e48edd4..4f0b1f4c8af1 100644 --- a/sys/dev/acpi_support/acpi_asus.c +++ b/sys/dev/acpi_support/acpi_asus.c @@ -208,12 +208,12 @@ acpi_asus_probe(device_t dev) ACPI_BUFFER Buf; ACPI_OBJECT Arg, *Obj; ACPI_OBJECT_LIST Args; + static char *asus_ids[] = { "ATK0100", NULL }; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); if (!acpi_disabled("asus") && - acpi_get_type(dev) == ACPI_TYPE_DEVICE && - acpi_MatchHid(acpi_get_handle(dev), "ATK0100")) { + ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids)) { sc = device_get_softc(dev); sc->dev = dev; sc->handle = acpi_get_handle(dev); diff --git a/sys/dev/acpi_support/acpi_toshiba.c b/sys/dev/acpi_support/acpi_toshiba.c index bb7ce0bb9881..8c03c9797485 100644 --- a/sys/dev/acpi_support/acpi_toshiba.c +++ b/sys/dev/acpi_support/acpi_toshiba.c @@ -212,20 +212,15 @@ TUNABLE_INT("hw.acpi.toshiba.enable_fn_keys", &enable_fn_keys); static int acpi_toshiba_probe(device_t dev) { - ACPI_HANDLE h; - int ret = ENXIO; + static char *tosh_ids[] = { "TOS6200", "TOS6207", NULL }; - h = acpi_get_handle(dev); - if (!acpi_disabled("toshiba") && - acpi_get_type(dev) == ACPI_TYPE_DEVICE && - device_get_unit(dev) == 0 && - (acpi_MatchHid(h, "TOS6200") || - acpi_MatchHid(h, "TOS6207"))) { - device_set_desc(dev, "Toshiba HCI Extras"); - ret = 0; - } + if (acpi_disabled("toshiba") || + ACPI_ID_PROBE(device_get_parent(dev), dev, tosh_ids) == NULL || + device_get_unit(dev) != 0) + return (ENXIO); - return (ret); + device_set_desc(dev, "Toshiba HCI Extras"); + return (0); } static int @@ -524,18 +519,16 @@ acpi_toshiba_notify(ACPI_HANDLE h, UINT32 notify, void *context) static int acpi_toshiba_video_probe(device_t dev) { - int ret = ENXIO; + static char *vid_ids[] = { "TOS6201", NULL }; - if (!acpi_disabled("toshiba") && - acpi_get_type(dev) == ACPI_TYPE_DEVICE && - device_get_unit(dev) == 0 && - acpi_MatchHid(acpi_get_handle(dev), "TOS6201")) { - device_quiet(dev); - device_set_desc(dev, "Toshiba Video"); - ret = 0; - } + if (acpi_disabled("toshiba") || + ACPI_ID_PROBE(device_get_parent(dev), dev, vid_ids) == NULL || + device_get_unit(dev) != 0) + return (ENXIO); - return (ret); + device_quiet(dev); + device_set_desc(dev, "Toshiba Video"); + return (0); } static int diff --git a/sys/i386/acpica/acpi_asus.c b/sys/i386/acpica/acpi_asus.c index 10d97e48edd4..4f0b1f4c8af1 100644 --- a/sys/i386/acpica/acpi_asus.c +++ b/sys/i386/acpica/acpi_asus.c @@ -208,12 +208,12 @@ acpi_asus_probe(device_t dev) ACPI_BUFFER Buf; ACPI_OBJECT Arg, *Obj; ACPI_OBJECT_LIST Args; + static char *asus_ids[] = { "ATK0100", NULL }; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); if (!acpi_disabled("asus") && - acpi_get_type(dev) == ACPI_TYPE_DEVICE && - acpi_MatchHid(acpi_get_handle(dev), "ATK0100")) { + ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids)) { sc = device_get_softc(dev); sc->dev = dev; sc->handle = acpi_get_handle(dev); diff --git a/sys/i386/acpica/acpi_toshiba.c b/sys/i386/acpica/acpi_toshiba.c index bb7ce0bb9881..8c03c9797485 100644 --- a/sys/i386/acpica/acpi_toshiba.c +++ b/sys/i386/acpica/acpi_toshiba.c @@ -212,20 +212,15 @@ TUNABLE_INT("hw.acpi.toshiba.enable_fn_keys", &enable_fn_keys); static int acpi_toshiba_probe(device_t dev) { - ACPI_HANDLE h; - int ret = ENXIO; + static char *tosh_ids[] = { "TOS6200", "TOS6207", NULL }; - h = acpi_get_handle(dev); - if (!acpi_disabled("toshiba") && - acpi_get_type(dev) == ACPI_TYPE_DEVICE && - device_get_unit(dev) == 0 && - (acpi_MatchHid(h, "TOS6200") || - acpi_MatchHid(h, "TOS6207"))) { - device_set_desc(dev, "Toshiba HCI Extras"); - ret = 0; - } + if (acpi_disabled("toshiba") || + ACPI_ID_PROBE(device_get_parent(dev), dev, tosh_ids) == NULL || + device_get_unit(dev) != 0) + return (ENXIO); - return (ret); + device_set_desc(dev, "Toshiba HCI Extras"); + return (0); } static int @@ -524,18 +519,16 @@ acpi_toshiba_notify(ACPI_HANDLE h, UINT32 notify, void *context) static int acpi_toshiba_video_probe(device_t dev) { - int ret = ENXIO; + static char *vid_ids[] = { "TOS6201", NULL }; - if (!acpi_disabled("toshiba") && - acpi_get_type(dev) == ACPI_TYPE_DEVICE && - device_get_unit(dev) == 0 && - acpi_MatchHid(acpi_get_handle(dev), "TOS6201")) { - device_quiet(dev); - device_set_desc(dev, "Toshiba Video"); - ret = 0; - } + if (acpi_disabled("toshiba") || + ACPI_ID_PROBE(device_get_parent(dev), dev, vid_ids) == NULL || + device_get_unit(dev) != 0) + return (ENXIO); - return (ret); + device_quiet(dev); + device_set_desc(dev, "Toshiba Video"); + return (0); } static int