diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-07-29 01:39:04 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2010-07-29 01:39:04 +0000 |
commit | 4262c06dcfbb9279e5f83bd02fadd878abfbc5f2 (patch) | |
tree | 3b849ff12935408c7409481ba5d246e70b219875 /sys/dev/pci/azalia.c | |
parent | 496ff608c8686cb899e1892b7e7622a03583d35e (diff) |
flag if an error during attach caused us to detach our resources, and
if so, don't do anything on suspend/resume. should fix crash reported
by mlarkin.
Diffstat (limited to 'sys/dev/pci/azalia.c')
-rw-r--r-- | sys/dev/pci/azalia.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index 4e003915e44..a2ff8cc0ed1 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.174 2010/07/15 03:43:11 jakemsr Exp $ */ +/* $OpenBSD: azalia.c,v 1.175 2010/07/29 01:39:03 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -159,6 +159,7 @@ typedef struct azalia_t { codec_t *codecs; int ncodecs; /* number of codecs */ int codecno; /* index of the using codec */ + int detached; /* nonzero if audio(4) is not attached */ azalia_dma_t corb_dma; int corb_entries; @@ -524,6 +525,7 @@ azalia_pci_attach(struct device *parent, struct device *self, void *aux) err_exit: printf("%s: initialization failure, detaching\n", XNAME(sc)); azalia_pci_detach(self, 0); + sc->detached = 1; } int @@ -1327,6 +1329,9 @@ azalia_suspend(azalia_t *az) { int err; + if (az->detached) + return 0; + /* disable unsolicited responses */ AZ_WRITE_4(az, GCTL, AZ_READ_4(az, GCTL) & ~HDA_GCTL_UNSOL); @@ -1424,6 +1429,9 @@ azalia_resume(azalia_t *az) pcireg_t v; int err; + if (az->detached) + return 0; + /* enable back-to-back */ v = pci_conf_read(az->pc, az->tag, PCI_COMMAND_STATUS_REG); pci_conf_write(az->pc, az->tag, PCI_COMMAND_STATUS_REG, |