diff options
author | Jordan Hargrave <jordan@cvs.openbsd.org> | 2010-07-23 18:38:47 +0000 |
---|---|---|
committer | Jordan Hargrave <jordan@cvs.openbsd.org> | 2010-07-23 18:38:47 +0000 |
commit | 7a6bfd530060539f90664c59c33d1bdca0f5e1f8 (patch) | |
tree | 4f1cc28194b292dd09c558f0c14046f6ed5295b4 | |
parent | 06ae5dc7be5f45640fdca20fa1d35559830cd0be (diff) |
Fix searchname to handle short name segments, remove hack in acpidock.
-rw-r--r-- | sys/dev/acpi/acpidock.c | 8 | ||||
-rw-r--r-- | sys/dev/acpi/dsdt.c | 13 |
2 files changed, 12 insertions, 9 deletions
diff --git a/sys/dev/acpi/acpidock.c b/sys/dev/acpi/acpidock.c index 964a6adfcb2..2d213803e23 100644 --- a/sys/dev/acpi/acpidock.c +++ b/sys/dev/acpi/acpidock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpidock.c,v 1.40 2010/07/21 19:35:15 deraadt Exp $ */ +/* $OpenBSD: acpidock.c,v 1.41 2010/07/23 18:38:46 jordan Exp $ */ /* * Copyright (c) 2006,2007 Michael Knudsen <mk@openbsd.org> * @@ -282,11 +282,7 @@ acpidock_foundejd(struct aml_node *node, void *arg) if (aml_evalnode(sc->sc_acpi, node, 0, NULL, &res) == -1) printf(": error\n"); else { - if (!memcmp(res.v_string, "_SB.", 4)) { - dock = aml_searchname(&aml_root, "_SB_"); - dock = aml_searchname(dock, res.v_string+4); - } else - dock = aml_searchname(&aml_root, res.v_string); + dock = aml_searchname(&aml_root, res.v_string); if (dock == sc->sc_devnode) /* Add all children devices of Device containing _EJD */ diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index f5876bc4af8..7f4a319c9a1 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.172 2010/07/22 14:19:47 deraadt Exp $ */ +/* $OpenBSD: dsdt.c,v 1.173 2010/07/23 18:38:46 jordan Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -4101,6 +4101,8 @@ struct aml_node * aml_searchname(struct aml_node *root, const void *vname) { char *name = (char *)vname; + char nseg[AML_NAMESEG_LEN + 1]; + int i; dnprintf(25,"Searchname: %s:%s = ", aml_nodename(root), vname); if (*name == AMLOP_ROOTCHAR) { @@ -4108,8 +4110,13 @@ aml_searchname(struct aml_node *root, const void *vname) name++; } while (*name != 0) { - root = __aml_search(root, name, 0); - name += (name[4] == '.') ? 5 : 4; + /* Ugh.. we can have short names here: append '_' */ + strlcpy(nseg, "____", sizeof(nseg)); + for (i=0; i < AML_NAMESEG_LEN && *name && *name != '.'; i++) + nseg[i] = *name++; + if (*name == '.') + name++; + root = __aml_search(root, nseg, 0); } dnprintf(25,"%p %s\n", root, aml_nodename(root)); return root; |