summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-10-26 20:17:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-10-26 20:17:28 +0000
commitc16d88bf4bfc8e8526f12a85971a6f35865648c5 (patch)
tree195dce594f943b0bd5fcf3230f02adb820deba01
parenta9810f2e4406559596eb8337a7a35f248cdbb080 (diff)
Do not do strncmp comparisons on dv_xname because longer device names which
look similar could arrive in the future. Instead, compare directly against dv_cfdata->cf_driver->cd_name Issue originally spotted by miod
-rw-r--r--sys/arch/alpha/alpha/api_up1000.c4
-rw-r--r--sys/arch/alpha/alpha/dec_550.c4
-rw-r--r--sys/arch/alpha/alpha/dec_6600.c4
-rw-r--r--sys/arch/alpha/alpha/dec_eb164.c4
-rw-r--r--sys/arch/aviion/aviion/autoconf.c6
-rw-r--r--sys/arch/luna88k/luna88k/autoconf.c8
-rw-r--r--sys/arch/macppc/dev/daca.c8
-rw-r--r--sys/arch/macppc/dev/onyx.c6
-rw-r--r--sys/arch/macppc/dev/snapper.c6
-rw-r--r--sys/arch/macppc/dev/tumbler.c6
-rw-r--r--sys/arch/mvme68k/mvme68k/autoconf.c10
-rw-r--r--sys/arch/mvme88k/mvme88k/autoconf.c10
-rw-r--r--sys/arch/sparc/dev/esp.c4
-rw-r--r--sys/arch/sparc/dev/if_le.c8
-rw-r--r--sys/arch/sparc/dev/obio.c6
-rw-r--r--sys/arch/sparc/sparc/autoconf.c6
-rw-r--r--sys/arch/sparc64/sparc64/cpu.c4
-rw-r--r--sys/dev/acpi/acpi.c9
18 files changed, 56 insertions, 57 deletions
diff --git a/sys/arch/alpha/alpha/api_up1000.c b/sys/arch/alpha/alpha/api_up1000.c
index c58d0049b2c..5d76fad6325 100644
--- a/sys/arch/alpha/alpha/api_up1000.c
+++ b/sys/arch/alpha/alpha/api_up1000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: api_up1000.c,v 1.9 2008/07/16 20:03:20 miod Exp $ */
+/* $OpenBSD: api_up1000.c,v 1.10 2009/10/26 20:17:26 deraadt Exp $ */
/* $NetBSD: api_up1000.c,v 1.4 2000/06/20 03:48:53 matt Exp $ */
/*
@@ -255,7 +255,7 @@ api_up1000_device_register(dev, aux)
*/
if ((ideboot || scsiboot) && !strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0)) {
+ if ((strcmp("pciide", parent->dv_cfdata->cf_driver->cd_name) != 0)) {
return;
} else {
if (parent != scsidev)
diff --git a/sys/arch/alpha/alpha/dec_550.c b/sys/arch/alpha/alpha/dec_550.c
index b4ba2ba45b0..4a736aa3e75 100644
--- a/sys/arch/alpha/alpha/dec_550.c
+++ b/sys/arch/alpha/alpha/dec_550.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_550.c,v 1.11 2008/07/16 20:03:20 miod Exp $ */
+/* $OpenBSD: dec_550.c,v 1.12 2009/10/26 20:17:26 deraadt Exp $ */
/* $NetBSD: dec_550.c,v 1.10 2000/06/20 03:48:53 matt Exp $ */
/*
@@ -249,7 +249,7 @@ dec_550_device_register(dev, aux)
if (!strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0))
+ if ((strcmp("pciide", parent->dv_cfdata->cf_driver->cd_name) != 0))
return;
if (parent != ctrlrdev)
return;
diff --git a/sys/arch/alpha/alpha/dec_6600.c b/sys/arch/alpha/alpha/dec_6600.c
index 9a3a9fc9af6..f4e5ef61512 100644
--- a/sys/arch/alpha/alpha/dec_6600.c
+++ b/sys/arch/alpha/alpha/dec_6600.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_6600.c,v 1.11 2009/01/17 18:30:05 miod Exp $ */
+/* $OpenBSD: dec_6600.c,v 1.12 2009/10/26 20:17:26 deraadt Exp $ */
/* $NetBSD: dec_6600.c,v 1.7 2000/06/20 03:48:54 matt Exp $ */
/*
@@ -302,7 +302,7 @@ dec_6600_device_register(dev, aux)
if (!strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0))
+ if ((strcmp("pciide", parent->dv_cfdata->cf_driver->cd_name) != 0))
return;
if (parent != ctrlrdev)
return;
diff --git a/sys/arch/alpha/alpha/dec_eb164.c b/sys/arch/alpha/alpha/dec_eb164.c
index 32315c9a379..4162821c6ad 100644
--- a/sys/arch/alpha/alpha/dec_eb164.c
+++ b/sys/arch/alpha/alpha/dec_eb164.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_eb164.c,v 1.16 2008/08/02 13:48:09 miod Exp $ */
+/* $OpenBSD: dec_eb164.c,v 1.17 2009/10/26 20:17:26 deraadt Exp $ */
/* $NetBSD: dec_eb164.c,v 1.33 2000/05/22 20:13:32 thorpej Exp $ */
/*
@@ -252,7 +252,7 @@ dec_eb164_device_register(dev, aux)
struct ata_atapi_attach *aa_link = aux;
int variation = hwrpb->rpb_variation & SV_ST_MASK;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0))
+ if ((strcmp("pciide", parent->dv_cfdata->cf_driver->cd_name) != 0))
return;
if (parent != ctrlrdev)
return;
diff --git a/sys/arch/aviion/aviion/autoconf.c b/sys/arch/aviion/aviion/autoconf.c
index 7e20e70d0d9..b582ad468c5 100644
--- a/sys/arch/aviion/aviion/autoconf.c
+++ b/sys/arch/aviion/aviion/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.9 2009/03/15 20:39:51 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.10 2009/10/26 20:17:27 deraadt Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -191,8 +191,8 @@ device_register(struct device *dev, void *aux)
* Internal ethernet is le at syscon only, and we do not
* care about controller and unit numbers.
*/
- if (strncmp("le", dev->dv_xname, 2) == 0 &&
- strncmp("syscon", dev->dv_parent->dv_xname, 6) == 0)
+ if (strcmp("le", dev->dv_cfdata->cf_driver->cd_name) == 0 &&
+ strcmp("syscon", dev->dv_parent->dv_cfdata->cf_driver->cd_name) == 0)
bootdv = dev;
break;
}
diff --git a/sys/arch/luna88k/luna88k/autoconf.c b/sys/arch/luna88k/luna88k/autoconf.c
index da5d6d4db02..f15e5f7b99c 100644
--- a/sys/arch/luna88k/luna88k/autoconf.c
+++ b/sys/arch/luna88k/luna88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.15 2009/03/15 20:39:53 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.16 2009/10/26 20:17:27 deraadt Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -151,14 +151,14 @@ device_register(struct device *dev, void *aux)
/*
* scsi: sd,cd XXX: Can LUNA88K boot from CD-ROM?
*/
- if (strncmp("sd", dev->dv_xname, 2) == 0 ||
- strncmp("cd", dev->dv_xname, 2) == 0) {
+ if (strcmp("sd", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
+ strcmp("cd", dev->dv_cfdata->cf_driver->cd_name) == 0) {
struct scsi_attach_args *sa = aux;
struct device *spcsc;
spcsc = dev->dv_parent->dv_parent;
- if (strncmp(autoboot.cont, spcsc->dv_xname, 4) == 0 &&
+ if (strcmp(autoboot.cont, spcsc->dv_cfdata->cf_driver->cd_name) == 0 &&
sa->sa_sc_link->target == autoboot.targ &&
sa->sa_sc_link->lun == 0) {
bootdv = dev;
diff --git a/sys/arch/macppc/dev/daca.c b/sys/arch/macppc/dev/daca.c
index 67485fddea2..594b4c56e32 100644
--- a/sys/arch/macppc/dev/daca.c
+++ b/sys/arch/macppc/dev/daca.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: daca.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */
-/* $Id: daca.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */
+/* $OpenBSD: daca.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */
+/* $Id: daca.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */
/*-
* Copyright (c) 2002,2003 Tsubai Masanari. All rights reserved.
@@ -158,8 +158,8 @@ daca_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/macppc/dev/onyx.c b/sys/arch/macppc/dev/onyx.c
index 7a05325778d..f0f71b2a21f 100644
--- a/sys/arch/macppc/dev/onyx.c
+++ b/sys/arch/macppc/dev/onyx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: onyx.c,v 1.9 2008/10/29 00:04:14 jakemsr Exp $ */
+/* $OpenBSD: onyx.c,v 1.10 2009/10/26 20:17:27 deraadt Exp $ */
/*-
* Copyright (c) 2005 Tsubai Masanari. All rights reserved.
@@ -168,8 +168,8 @@ onyx_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c
index be8dd115a69..3fba8d3c8a0 100644
--- a/sys/arch/macppc/dev/snapper.c
+++ b/sys/arch/macppc/dev/snapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snapper.c,v 1.34 2008/11/06 10:01:50 todd Exp $ */
+/* $OpenBSD: snapper.c,v 1.35 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -486,8 +486,8 @@ snapper_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/macppc/dev/tumbler.c b/sys/arch/macppc/dev/tumbler.c
index d6bc74b0ce6..efc68fa6595 100644
--- a/sys/arch/macppc/dev/tumbler.c
+++ b/sys/arch/macppc/dev/tumbler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tumbler.c,v 1.6 2008/10/29 00:04:14 jakemsr Exp $ */
+/* $OpenBSD: tumbler.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */
/*-
* Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved.
@@ -302,8 +302,8 @@ tumbler_defer(struct device *dev)
struct device *dv;
TAILQ_FOREACH(dv, &alldevs, dv_list)
- if (strncmp(dv->dv_xname, "kiic", 4) == 0 &&
- strncmp(dv->dv_parent->dv_xname, "macobio", 7) == 0)
+ if (strcmp(dv->dv_cfdata->cf_driver->cd_name, "kiic") == 0 &&
+ strcmp(dv->dv_parent->dv_cfdata->cf_driver->cd_name, "macobio") == 0)
sc->sc_i2c = dv;
if (sc->sc_i2c == NULL) {
printf("%s: unable to find i2c\n", sc->sc_dev.dv_xname);
diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c
index 06c6209a4e4..40c2e96c324 100644
--- a/sys/arch/mvme68k/mvme68k/autoconf.c
+++ b/sys/arch/mvme68k/mvme68k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.44 2009/03/01 22:08:13 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.45 2009/10/26 20:17:27 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -206,8 +206,8 @@ device_register(struct device *dev, void *aux)
/*
* scsi: sd,cd
*/
- if (strncmp("sd", dev->dv_xname, 2) == 0 ||
- strncmp("cd", dev->dv_xname, 2) == 0) {
+ if (strcmp("sd", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
+ strcmp("cd", dev->dv_cfdata->cf_driver->cd_name) == 0) {
struct scsi_attach_args *sa = aux;
int target, bus, lun;
@@ -246,8 +246,8 @@ device_register(struct device *dev, void *aux)
/*
* ethernet: ie,le
*/
- else if (strncmp("ie", dev->dv_xname, 2) == 0 ||
- strncmp("le", dev->dv_xname, 2) == 0) {
+ else if (strcmp("ie", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
+ strcmp("le", dev->dv_cfdata->cf_driver->cd_name) == 0) {
struct confargs *ca = aux;
if (ca->ca_paddr == bootaddr) {
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c
index 9d52536ec49..6c22a559a3f 100644
--- a/sys/arch/mvme88k/mvme88k/autoconf.c
+++ b/sys/arch/mvme88k/mvme88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.44 2009/03/15 20:39:53 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.45 2009/10/26 20:17:27 deraadt Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -112,8 +112,8 @@ device_register(struct device *dev, void *aux)
/*
* scsi: sd,cd
*/
- if (strncmp("cd", dev->dv_xname, 2) == 0 ||
- strncmp("sd", dev->dv_xname, 2) == 0) {
+ if (strcmp("cd", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
+ strcmp("sd", dev->dv_cfdata->cf_driver->cd_name) == 0) {
struct scsi_attach_args *sa = aux;
int target, bus, lun;
@@ -134,8 +134,8 @@ device_register(struct device *dev, void *aux)
/*
* ethernet: ie,le
*/
- else if (strncmp("ie", dev->dv_xname, 2) == 0 ||
- strncmp("le", dev->dv_xname, 2) == 0) {
+ else if (strcmp("ie", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
+ strcmp("le", dev->dv_cfdata->cf_driver->cd_name) == 0) {
struct confargs *ca = aux;
if (ca->ca_paddr == bootaddr) {
diff --git a/sys/arch/sparc/dev/esp.c b/sys/arch/sparc/dev/esp.c
index 7ed4df74607..c96b1449d87 100644
--- a/sys/arch/sparc/dev/esp.c
+++ b/sys/arch/sparc/dev/esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esp.c,v 1.27 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: esp.c,v 1.28 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: esp.c,v 1.69 1997/08/27 11:24:18 bouyer Exp $ */
/*
@@ -355,7 +355,7 @@ espattach(parent, self, aux)
mapiodev(ca->ca_ra.ra_reg, 0, ca->ca_ra.ra_len);
}
- dmachild = strncmp(parent->dv_xname, "dma", 3) == 0;
+ dmachild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "dma") == 0;
if (dmachild) {
esc->sc_dma = (struct dma_softc *)parent;
esc->sc_dma->sc_esp = esc;
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c
index 4ddece18e54..7bf1432d45b 100644
--- a/sys/arch/sparc/dev/if_le.c
+++ b/sys/arch/sparc/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.29 2007/05/29 09:54:09 sobrado Exp $ */
+/* $OpenBSD: if_le.c,v 1.30 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */
/*-
@@ -429,9 +429,9 @@ leattach(parent, self, aux)
int pri;
struct bootpath *bp;
#if defined(SUN4C) || defined(SUN4M)
- int sbuschild = strncmp(parent->dv_xname, "sbus", 4) == 0;
- int lebufchild = strncmp(parent->dv_xname, "lebuffer", 8) == 0;
- int dmachild = strncmp(parent->dv_xname, "ledma", 5) == 0;
+ int sbuschild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "sbus") == 0;
+ int lebufchild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "lebuffer") == 0;
+ int dmachild = strcmp(parent->dv_cfdata->cf_driver->cd_name, "ledma") == 0;
struct lebuf_softc *lebuf;
#endif
diff --git a/sys/arch/sparc/dev/obio.c b/sys/arch/sparc/dev/obio.c
index 7be6f191120..2086fbb5fb7 100644
--- a/sys/arch/sparc/dev/obio.c
+++ b/sys/arch/sparc/dev/obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: obio.c,v 1.19 2007/10/08 17:48:06 krw Exp $ */
+/* $OpenBSD: obio.c,v 1.20 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: obio.c,v 1.37 1997/07/29 09:58:11 fair Exp $ */
/*
@@ -290,7 +290,7 @@ vmesattach(parent, self, args)
void *args;
{
if (self->dv_unit > 0 ||
- (CPU_ISSUN4M && strncmp(parent->dv_xname, "vme", 3) != 0)) {
+ (CPU_ISSUN4M && strcmp(parent->dv_cfdata->cf_driver->cd_name, "vme") != 0)) {
printf(" unsupported\n");
return;
}
@@ -312,7 +312,7 @@ vmelattach(parent, self, args)
void *args;
{
if (self->dv_unit > 0 ||
- (CPU_ISSUN4M && strncmp(parent->dv_xname, "vme", 3) != 0)) {
+ (CPU_ISSUN4M && strcmp(parent->dv_cfdata->cf_driver->cd_name, "vme") != 0)) {
printf(" unsupported\n");
return;
}
diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c
index b8b1937e456..866fd7e09d0 100644
--- a/sys/arch/sparc/sparc/autoconf.c
+++ b/sys/arch/sparc/sparc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.82 2008/07/21 04:35:54 todd Exp $ */
+/* $OpenBSD: autoconf.c,v 1.83 2009/10/26 20:17:27 deraadt Exp $ */
/* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */
/*
@@ -1757,8 +1757,8 @@ device_register(struct device *dev, void *aux)
/*
* scsi: sd,cd
*/
- if (strncmp("sd", dev->dv_xname, 2) == 0 ||
- strncmp("cd", dev->dv_xname, 2) == 0) {
+ if (strcmp("sd", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
+ strcmp("cd", dev->dv_cfdata->cf_driver->cd_name) == 0) {
struct scsi_attach_args *sa = aux;
struct scsibus_softc *sbsc;
int target, lun;
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c
index 5d9457c57b1..ce987d10979 100644
--- a/sys/arch/sparc64/sparc64/cpu.c
+++ b/sys/arch/sparc64/sparc64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.52 2009/04/13 08:31:36 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.53 2009/10/26 20:17:25 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */
/*
@@ -260,7 +260,7 @@ cpu_attach(parent, dev, aux)
vers = IU_VERS(ver);
/* tell them what we have */
- if (strncmp(parent->dv_xname, "core", 4) == 0)
+ if (strcmp(parent->dv_cfdata->cf_driver->cd_name, "core") == 0)
node = OF_parent(ma->ma_node);
else
node = ma->ma_node;
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 38cd7e9849f..937223bb47f 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.142 2009/10/26 19:56:01 jordan Exp $ */
+/* $OpenBSD: acpi.c,v 1.143 2009/10/26 20:17:26 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -400,7 +400,7 @@ acpiide_notify(struct aml_node *node, int ntype, void *arg)
/* Walk device list looking for IDE device match */
TAILQ_FOREACH(dev, &alldevs, dv_list) {
- if (strncmp(dev->dv_xname, "pciide", 6))
+ if (strcmp(dev->dv_cfdata->cf_driver->cd_name, "pciide"))
continue;
wsc = (struct pciide_softc *)dev;
@@ -729,12 +729,11 @@ acpi_attach(struct device *parent, struct device *self, void *aux)
SLIST_INIT(&sc->sc_ac);
SLIST_INIT(&sc->sc_bat);
TAILQ_FOREACH(dev, &alldevs, dv_list) {
- if (!strncmp(dev->dv_xname, "acpiac", strlen("acpiac"))) {
+ if (!strcmp(dev->dv_cfdata->cf_driver->cd_name, "acpiac")) {
ac = malloc(sizeof(*ac), M_DEVBUF, M_WAITOK | M_ZERO);
ac->aac_softc = (struct acpiac_softc *)dev;
SLIST_INSERT_HEAD(&sc->sc_ac, ac, aac_link);
- }
- if (!strncmp(dev->dv_xname, "acpibat", strlen("acpibat"))) {
+ } else if (!strcmp(dev->dv_cfdata->cf_driver->cd_name, "acpibat")) {
bat = malloc(sizeof(*bat), M_DEVBUF, M_WAITOK | M_ZERO);
bat->aba_softc = (struct acpibat_softc *)dev;
SLIST_INSERT_HEAD(&sc->sc_bat, bat, aba_link);