summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2010-06-27 19:42:58 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2010-06-27 19:42:58 +0000
commit2a99fa8128542ee18a60fff78ea1946e00a752ef (patch)
treee4bec1d387c2d297c702f6c97f3fba3d4b7eac73
parenteadc91278c85d705bc3551b8fdce00ece9ac8172 (diff)
Add _acpi_matchhids routine, precursor to pci device match
-rw-r--r--sys/dev/acpi/acpi.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 74660fb8061..85bebdb54da 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.159 2010/06/27 17:04:27 mlarkin Exp $ */
+/* $OpenBSD: acpi.c,v 1.160 2010/06/27 19:42:57 jordan Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -93,6 +93,8 @@ void acpi_init_pm(struct acpi_softc *);
int acpi_foundide(struct aml_node *node, void *arg);
int acpiide_notify(struct aml_node *, int, void *);
+int _acpi_matchhids(const char *, const char *[]);
+
void wdcattach(struct channel_softc *);
int wdcdetach(struct channel_softc *, int);
@@ -2290,18 +2292,26 @@ acpi_foundec(struct aml_node *node, void *arg)
}
int
+_acpi_matchhids(const char *hid, const char *hids[])
+{
+ int i;
+
+ for (i = 0; hids[i]; i++)
+ if (!strcmp(hid, hids[i]))
+ return (1);
+ return (0);
+}
+
+int
acpi_matchhids(struct acpi_attach_args *aa, const char *hids[],
const char *driver)
{
- int i;
if (aa->aaa_dev == NULL || aa->aaa_node == NULL)
return (0);
- for (i = 0; hids[i]; i++) {
- if (!strcmp(aa->aaa_dev, hids[i])) {
- dnprintf(5, "driver %s matches %s\n", driver, hids[i]);
- return (1);
- }
+ if (_acpi_matchhids(aa->aaa_dev, hids)) {
+ dnprintf(5, "driver %s matches %s\n", driver, hids[i]);
+ return (1);
}
return (0);
}