Deleted Added
full compact
29a30
> #include <dev/sound/pcm/dsp.h>
34c35
< SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/sound.c 124617 2004-01-17 10:37:11Z phk $");
---
> SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/sound.c 124740 2004-01-20 03:58:57Z matk $");
416c417
< pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
---
> pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch)
419,420c420
< int unit = device_get_unit(d->dev);
< int x = -1;
---
> int device = device_get_unit(d->dev);
421a422,431
> /*
> * Note it's confusing nomenclature.
> * dev_t
> * device -> pcm_device
> * unit -> pcm_channel
> * channel -> snddev_channel
> * device_t
> * unit -> pcm_device
> */
>
428a439
> sce->chan_num= d->devcount++;
438,439d448
< if (mkdev)
< x = d->devcount++;
440a450,453
> sce->dsp_devt= make_dev(&dsp_cdevsw,
> PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num),
> UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d",
> device, sce->chan_num);
442,446c455,458
< if (mkdev) {
< dsp_register(unit, x);
< if (ch->direction == PCMDIR_REC)
< dsp_registerrec(unit, ch->num);
< }
---
> sce->dspW_devt= make_dev(&dsp_cdevsw,
> PCMMKMINOR(device, SND_DEV_DSP16, sce->chan_num),
> UID_ROOT, GID_WHEEL, 0666, "dspW%d.%d",
> device, sce->chan_num);
447a460,470
> sce->audio_devt= make_dev(&dsp_cdevsw,
> PCMMKMINOR(device, SND_DEV_AUDIO, sce->chan_num),
> UID_ROOT, GID_WHEEL, 0666, "audio%d.%d",
> device, sce->chan_num);
>
> if (ch->direction == PCMDIR_REC)
> sce->dspr_devt = make_dev(&dsp_cdevsw,
> PCMMKMINOR(device, SND_DEV_DSPREC,
> sce->chan_num), UID_ROOT, GID_WHEEL,
> 0666, "dspr%d.%d", device, sce->chan_num);
>
452c475
< pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch, int rmdev)
---
> pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch)
455d477
< int unit = device_get_unit(d->dev);
477,481d498
< if (rmdev) {
< dsp_unregister(unit, --d->devcount);
< if (ch->direction == PCMDIR_REC)
< dsp_unregisterrec(unit, ch->num);
< }
512c529
< err = pcm_chn_add(d, ch, 1);
---
> err = pcm_chn_add(d, ch);
544c561
< error = pcm_chn_remove(d, sce->channel, SLIST_EMPTY(&ch->children));
---
> error = pcm_chn_remove(d, sce->channel);
687a705,706
>
>
695a715,723
>
> SLIST_FOREACH(sce, &d->channels, link) {
> destroy_dev(sce->dsp_devt);
> destroy_dev(sce->dspW_devt);
> destroy_dev(sce->audio_devt);
> if (sce->dspr_devt)
> destroy_dev(sce->dspr_devt);
> }
>
718,793d745
< int
< pcm_regdevt(dev_t dev, unsigned unit, unsigned type, unsigned channel)
< {
< struct snddev_info *d;
< struct snddev_devt *dt;
<
< d = devclass_get_softc(pcm_devclass, unit);
< KASSERT((d != NULL), ("bad d"));
< KASSERT((dev != NULL), ("bad dev"));
<
< dt = malloc(sizeof(*dt), M_DEVBUF, M_ZERO | M_WAITOK);
< if (dt == NULL)
< return ENOMEM;
< dt->dev = dev;
< dt->type = type;
< dt->channel = channel;
<
< snd_mtxlock(d->lock);
< SLIST_INSERT_HEAD(&d->devs, dt, link);
< snd_mtxunlock(d->lock);
<
< return 0;
< }
<
< dev_t
< pcm_getdevt(unsigned unit, unsigned type, unsigned channel)
< {
< struct snddev_info *d;
< struct snddev_devt *dt;
<
< d = devclass_get_softc(pcm_devclass, unit);
< KASSERT((d != NULL), ("bad d"));
<
< #if 0
< snd_mtxlock(d->lock);
< #endif
< SLIST_FOREACH(dt, &d->devs, link) {
< if ((dt->type == type) && (dt->channel == channel))
< return dt->dev;
< }
< #if 0
< snd_mtxunlock(d->lock);
< #endif
<
< return NULL;
< }
<
< int
< pcm_unregdevt(unsigned unit, unsigned type, unsigned channel)
< {
< struct snddev_info *d;
< struct snddev_devt *dt;
<
< d = devclass_get_softc(pcm_devclass, unit);
< KASSERT((d != NULL), ("bad d"));
<
< #if 0
< snd_mtxlock(d->lock);
< #endif
< SLIST_FOREACH(dt, &d->devs, link) {
< if ((dt->type == type) && (dt->channel == channel)) {
< SLIST_REMOVE(&d->devs, dt, snddev_devt, link);
< free(dt, M_DEVBUF);
< #if 0
< snd_mtxunlock(d->lock);
< #endif
< return 0;
< }
< }
< #if 0
< snd_mtxunlock(d->lock);
< #endif
<
< return ENOENT;
< }
<