revise dsp_clone() to return the first nonbusy channel instead of simply
cycling channel numbers. remove unused fields from struct snddev_info.
This commit is contained in:
parent
494b7c7475
commit
420f58376d
@ -992,9 +992,8 @@ dsp_unregister(int unit, int channel)
|
||||
static void
|
||||
dsp_clone(void *arg, char *name, int namelen, dev_t *dev)
|
||||
{
|
||||
struct snddev_info *d;
|
||||
dev_t pdev;
|
||||
int unit, devtype;
|
||||
int i, cont, unit, devtype;
|
||||
|
||||
if (*dev != NODEV)
|
||||
return;
|
||||
@ -1028,13 +1027,18 @@ gotit:
|
||||
if (unit == -1 || unit > devclass_get_maxunit(pcm_devclass))
|
||||
return;
|
||||
|
||||
d = devclass_get_softc(pcm_devclass, unit);
|
||||
|
||||
pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, devtype, d->defaultchan++));
|
||||
if (d->defaultchan >= d->chancount)
|
||||
d->defaultchan = 0;
|
||||
if (pdev->si_flags & SI_NAMED)
|
||||
*dev = pdev;
|
||||
cont = 1;
|
||||
for (i = 0; cont; i++) {
|
||||
pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, devtype, i));
|
||||
if (pdev->si_flags & SI_NAMED) {
|
||||
if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
|
||||
*dev = pdev;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
cont = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -147,7 +147,7 @@ sndstat_prepare(struct sbuf *s)
|
||||
snd_mtxlock(d->lock);
|
||||
dev = devclass_get_device(pcm_devclass, i);
|
||||
sbuf_printf(s, "pcm%d: <%s> %s", i, device_get_desc(dev), d->status);
|
||||
if (d->chancount > 0) {
|
||||
if (!SLIST_EMPTY(&d->channels)) {
|
||||
pc = rc = vc = 0;
|
||||
SLIST_FOREACH(sce, &d->channels, link) {
|
||||
c = sce->channel;
|
||||
|
@ -166,7 +166,7 @@ sysctl_hw_sndunit(SYSCTL_HANDLER_ARGS)
|
||||
if (unit < 0 || unit > devclass_get_maxunit(pcm_devclass))
|
||||
return EINVAL;
|
||||
d = devclass_get_softc(pcm_devclass, unit);
|
||||
if (d == NULL || d->chancount == 0)
|
||||
if (d == NULL || SLIST_EMPTY(&d->channels))
|
||||
return EINVAL;
|
||||
snd_unit = unit;
|
||||
}
|
||||
@ -371,7 +371,6 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
|
||||
d->dev = dev;
|
||||
d->devinfo = devinfo;
|
||||
d->chancount = 0;
|
||||
d->defaultchan = 0;
|
||||
d->inprog = 0;
|
||||
|
||||
if (((numplay == 0) || (numrec == 0)) && (numplay != numrec))
|
||||
@ -428,7 +427,7 @@ pcm_unregister(device_t dev)
|
||||
d->sysctl_tree_top = NULL;
|
||||
sysctl_ctx_free(&d->sysctl_tree);
|
||||
#endif
|
||||
while (d->chancount > 0)
|
||||
while (!SLIST_EMPTY(&d->channels))
|
||||
pcm_killchan(dev);
|
||||
|
||||
chn_kill(d->fakechan);
|
||||
|
@ -108,8 +108,7 @@ struct snddev_channel {
|
||||
struct snddev_info {
|
||||
SLIST_HEAD(, snddev_channel) channels;
|
||||
struct pcm_channel *fakechan;
|
||||
unsigned chancount, defaultchan;
|
||||
/* struct snd_mixer *mixer; */
|
||||
unsigned chancount;
|
||||
unsigned flags;
|
||||
int inprog;
|
||||
void *devinfo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user