mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
various fixes to eliminate locking warnings
Approved by: re Reviewed by: orion
This commit is contained in:
parent
68f4e7f1d3
commit
67beb5a5c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107237
@ -143,7 +143,7 @@ sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
|
|||||||
b->bufsize = blkcnt * blksz;
|
b->bufsize = blkcnt * blksz;
|
||||||
if (b->tmpbuf)
|
if (b->tmpbuf)
|
||||||
free(b->tmpbuf, M_DEVBUF);
|
free(b->tmpbuf, M_DEVBUF);
|
||||||
b->tmpbuf = malloc(b->bufsize, M_DEVBUF, M_WAITOK);
|
b->tmpbuf = malloc(b->bufsize, M_DEVBUF, M_NOWAIT);
|
||||||
sndbuf_reset(b);
|
sndbuf_reset(b);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -151,26 +151,38 @@ sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
|
|||||||
int
|
int
|
||||||
sndbuf_remalloc(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
|
sndbuf_remalloc(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
|
||||||
{
|
{
|
||||||
|
u_int8_t *buf, *tmpbuf, *f1, *f2;
|
||||||
|
unsigned int bufsize;
|
||||||
|
|
||||||
if (blkcnt < 2 || blksz < 16)
|
if (blkcnt < 2 || blksz < 16)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
bufsize = blksz * blkcnt;
|
||||||
|
|
||||||
|
|
||||||
|
buf = malloc(bufsize, M_DEVBUF, M_NOWAIT);
|
||||||
|
if (buf == NULL)
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
tmpbuf = malloc(bufsize, M_DEVBUF, M_NOWAIT);
|
||||||
|
if (tmpbuf == NULL) {
|
||||||
|
free(buf, M_DEVBUF);
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
b->blkcnt = blkcnt;
|
b->blkcnt = blkcnt;
|
||||||
b->blksz = blksz;
|
b->blksz = blksz;
|
||||||
|
b->bufsize = bufsize;
|
||||||
|
b->maxsize = bufsize;
|
||||||
|
f1 = b->buf;
|
||||||
|
f2 = b->tmpbuf;
|
||||||
|
b->buf = buf;
|
||||||
|
b->tmpbuf = tmpbuf;
|
||||||
|
|
||||||
b->maxsize = blkcnt * blksz;
|
if (f1)
|
||||||
b->bufsize = b->maxsize;
|
free(f1, M_DEVBUF);
|
||||||
|
if (f2)
|
||||||
if (b->buf)
|
free(f2, M_DEVBUF);
|
||||||
free(b->buf, M_DEVBUF);
|
|
||||||
b->buf = malloc(b->bufsize, M_DEVBUF, M_WAITOK);
|
|
||||||
if (b->buf == NULL)
|
|
||||||
return ENOMEM;
|
|
||||||
|
|
||||||
if (b->tmpbuf)
|
|
||||||
free(b->tmpbuf, M_DEVBUF);
|
|
||||||
b->tmpbuf = malloc(b->bufsize, M_DEVBUF, M_WAITOK);
|
|
||||||
if (b->tmpbuf == NULL)
|
|
||||||
return ENOMEM;
|
|
||||||
|
|
||||||
sndbuf_reset(b);
|
sndbuf_reset(b);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -674,7 +674,6 @@ chn_init(struct pcm_channel *c, void *devinfo, int dir)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
chn_lockinit(c);
|
chn_lockinit(c);
|
||||||
CHN_LOCK(c);
|
|
||||||
|
|
||||||
b = NULL;
|
b = NULL;
|
||||||
bs = NULL;
|
bs = NULL;
|
||||||
@ -739,7 +738,6 @@ chn_init(struct pcm_channel *c, void *devinfo, int dir)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHN_UNLOCK(c);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +747,6 @@ chn_kill(struct pcm_channel *c)
|
|||||||
struct snd_dbuf *b = c->bufhard;
|
struct snd_dbuf *b = c->bufhard;
|
||||||
struct snd_dbuf *bs = c->bufsoft;
|
struct snd_dbuf *bs = c->bufsoft;
|
||||||
|
|
||||||
CHN_LOCK(c);
|
|
||||||
if (c->flags & CHN_F_TRIGGERED)
|
if (c->flags & CHN_F_TRIGGERED)
|
||||||
chn_trigger(c, PCMTRIG_ABORT);
|
chn_trigger(c, PCMTRIG_ABORT);
|
||||||
while (chn_removefeeder(c) == 0);
|
while (chn_removefeeder(c) == 0);
|
||||||
@ -929,7 +926,7 @@ chn_setblocksize(struct pcm_channel *c, int blkcnt, int blksz)
|
|||||||
blkcnt = CHN_2NDBUFMAXSIZE / blksz;
|
blkcnt = CHN_2NDBUFMAXSIZE / blksz;
|
||||||
|
|
||||||
RANGE(blksz, 16, CHN_2NDBUFMAXSIZE / 2);
|
RANGE(blksz, 16, CHN_2NDBUFMAXSIZE / 2);
|
||||||
RANGE(blkcnt, 2, CHN_2NDBUFMAXSIZE / blksz);
|
RANGE(blkcnt, 2, CHN_2NDBUFMAXSIZE / blksz);
|
||||||
DEB(printf("%s: defaulting to (%d, %d)\n", __func__, blkcnt, blksz));
|
DEB(printf("%s: defaulting to (%d, %d)\n", __func__, blkcnt, blksz));
|
||||||
} else {
|
} else {
|
||||||
blkcnt = sndbuf_getblkcnt(bs);
|
blkcnt = sndbuf_getblkcnt(bs);
|
||||||
@ -946,10 +943,9 @@ chn_setblocksize(struct pcm_channel *c, int blkcnt, int blksz)
|
|||||||
|
|
||||||
bufsz = blkcnt * blksz;
|
bufsz = blkcnt * blksz;
|
||||||
|
|
||||||
ret = ENOMEM;
|
ret = sndbuf_remalloc(bs, blkcnt, blksz);
|
||||||
if (sndbuf_remalloc(bs, blkcnt, blksz))
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
/* adjust for different hw format/speed */
|
/* adjust for different hw format/speed */
|
||||||
irqhz = (sndbuf_getbps(bs) * sndbuf_getspd(bs)) / sndbuf_getblksz(bs);
|
irqhz = (sndbuf_getbps(bs) * sndbuf_getspd(bs)) / sndbuf_getblksz(bs);
|
||||||
@ -1127,6 +1123,14 @@ chn_buildfeeder(struct pcm_channel *c)
|
|||||||
tmp[1] = 0;
|
tmp[1] = 0;
|
||||||
hwfmt = chn_fmtchain(c, tmp);
|
hwfmt = chn_fmtchain(c, tmp);
|
||||||
} else {
|
} else {
|
||||||
|
#if 0
|
||||||
|
u_int32_t *x = chn_getcaps(c)->fmtlist;
|
||||||
|
printf("acceptable formats for %s:\n", c->name);
|
||||||
|
while (*x) {
|
||||||
|
printf("[%8x] ", *x);
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
hwfmt = chn_fmtchain(c, chn_getcaps(c)->fmtlist);
|
hwfmt = chn_fmtchain(c, chn_getcaps(c)->fmtlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ feeder_create(struct feeder_class *fc, struct pcm_feederdesc *desc)
|
|||||||
struct pcm_feeder *f;
|
struct pcm_feeder *f;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
f = (struct pcm_feeder *)kobj_create((kobj_class_t)fc, M_FEEDER, M_WAITOK | M_ZERO);
|
f = (struct pcm_feeder *)kobj_create((kobj_class_t)fc, M_FEEDER, M_NOWAIT | M_ZERO);
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ FEEDER_DECLARE(feeder_8to16le, 0, NULL);
|
|||||||
static int
|
static int
|
||||||
feed_16to8_init(struct pcm_feeder *f)
|
feed_16to8_init(struct pcm_feeder *f)
|
||||||
{
|
{
|
||||||
f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO);
|
f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_NOWAIT | M_ZERO);
|
||||||
return (f->data)? 0 : ENOMEM;
|
return (f->data)? 0 : ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ FEEDER_DECLARE(feeder_monotostereo16, 0, NULL);
|
|||||||
static int
|
static int
|
||||||
feed_stereotomono8_init(struct pcm_feeder *f)
|
feed_stereotomono8_init(struct pcm_feeder *f)
|
||||||
{
|
{
|
||||||
f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO);
|
f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_NOWAIT | M_ZERO);
|
||||||
return (f->data)? 0 : ENOMEM;
|
return (f->data)? 0 : ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ FEEDER_DECLARE(feeder_stereotomono8, 1, NULL);
|
|||||||
static int
|
static int
|
||||||
feed_stereotomono16_init(struct pcm_feeder *f)
|
feed_stereotomono16_init(struct pcm_feeder *f)
|
||||||
{
|
{
|
||||||
f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_WAITOK | M_ZERO);
|
f->data = malloc(FEEDBUFSZ, M_FMTFEEDER, M_NOWAIT | M_ZERO);
|
||||||
return (f->data)? 0 : ENOMEM;
|
return (f->data)? 0 : ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ feed_rate_init(struct pcm_feeder *f)
|
|||||||
{
|
{
|
||||||
struct feed_rate_info *info;
|
struct feed_rate_info *info;
|
||||||
|
|
||||||
info = malloc(sizeof(*info), M_RATEFEEDER, M_WAITOK | M_ZERO);
|
info = malloc(sizeof(*info), M_RATEFEEDER, M_NOWAIT | M_ZERO);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
info->buffer = malloc(FEEDBUFSZ, M_RATEFEEDER, M_WAITOK | M_ZERO);
|
info->buffer = malloc(FEEDBUFSZ, M_RATEFEEDER, M_NOWAIT | M_ZERO);
|
||||||
if (info->buffer == NULL) {
|
if (info->buffer == NULL) {
|
||||||
free(info, M_RATEFEEDER);
|
free(info, M_RATEFEEDER);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
@ -261,9 +261,9 @@ sndstat_unregister(device_t dev)
|
|||||||
SLIST_FOREACH(ent, &sndstat_devlist, link) {
|
SLIST_FOREACH(ent, &sndstat_devlist, link) {
|
||||||
if (ent->dev == dev) {
|
if (ent->dev == dev) {
|
||||||
SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link);
|
SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link);
|
||||||
free(ent, M_DEVBUF);
|
|
||||||
mtx_unlock(&sndstat_lock);
|
mtx_unlock(&sndstat_lock);
|
||||||
splx(s);
|
splx(s);
|
||||||
|
free(ent, M_DEVBUF);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -285,10 +285,10 @@ sndstat_unregisterfile(char *str)
|
|||||||
SLIST_FOREACH(ent, &sndstat_devlist, link) {
|
SLIST_FOREACH(ent, &sndstat_devlist, link) {
|
||||||
if (ent->dev == NULL && ent->str == str) {
|
if (ent->dev == NULL && ent->str == str) {
|
||||||
SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link);
|
SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link);
|
||||||
free(ent, M_DEVBUF);
|
|
||||||
sndstat_files--;
|
sndstat_files--;
|
||||||
mtx_unlock(&sndstat_lock);
|
mtx_unlock(&sndstat_lock);
|
||||||
splx(s);
|
splx(s);
|
||||||
|
free(ent, M_DEVBUF);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ snd_mtxfree(void *m)
|
|||||||
#ifdef USING_MUTEX
|
#ifdef USING_MUTEX
|
||||||
struct mtx *mtx = m;
|
struct mtx *mtx = m;
|
||||||
|
|
||||||
mtx_assert(mtx, MA_OWNED);
|
/* mtx_assert(mtx, MA_OWNED); */
|
||||||
mtx_destroy(mtx);
|
mtx_destroy(mtx);
|
||||||
free(mtx, M_DEVBUF);
|
free(mtx, M_DEVBUF);
|
||||||
#endif
|
#endif
|
||||||
@ -124,7 +124,7 @@ snd_mtxassert(void *m)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void
|
void
|
||||||
snd_mtxlock(void *m)
|
snd_mtxlock(void *m)
|
||||||
{
|
{
|
||||||
@ -144,7 +144,7 @@ snd_mtxunlock(void *m)
|
|||||||
mtx_unlock(mtx);
|
mtx_unlock(mtx);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand, void *param, void **cookiep)
|
snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand, void *param, void **cookiep)
|
||||||
{
|
{
|
||||||
@ -375,20 +375,24 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snd_mtxlock(d->lock);
|
||||||
ch->num = (*pnum)++;
|
ch->num = (*pnum)++;
|
||||||
|
snd_mtxunlock(d->lock);
|
||||||
|
|
||||||
ch->pid = -1;
|
ch->pid = -1;
|
||||||
ch->parentsnddev = d;
|
ch->parentsnddev = d;
|
||||||
ch->parentchannel = parent;
|
ch->parentchannel = parent;
|
||||||
ch->dev = d->dev;
|
ch->dev = d->dev;
|
||||||
snprintf(ch->name, 32, "%s:%s:%d", device_get_nameunit(d->dev), dirs, ch->num);
|
snprintf(ch->name, 32, "%s:%s:%d", device_get_nameunit(ch->dev), dirs, ch->num);
|
||||||
|
|
||||||
err = chn_init(ch, devinfo, dir);
|
err = chn_init(ch, devinfo, dir);
|
||||||
if (err) {
|
if (err) {
|
||||||
device_printf(d->dev, "chn_init(%s) failed: err = %d\n", ch->name, err);
|
device_printf(d->dev, "chn_init(%s) failed: err = %d\n", ch->name, err);
|
||||||
kobj_delete(ch->methods, M_DEVBUF);
|
kobj_delete(ch->methods, M_DEVBUF);
|
||||||
free(ch, M_DEVBUF);
|
free(ch, M_DEVBUF);
|
||||||
|
snd_mtxlock(d->lock);
|
||||||
(*pnum)--;
|
(*pnum)--;
|
||||||
|
snd_mtxunlock(d->lock);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -409,13 +413,6 @@ pcm_chn_destroy(struct pcm_channel *ch)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch->direction == PCMDIR_REC)
|
|
||||||
d->reccount--;
|
|
||||||
else if (ch->flags & CHN_F_VIRTUAL)
|
|
||||||
d->vchancount--;
|
|
||||||
else
|
|
||||||
d->playcount--;
|
|
||||||
|
|
||||||
kobj_delete(ch->methods, M_DEVBUF);
|
kobj_delete(ch->methods, M_DEVBUF);
|
||||||
free(ch, M_DEVBUF);
|
free(ch, M_DEVBUF);
|
||||||
|
|
||||||
@ -427,6 +424,7 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
|
|||||||
{
|
{
|
||||||
struct snddev_channel *sce, *tmp, *after;
|
struct snddev_channel *sce, *tmp, *after;
|
||||||
int unit = device_get_unit(d->dev);
|
int unit = device_get_unit(d->dev);
|
||||||
|
int x = -1;
|
||||||
|
|
||||||
sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
|
sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||||
if (!sce) {
|
if (!sce) {
|
||||||
@ -434,7 +432,6 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
snd_mtxlock(d->lock);
|
snd_mtxlock(d->lock);
|
||||||
|
|
||||||
sce->channel = ch;
|
sce->channel = ch;
|
||||||
if (SLIST_EMPTY(&d->channels)) {
|
if (SLIST_EMPTY(&d->channels)) {
|
||||||
SLIST_INSERT_HEAD(&d->channels, sce, link);
|
SLIST_INSERT_HEAD(&d->channels, sce, link);
|
||||||
@ -445,15 +442,16 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
|
|||||||
}
|
}
|
||||||
SLIST_INSERT_AFTER(after, sce, link);
|
SLIST_INSERT_AFTER(after, sce, link);
|
||||||
}
|
}
|
||||||
|
if (mkdev)
|
||||||
|
x = d->devcount++;
|
||||||
|
snd_mtxunlock(d->lock);
|
||||||
|
|
||||||
if (mkdev) {
|
if (mkdev) {
|
||||||
dsp_register(unit, d->devcount++);
|
dsp_register(unit, x);
|
||||||
if (ch->direction == PCMDIR_REC)
|
if (ch->direction == PCMDIR_REC)
|
||||||
dsp_registerrec(unit, ch->num);
|
dsp_registerrec(unit, ch->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_mtxunlock(d->lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,14 +470,21 @@ pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch, int rmdev)
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
gotit:
|
gotit:
|
||||||
SLIST_REMOVE(&d->channels, sce, snddev_channel, link);
|
SLIST_REMOVE(&d->channels, sce, snddev_channel, link);
|
||||||
free(sce, M_DEVBUF);
|
|
||||||
|
|
||||||
if (rmdev) {
|
if (rmdev) {
|
||||||
dsp_unregister(unit, --d->devcount);
|
dsp_unregister(unit, --d->devcount);
|
||||||
if (ch->direction == PCMDIR_REC)
|
if (ch->direction == PCMDIR_REC)
|
||||||
dsp_unregisterrec(unit, ch->num);
|
dsp_unregisterrec(unit, ch->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ch->direction == PCMDIR_REC)
|
||||||
|
d->reccount--;
|
||||||
|
else if (ch->flags & CHN_F_VIRTUAL)
|
||||||
|
d->vchancount--;
|
||||||
|
else
|
||||||
|
d->playcount--;
|
||||||
|
|
||||||
snd_mtxunlock(d->lock);
|
snd_mtxunlock(d->lock);
|
||||||
|
free(sce, M_DEVBUF);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -500,6 +505,7 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo)
|
|||||||
err = pcm_chn_add(d, ch, 1);
|
err = pcm_chn_add(d, ch, 1);
|
||||||
if (err) {
|
if (err) {
|
||||||
device_printf(d->dev, "pcm_chn_add(%s) failed, err=%d\n", ch->name, err);
|
device_printf(d->dev, "pcm_chn_add(%s) failed, err=%d\n", ch->name, err);
|
||||||
|
snd_mtxunlock(d->lock);
|
||||||
pcm_chn_destroy(ch);
|
pcm_chn_destroy(ch);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -613,7 +619,6 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev");
|
d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev");
|
||||||
snd_mtxlock(d->lock);
|
|
||||||
|
|
||||||
d->flags = 0;
|
d->flags = 0;
|
||||||
d->dev = dev;
|
d->dev = dev;
|
||||||
@ -647,7 +652,6 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
|
|||||||
if (numplay == 1)
|
if (numplay == 1)
|
||||||
d->flags |= SD_F_AUTOVCHAN;
|
d->flags |= SD_F_AUTOVCHAN;
|
||||||
|
|
||||||
snd_mtxunlock(d->lock);
|
|
||||||
sndstat_register(dev, d->status, sndstat_prepare_pcm);
|
sndstat_register(dev, d->status, sndstat_prepare_pcm);
|
||||||
return 0;
|
return 0;
|
||||||
no:
|
no:
|
||||||
|
@ -249,9 +249,10 @@ int snd_setup_intr(device_t dev, struct resource *res, int flags,
|
|||||||
void *snd_mtxcreate(const char *desc, const char *type);
|
void *snd_mtxcreate(const char *desc, const char *type);
|
||||||
void snd_mtxfree(void *m);
|
void snd_mtxfree(void *m);
|
||||||
void snd_mtxassert(void *m);
|
void snd_mtxassert(void *m);
|
||||||
|
/*
|
||||||
void snd_mtxlock(void *m);
|
void snd_mtxlock(void *m);
|
||||||
void snd_mtxunlock(void *m);
|
void snd_mtxunlock(void *m);
|
||||||
|
*/
|
||||||
int sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS);
|
int sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS);
|
||||||
|
|
||||||
typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose);
|
typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose);
|
||||||
@ -280,6 +281,9 @@ int sndstat_busy(void);
|
|||||||
#define DV_F_DEV_MASK 0x0000ff00 /* force device type/class */
|
#define DV_F_DEV_MASK 0x0000ff00 /* force device type/class */
|
||||||
#define DV_F_DEV_SHIFT 8 /* force device type/class */
|
#define DV_F_DEV_SHIFT 8 /* force device type/class */
|
||||||
|
|
||||||
|
#define snd_mtxlock(m) mtx_lock(m)
|
||||||
|
#define snd_mtxunlock(m) mtx_unlock(m)
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
#endif /* _OS_H_ */
|
#endif /* _OS_H_ */
|
||||||
|
@ -237,15 +237,8 @@ vchan_create(struct pcm_channel *parent)
|
|||||||
struct pcm_channel *child;
|
struct pcm_channel *child;
|
||||||
int err, first;
|
int err, first;
|
||||||
|
|
||||||
CHN_LOCK(parent);
|
|
||||||
if (!(parent->flags & CHN_F_BUSY)) {
|
|
||||||
CHN_UNLOCK(parent);
|
|
||||||
return EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
pce = malloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO);
|
pce = malloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||||
if (!pce) {
|
if (!pce) {
|
||||||
CHN_UNLOCK(parent);
|
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,10 +246,15 @@ vchan_create(struct pcm_channel *parent)
|
|||||||
child = pcm_chn_create(d, parent, &vchan_class, PCMDIR_VIRTUAL, parent);
|
child = pcm_chn_create(d, parent, &vchan_class, PCMDIR_VIRTUAL, parent);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
free(pce, M_DEVBUF);
|
free(pce, M_DEVBUF);
|
||||||
CHN_UNLOCK(parent);
|
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHN_LOCK(parent);
|
||||||
|
if (!(parent->flags & CHN_F_BUSY)) {
|
||||||
|
CHN_UNLOCK(parent);
|
||||||
|
return EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
first = SLIST_EMPTY(&parent->children);
|
first = SLIST_EMPTY(&parent->children);
|
||||||
/* add us to our parent channel's children */
|
/* add us to our parent channel's children */
|
||||||
pce->channel = child;
|
pce->channel = child;
|
||||||
@ -270,7 +268,7 @@ vchan_create(struct pcm_channel *parent)
|
|||||||
free(pce, M_DEVBUF);
|
free(pce, M_DEVBUF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX gross ugly hack, kill murder death */
|
/* XXX gross ugly hack, murder death kill */
|
||||||
if (first && !err) {
|
if (first && !err) {
|
||||||
err = chn_reset(parent, AFMT_STEREO | AFMT_S16_LE);
|
err = chn_reset(parent, AFMT_STEREO | AFMT_S16_LE);
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
Reference in New Issue
Block a user