sound: Retire channel refcount

No longer used.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D47269

(cherry picked from commit 9a6cf27583ffc13bb0a7c5be0704ba0d2f3b834d)
This commit is contained in:
Christos Margiolis 2024-10-25 13:36:59 +02:00
parent bf3a355a87
commit 6bfac3b2a3
3 changed files with 4 additions and 40 deletions

View file

@ -1435,19 +1435,6 @@ chn_release(struct pcm_channel *c)
return (0);
}
int
chn_ref(struct pcm_channel *c, int ref)
{
PCM_BUSYASSERT(c->parentsnddev);
CHN_LOCKASSERT(c);
KASSERT((c->refcount + ref) >= 0,
("%s(): new refcount will be negative", __func__));
c->refcount += ref;
return (c->refcount);
}
int
chn_setvolume_multi(struct pcm_channel *c, int vc, int left, int right,
int center)

View file

@ -84,7 +84,6 @@ struct pcm_channel {
kobj_t methods;
pid_t pid;
int refcount;
struct pcm_feeder *feeder;
u_int32_t align;
@ -266,7 +265,6 @@ struct pcm_channel *chn_init(struct snddev_info *d, struct pcm_channel *parent,
void chn_kill(struct pcm_channel *c);
void chn_shutdown(struct pcm_channel *c);
int chn_release(struct pcm_channel *c);
int chn_ref(struct pcm_channel *c, int ref);
int chn_reset(struct pcm_channel *c, u_int32_t fmt, u_int32_t spd);
int chn_setvolume_multi(struct pcm_channel *c, int vc, int left, int right,
int center);

View file

@ -168,9 +168,9 @@ static void
dsp_close(void *data)
{
struct dsp_cdevpriv *priv = data;
struct pcm_channel *rdch, *wrch, *volch;
struct pcm_channel *rdch, *wrch;
struct snddev_info *d;
int sg_ids, rdref, wdref;
int sg_ids;
if (priv == NULL)
return;
@ -188,22 +188,6 @@ dsp_close(void *data)
rdch = priv->rdch;
wrch = priv->wrch;
volch = priv->volch;
rdref = -1;
wdref = -1;
if (volch != NULL) {
if (volch == rdch)
rdref--;
else if (volch == wrch)
wdref--;
else {
CHN_LOCK(volch);
chn_ref(volch, -1);
CHN_UNLOCK(volch);
}
}
if (rdch != NULL)
CHN_REMOVE(d, rdch, channels.pcm.opened);
@ -231,7 +215,6 @@ dsp_close(void *data)
free_unr(pcmsg_unrhdr, sg_ids);
CHN_LOCK(rdch);
chn_ref(rdch, rdref);
chn_abort(rdch); /* won't sleep */
rdch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP |
CHN_F_DEAD | CHN_F_EXCLUSIVE);
@ -249,7 +232,6 @@ dsp_close(void *data)
free_unr(pcmsg_unrhdr, sg_ids);
CHN_LOCK(wrch);
chn_ref(wrch, wdref);
chn_flush(wrch); /* may sleep */
wrch->flags &= ~(CHN_F_RUNNING | CHN_F_MMAP |
CHN_F_DEAD | CHN_F_EXCLUSIVE);
@ -382,7 +364,6 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
rdch->flags |= CHN_F_NBIO;
if (flags & O_EXCL)
rdch->flags |= CHN_F_EXCLUSIVE;
chn_ref(rdch, 1);
chn_vpc_reset(rdch, SND_VOL_C_PCM, 0);
CHN_UNLOCK(rdch);
}
@ -402,11 +383,10 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
if (!DSP_F_DUPLEX(flags)) {
if (rdch != NULL) {
/*
* Lock, deref and release previously
* created record channel
* Lock, and release previously created
* record channel
*/
CHN_LOCK(rdch);
chn_ref(rdch, -1);
chn_release(rdch);
}
PCM_RELEASE_QUICK(d);
@ -419,7 +399,6 @@ dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td)
wrch->flags |= CHN_F_NBIO;
if (flags & O_EXCL)
wrch->flags |= CHN_F_EXCLUSIVE;
chn_ref(wrch, 1);
chn_vpc_reset(wrch, SND_VOL_C_PCM, 0);
CHN_UNLOCK(wrch);
}