Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/dev/pci Pull up revision 1.8 (requested by jdolecek):



details:   https://anonhg.NetBSD.org/src/rev/004a0259ecc3
branches:  netbsd-1-5
changeset: 492727:004a0259ecc3
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 09 17:37:19 2002 +0000

description:
Pull up revision 1.8 (requested by jdolecek):
  Do not try to set parameters if the appropriate ``voice'' is not
  initialized.  Fixes PR#15394.

diffstat:

 sys/dev/pci/emuxki.c |  47 ++++++++++++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diffs (100 lines):

diff -r dd52bd737826 -r 004a0259ecc3 sys/dev/pci/emuxki.c
--- a/sys/dev/pci/emuxki.c      Sat Feb 09 17:35:23 2002 +0000
+++ b/sys/dev/pci/emuxki.c      Sat Feb 09 17:37:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emuxki.c,v 1.7.4.2 2002/01/19 21:55:09 he Exp $        */
+/*     $NetBSD: emuxki.c,v 1.7.4.3 2002/02/09 17:37:19 he Exp $        */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.7.4.2 2002/01/19 21:55:09 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.7.4.3 2002/02/09 17:37:19 he Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1351,19 +1351,6 @@
 {
        int             error;
 
-       /*
-        * Audio driver tried to set recording AND playing params even if
-        * device opened in play or record only mode ==>
-        * modified emuxki_set_params.
-        * Stays here for now just in case ...
-        */
-       if (voice == NULL) {
-#ifdef EMUXKI_DEBUG
-               printf("warning: tried to set unallocated voice params !!\n");
-#endif
-               return (0);
-       }
-
        if (voice->stereo == stereo && voice->b16 == b16 &&
            voice->sample_rate == srate)
                return (0);
@@ -1595,8 +1582,10 @@
        if (flags & AUOPEN_WRITE) {
                sc->pvoice = emuxki_voice_new(sc, EMU_VOICE_USE_PLAY);
                if (sc->pvoice == NULL) {
-                       if (flags & AUOPEN_READ)
+                       if (sc->rvoice) {
                                emuxki_voice_delete(sc->rvoice);
+                               sc->rvoice = NULL;
+                       }
                        return (EBUSY);
                }
        }
@@ -1614,12 +1603,14 @@
 #endif
 
        /* No multiple voice support for now */
-       if (sc->rvoice != NULL)
+       if (sc->rvoice != NULL) {
                emuxki_voice_delete(sc->rvoice);
-       sc->rvoice = NULL;
-       if (sc->pvoice != NULL)
+               sc->rvoice = NULL;
+       }
+       if (sc->pvoice != NULL) {
                emuxki_voice_delete(sc->pvoice);
-       sc->pvoice = NULL;
+               sc->pvoice = NULL;
+       }
 }
 
 static int
@@ -1766,17 +1757,27 @@
        struct emuxki_softc *sc = addr;
        int             mode, error;
        struct audio_params *p;
+       struct emuxki_voice *v;
 
        for (mode = AUMODE_RECORD; mode != -1;
             mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) {
                if ((usemode & setmode & mode) == 0)
                        continue;
 
-               p = (mode == AUMODE_PLAY) ? play : rec;
+               if (mode == AUMODE_PLAY) {
+                       p = play;
+                       v = sc->pvoice;
+               } else {
+                       p = rec;
+                       v = sc->rvoice;
+               }
+
+               if (v == NULL) {
+                       continue;
+               }
 
                /* No multiple voice support for now */
-               if ((error = emuxki_set_vparms((mode == AUMODE_PLAY) ?
-                                               sc->pvoice : sc->rvoice, p)))
+               if ((error = emuxki_set_vparms(v, p)))
                        return (error);
        }
 



Home | Main Index | Thread Index | Old Index