diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/acpi.c | 19 | ||||
-rw-r--r-- | sys/dev/acpi/acpiac.c | 10 | ||||
-rw-r--r-- | sys/dev/acpi/acpiasus.c | 11 | ||||
-rw-r--r-- | sys/dev/acpi/acpibat.c | 11 | ||||
-rw-r--r-- | sys/dev/acpi/acpibtn.c | 11 | ||||
-rw-r--r-- | sys/dev/acpi/acpiec.c | 10 | ||||
-rw-r--r-- | sys/dev/acpi/acpithinkpad.c | 8 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 4 |
8 files changed, 44 insertions, 40 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 485986ac7bf..9220ba14c92 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.125 2008/07/02 03:14:54 fgsch Exp $ */ +/* $OpenBSD: acpi.c,v 1.126 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -1954,6 +1954,23 @@ acpi_foundec(struct aml_node *node, void *arg) } 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); + } + } + return (0); +} + +int acpi_foundhid(struct aml_node *node, void *arg) { struct acpi_softc *sc = (struct acpi_softc *)arg; diff --git a/sys/dev/acpi/acpiac.c b/sys/dev/acpi/acpiac.c index 6554dfebe0b..9d846c9ba1f 100644 --- a/sys/dev/acpi/acpiac.c +++ b/sys/dev/acpi/acpiac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiac.c,v 1.25 2008/07/23 00:20:35 fgsch Exp $ */ +/* $OpenBSD: acpiac.c,v 1.26 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -45,6 +45,8 @@ struct cfdriver acpiac_cd = { NULL, "acpiac", DV_DULL }; +const char *acpiac_hids[] = { ACPI_DEV_AC, 0 }; + int acpiac_match(struct device *parent, void *match, void *aux) { @@ -52,11 +54,7 @@ acpiac_match(struct device *parent, void *match, void *aux) struct cfdata *cf = match; /* sanity */ - if (aa->aaa_name == NULL || - strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || - aa->aaa_table != NULL) - return (0); - return (1); + return (acpi_matchhids(aa, acpiac_hids, cf->cf_driver->cd_name)); } void diff --git a/sys/dev/acpi/acpiasus.c b/sys/dev/acpi/acpiasus.c index 9ec6069a4cf..8940da99bdf 100644 --- a/sys/dev/acpi/acpiasus.c +++ b/sys/dev/acpi/acpiasus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiasus.c,v 1.7 2008/10/01 19:13:57 robert Exp $ */ +/* $OpenBSD: acpiasus.c,v 1.8 2008/11/06 23:41:28 marco Exp $ */ /* $NetBSD: asus_acpi.c,v 1.2.2.2 2008/04/03 12:42:37 mjf Exp $ */ /* * Copyright (c) 2007, 2008 Jared D. McNeill <jmcneill@invisible.ca> @@ -103,18 +103,15 @@ struct cfdriver acpiasus_cd = { NULL, "acpiasus", DV_DULL }; +const char *acpiasus_hids[] = { ACPI_DEV_ASUS, 0 }; + int acpiasus_match(struct device *parent, void *match, void *aux) { struct acpi_attach_args *aa = aux; struct cfdata *cf = match; - if (aa->aaa_name == NULL || - strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || - aa->aaa_table != NULL) - return 0; - - return 1; + return (acpi_matchhids(aa, acpiasus_hids, cf->cf_driver->cd_name)); } void diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c index 6360c5eb6a0..56cb1746c02 100644 --- a/sys/dev/acpi/acpibat.c +++ b/sys/dev/acpi/acpibat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibat.c,v 1.52 2008/08/14 14:31:31 robert Exp $ */ +/* $OpenBSD: acpibat.c,v 1.53 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -41,6 +41,8 @@ struct cfdriver acpibat_cd = { NULL, "acpibat", DV_DULL }; +const char *acpibat_hids[] = { ACPI_DEV_CMB, 0 }; + void acpibat_monitor(struct acpibat_softc *); void acpibat_refresh(void *); int acpibat_getbif(struct acpibat_softc *); @@ -54,12 +56,7 @@ acpibat_match(struct device *parent, void *match, void *aux) struct cfdata *cf = match; /* sanity */ - if (aa->aaa_name == NULL || - strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || - aa->aaa_table != NULL) - return (0); - - return (1); + return (acpi_matchhids(aa, acpibat_hids, cf->cf_driver->cd_name)); } void diff --git a/sys/dev/acpi/acpibtn.c b/sys/dev/acpi/acpibtn.c index c48c06fbd25..65de567b39a 100644 --- a/sys/dev/acpi/acpibtn.c +++ b/sys/dev/acpi/acpibtn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibtn.c,v 1.19 2008/06/01 17:59:55 marco Exp $ */ +/* $OpenBSD: acpibtn.c,v 1.20 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -62,6 +62,8 @@ struct cfdriver acpibtn_cd = { NULL, "acpibtn", DV_DULL }; +const char *acpibtn_hids[] = { ACPI_DEV_LD, ACPI_DEV_PBD, ACPI_DEV_SBD, 0 }; + int acpibtn_match(struct device *parent, void *match, void *aux) { @@ -69,12 +71,7 @@ acpibtn_match(struct device *parent, void *match, void *aux) struct cfdata *cf = match; /* sanity */ - if (aa->aaa_name == NULL || - strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || - aa->aaa_table != NULL) - return (0); - - return (1); + return (acpi_matchhids(aa, acpibtn_hids, cf->cf_driver->cd_name)); } void diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c index 3f5117540d3..3fb81862c75 100644 --- a/sys/dev/acpi/acpiec.c +++ b/sys/dev/acpi/acpiec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiec.c,v 1.25 2008/06/13 09:13:56 jordan Exp $ */ +/* $OpenBSD: acpiec.c,v 1.26 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org> * @@ -113,6 +113,7 @@ struct cfdriver acpiec_cd = { NULL, "acpiec", DV_DULL }; +const char *acpiec_hids[] = { ACPI_DEV_ECD, 0 }; void acpiec_wait(struct acpiec_softc *sc, u_int8_t mask, u_int8_t val) @@ -264,12 +265,7 @@ acpiec_match(struct device *parent, void *match, void *aux) struct cfdata *cf = match; /* sanity */ - if (aa->aaa_name == NULL || - strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || - aa->aaa_table != NULL) - return (0); - - return (1); + return (acpi_matchhids(aa, acpiec_hids, cf->cf_driver->cd_name)); } void diff --git a/sys/dev/acpi/acpithinkpad.c b/sys/dev/acpi/acpithinkpad.c index bc2500bed14..24f79f76af8 100644 --- a/sys/dev/acpi/acpithinkpad.c +++ b/sys/dev/acpi/acpithinkpad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpithinkpad.c,v 1.12 2008/09/22 21:35:48 jcs Exp $ */ +/* $OpenBSD: acpithinkpad.c,v 1.13 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2008 joshua stein <jcs@openbsd.org> * @@ -103,6 +103,8 @@ struct cfdriver acpithinkpad_cd = { NULL, "acpithinkpad", DV_DULL }; +const char *acpithinkpad_hids[] = { ACPI_DEV_THINKPAD, 0 }; + int thinkpad_match(struct device *parent, void *match, void *aux) { @@ -111,9 +113,7 @@ thinkpad_match(struct device *parent, void *match, void *aux) struct aml_value res; int rv = 0; - if (aa->aaa_name == NULL || - strcmp(aa->aaa_name, cf->cf_driver->cd_name) != 0 || - aa->aaa_table != NULL) + if (!acpi_matchhids(aa, acpithinkpad_hids, cf->cf_driver->cd_name)) return (0); if (aml_evalname((struct acpi_softc *)parent, aa->aaa_node, diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 2f2d5047243..aab2fe7c69f 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.43 2008/09/15 19:25:36 kettenis Exp $ */ +/* $OpenBSD: acpivar.h,v 1.44 2008/11/06 23:41:28 marco Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -268,6 +268,8 @@ void acpi_write_pmreg(struct acpi_softc *, int, int, int); void acpi_poll(void *); +int acpi_matchhids(struct acpi_attach_args *, const char *[], const char *); + #endif #endif /* !_DEV_ACPI_ACPIVAR_H_ */ |