On Dec 01, Maxime Henrion wrote:
> Jesse Guardiani wrote:
> > Jesse Guardiani wrote:

> Index: isa/ad1816.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/isa/ad1816.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 ad1816.c
> --- isa/ad1816.c      7 Sep 2003 16:28:02 -0000       1.29
> +++ isa/ad1816.c      1 Dec 2003 14:11:45 -0000
> @@ -593,7 +593,8 @@ ad1816_attach(device_t dev)
>       ad1816 = (struct ad1816_info *)malloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT | 
> M_ZERO);
>       if (!ad1816) return ENXIO;
>  
> -     ad1816->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc");
> +     ad1816->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc",
> +         0);
>       ad1816->io_rid = 2;
>       ad1816->irq_rid = 0;
>       ad1816->drq1_rid = 0;
> Index: isa/mss.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/isa/mss.c,v
> retrieving revision 1.86
> diff -u -p -r1.86 mss.c
> --- isa/mss.c 7 Sep 2003 16:28:02 -0000       1.86
> +++ isa/mss.c 1 Dec 2003 14:11:53 -0000
> @@ -1667,7 +1667,7 @@ mss_doattach(device_t dev, struct mss_in
>       int pdma, rdma, flags = device_get_flags(dev);
>       char status[SND_STATUSLEN], status2[SND_STATUSLEN];
>  
> -     mss->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc");
> +     mss->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc", 0);
>       mss->bufsize = pcm_getbuffersize(dev, 4096, MSS_DEFAULT_BUFSZ, 65536);
>       if (!mss_alloc_resources(mss, dev)) goto no;
>       mss_init(mss, dev);
> Index: isa/sbc.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/isa/sbc.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 sbc.c
> --- isa/sbc.c 7 Feb 2003 14:05:33 -0000       1.38
> +++ isa/sbc.c 1 Dec 2003 14:12:03 -0000
> @@ -116,7 +116,8 @@ static void sb_setmixer(struct resource 
>  static void
>  sbc_lockinit(struct sbc_softc *scp)
>  {
> -     scp->lock = snd_mtxcreate(device_get_nameunit(scp->dev), "sound softc");
> +     scp->lock = snd_mtxcreate(device_get_nameunit(scp->dev), "sound softc",
> +         0);
>  }
>  
>  static void
> Index: pci/cmi.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pci/cmi.c,v
> retrieving revision 1.23
> diff -u -p -r1.23 cmi.c
> --- pci/cmi.c 2 Sep 2003 17:30:37 -0000       1.23
> +++ pci/cmi.c 1 Dec 2003 14:12:15 -0000
> @@ -842,7 +842,7 @@ cmi_attach(device_t dev)
>               return ENXIO;
>       }
>  
> -     sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc");
> +     sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc", 0);
>       data = pci_read_config(dev, PCIR_COMMAND, 2);
>       data |= (PCIM_CMD_PORTEN|PCIM_CMD_BUSMASTEREN);
>       pci_write_config(dev, PCIR_COMMAND, data, 2);
> Index: pci/ds1.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pci/ds1.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 ds1.c
> --- pci/ds1.c 2 Sep 2003 17:30:37 -0000       1.36
> +++ pci/ds1.c 1 Dec 2003 14:12:26 -0000
> @@ -942,7 +945,7 @@ ds_pci_attach(device_t dev)
>               return ENXIO;
>       }
>  
> -     sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc");
> +     sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc", 0);
>       sc->dev = dev;
>       subdev = (pci_get_subdevice(dev) << 16) | pci_get_subvendor(dev);
>       sc->type = ds_finddev(pci_get_devid(dev), subdev);
> Index: pci/emu10k1.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pci/emu10k1.c,v
> retrieving revision 1.41
> diff -u -p -r1.41 emu10k1.c
> --- pci/emu10k1.c     7 Sep 2003 16:28:03 -0000       1.41
> +++ pci/emu10k1.c     1 Dec 2003 14:12:35 -0000
> @@ -1468,7 +1468,7 @@ emu_pci_attach(device_t dev)
>               return ENXIO;
>       }
>  
> -     sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc");
> +     sc->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc", 0);
>       sc->dev = dev;
>       sc->type = pci_get_devid(dev);
>       sc->rev = pci_get_revid(dev);
> Index: pci/t4dwave.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pci/t4dwave.c,v
> retrieving revision 1.40
> diff -u -p -r1.40 t4dwave.c
> --- pci/t4dwave.c     7 Sep 2003 16:28:03 -0000       1.40
> +++ pci/t4dwave.c     1 Dec 2003 14:12:42 -0000
> @@ -811,7 +811,7 @@ tr_pci_attach(device_t dev)
>  
>       tr->type = pci_get_devid(dev);
>       tr->rev = pci_get_revid(dev);
> -     tr->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc");
> +     tr->lock = snd_mtxcreate(device_get_nameunit(dev), "sound softc", 0);
>  
>       data = pci_read_config(dev, PCIR_COMMAND, 2);
>       data |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
> Index: pcm/ac97.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pcm/ac97.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 ac97.c
> --- pcm/ac97.c        11 Nov 2003 22:15:17 -0000      1.49
> +++ pcm/ac97.c        1 Dec 2003 14:10:11 -0000
> @@ -672,7 +672,7 @@ ac97_create(device_t dev, void *devinfo,
>               return NULL;
>  
>       snprintf(codec->name, AC97_NAMELEN, "%s:ac97", device_get_nameunit(dev));
> -     codec->lock = snd_mtxcreate(codec->name, "ac97 codec");
> +     codec->lock = snd_mtxcreate(codec->name, "ac97 codec", 0);
>       codec->methods = kobj_create(cls, M_AC97, M_WAITOK);
>       if (codec->methods == NULL) {
>               snd_mtxlock(codec->lock);
> Index: pcm/channel.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pcm/channel.c,v
> retrieving revision 1.91
> diff -u -p -r1.91 channel.c
> --- pcm/channel.c     9 Nov 2003 09:17:22 -0000       1.91
> +++ pcm/channel.c     1 Dec 2003 14:10:11 -0000
> @@ -69,7 +69,7 @@ static int chn_buildfeeder(struct pcm_ch
>  static void
>  chn_lockinit(struct pcm_channel *c)
>  {
> -     c->lock = snd_mtxcreate(c->name, "pcm channel");
> +     c->lock = snd_mtxcreate(c->name, "pcm channel", MTX_DUPOK);
>  }
>  
>  static void
> Index: pcm/mixer.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pcm/mixer.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 mixer.c
> --- pcm/mixer.c       11 Nov 2003 05:38:28 -0000      1.33
> +++ pcm/mixer.c       1 Dec 2003 14:10:11 -0000
> @@ -194,7 +194,7 @@ mixer_init(device_t dev, kobj_class_t cl
>  
>       m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO);
>       snprintf(m->name, MIXER_NAMELEN, "%s:mixer", device_get_nameunit(dev));
> -     m->lock = snd_mtxcreate(m->name, "pcm mixer");
> +     m->lock = snd_mtxcreate(m->name, "pcm mixer", 0);
>       m->type = cls->name;
>       m->devinfo = devinfo;
>       m->busy = 0;
> Index: pcm/sound.c
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pcm/sound.c,v
> retrieving revision 1.85
> diff -u -p -r1.85 sound.c
> --- pcm/sound.c       7 Sep 2003 16:28:03 -0000       1.85
> +++ pcm/sound.c       1 Dec 2003 14:10:01 -0000
> @@ -88,7 +88,7 @@ snd_sysctl_tree_top(device_t dev)
>  }
>  
>  void *
> -snd_mtxcreate(const char *desc, const char *type)
> +snd_mtxcreate(const char *desc, const char *type, int opts)
>  {
>  #ifdef USING_MUTEX
>       struct mtx *m;
> @@ -96,7 +96,7 @@ snd_mtxcreate(const char *desc, const ch
>       m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO);
>       if (m == NULL)
>               return NULL;
> -     mtx_init(m, desc, type, MTX_RECURSE);
> +     mtx_init(m, desc, type, MTX_RECURSE | opts);
>       return m;
>  #else
>       return (void *)0xcafebabe;
> @@ -641,7 +641,7 @@ pcm_register(device_t dev, void *devinfo
>               return EINVAL;
>       }
>  
> -     d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev");
> +     d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev", 0);
>  
>       d->flags = 0;
>       d->dev = dev;
> Index: pcm/sound.h
> ===================================================================
> RCS file: /space2/ncvs/src/sys/dev/sound/pcm/sound.h,v
> retrieving revision 1.52
> diff -u -p -r1.52 sound.h
> --- pcm/sound.h       7 Sep 2003 16:28:03 -0000       1.52
> +++ pcm/sound.h       1 Dec 2003 14:13:25 -0000
> @@ -237,7 +237,7 @@ void *pcm_getdevinfo(device_t dev);
>  int snd_setup_intr(device_t dev, struct resource *res, int flags,
>                  driver_intr_t hand, void *param, void **cookiep);
>  
> -void *snd_mtxcreate(const char *desc, const char *type);
> +void *snd_mtxcreate(const char *desc, const char *type, int opts);
>  void snd_mtxfree(void *m);
>  void snd_mtxassert(void *m);
>  #define      snd_mtxlock(m) mtx_lock(m)

        Maxime,
        I think it would be better to isolate the changes (DUP_OK flag
and lock creation) to just the channel code, no need to touch every
driver.  Also, if this is the right direction, we should back out the
commit I did that re-ordered code that prevented duplicate channel
locks (obviously it wasn't completen) channel.

        Thank you for addressing this, I somehow missed this e-mail.

        --Mat

-- 
        Any idiot can face a crisis; it is this day-to-day living
        that wears you out.
                        - Chekhov
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to