git: 92dcd20222a2 - main - sound: Retire pcm_feederdesc->type
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 11 Nov 2025 12:08:19 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=92dcd20222a2674ba31ae09865da19d948992994
commit 92dcd20222a2674ba31ae09865da19d948992994
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-11-11 12:06:28 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-11 12:06:28 +0000
sound: Retire pcm_feederdesc->type
This is always accessed from pcm_feeder->desc->type. Instead of
duplicating this field, we can remove it from pcm_feederdesc, and access
it through pcm_feeder->class->type.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D53557
---
sys/dev/sound/pcm/feeder.c | 4 ++--
sys/dev/sound/pcm/feeder.h | 1 -
sys/dev/sound/pcm/feeder_chain.c | 6 ------
sys/dev/sound/pcm/feeder_matrix.c | 2 +-
sys/dev/sound/pcm/feeder_volume.c | 2 +-
sys/dev/sound/pcm/sndstat.c | 12 ++++++------
6 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c
index acc9e374e718..874148cd9ab0 100644
--- a/sys/dev/sound/pcm/feeder.c
+++ b/sys/dev/sound/pcm/feeder.c
@@ -97,7 +97,7 @@ feeder_create(struct feeder_class *fc, struct pcm_feederdesc *desc)
if (desc) {
*(f->desc) = *desc;
} else {
- f->desc->type = FEEDER_ROOT;
+ f->class->type = FEEDER_ROOT;
f->desc->in = 0;
f->desc->out = 0;
}
@@ -162,7 +162,7 @@ feeder_find(struct pcm_channel *c, u_int32_t type)
f = c->feeder;
while (f != NULL) {
- if (f->desc->type == type)
+ if (f->class->type == type)
return f;
f = f->source;
}
diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h
index 171168d66e4e..d191edd201e9 100644
--- a/sys/dev/sound/pcm/feeder.h
+++ b/sys/dev/sound/pcm/feeder.h
@@ -39,7 +39,6 @@ enum feeder_type {
};
struct pcm_feederdesc {
- u_int32_t type;
u_int32_t in, out;
};
diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c
index 6d896364e3ca..32dd4ca14faf 100644
--- a/sys/dev/sound/pcm/feeder_chain.c
+++ b/sys/dev/sound/pcm/feeder_chain.c
@@ -144,7 +144,6 @@ feeder_build_format(struct pcm_channel *c, struct feeder_chain_desc *cdesc)
int ret;
desc = &(cdesc->desc);
- desc->type = FEEDER_FORMAT;
desc->in = 0;
desc->out = 0;
@@ -216,7 +215,6 @@ feeder_build_rate(struct pcm_channel *c, struct feeder_chain_desc *cdesc)
return (ret);
desc = &(cdesc->desc);
- desc->type = FEEDER_RATE;
desc->in = 0;
desc->out = 0;
@@ -293,7 +291,6 @@ feeder_build_matrix(struct pcm_channel *c, struct feeder_chain_desc *cdesc)
return (ret);
desc = &(cdesc->desc);
- desc->type = FEEDER_MATRIX;
desc->in = 0;
desc->out = 0;
@@ -349,7 +346,6 @@ feeder_build_volume(struct pcm_channel *c, struct feeder_chain_desc *cdesc)
return (ret);
desc = &(cdesc->desc);
- desc->type = FEEDER_VOLUME;
desc->in = 0;
desc->out = 0;
@@ -416,7 +412,6 @@ feeder_build_eq(struct pcm_channel *c, struct feeder_chain_desc *cdesc)
return (ret);
desc = &(cdesc->desc);
- desc->type = FEEDER_EQ;
desc->in = 0;
desc->out = 0;
@@ -495,7 +490,6 @@ feeder_build_mixer(struct pcm_channel *c, struct feeder_chain_desc *cdesc)
int ret;
desc = &(cdesc->desc);
- desc->type = FEEDER_MIXER;
desc->in = 0;
desc->out = 0;
diff --git a/sys/dev/sound/pcm/feeder_matrix.c b/sys/dev/sound/pcm/feeder_matrix.c
index 7319b10930de..2c7a3e04690d 100644
--- a/sys/dev/sound/pcm/feeder_matrix.c
+++ b/sys/dev/sound/pcm/feeder_matrix.c
@@ -413,7 +413,7 @@ feeder_matrix_setup(struct pcm_feeder *f, struct pcmchan_matrix *m_in,
struct pcmchan_matrix *m_out)
{
- if (f == NULL || f->desc == NULL || f->desc->type != FEEDER_MATRIX ||
+ if (f == NULL || f->desc == NULL || f->class->type != FEEDER_MATRIX ||
f->data == NULL)
return (EINVAL);
diff --git a/sys/dev/sound/pcm/feeder_volume.c b/sys/dev/sound/pcm/feeder_volume.c
index a45003849034..101cc7ba003b 100644
--- a/sys/dev/sound/pcm/feeder_volume.c
+++ b/sys/dev/sound/pcm/feeder_volume.c
@@ -332,7 +332,7 @@ feeder_volume_apply_matrix(struct pcm_feeder *f, struct pcmchan_matrix *m)
struct feed_volume_info *info;
uint32_t i;
- if (f == NULL || f->desc == NULL || f->desc->type != FEEDER_VOLUME ||
+ if (f == NULL || f->desc == NULL || f->class->type != FEEDER_VOLUME ||
f->data == NULL || m == NULL || m->channels < SND_CHN_MIN ||
m->channels > SND_CHN_MAX)
return (EINVAL);
diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c
index b5e52aa13a19..a7c53ac85eb8 100644
--- a/sys/dev/sound/pcm/sndstat.c
+++ b/sys/dev/sound/pcm/sndstat.c
@@ -533,12 +533,12 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
f = f->source;
while (f != NULL) {
sbuf_printf(&sb, "%s", f->class->name);
- if (f->desc->type == FEEDER_FORMAT) {
+ if (f->class->type == FEEDER_FORMAT) {
snd_afmt2str(f->desc->in, buf, sizeof(buf));
sbuf_printf(&sb, "(%s -> ", buf);
snd_afmt2str(f->desc->out, buf, sizeof(buf));
sbuf_printf(&sb, "%s)", buf);
- } else if (f->desc->type == FEEDER_MATRIX) {
+ } else if (f->class->type == FEEDER_MATRIX) {
sbuf_printf(&sb, "(%d.%dch -> %d.%dch)",
AFMT_CHANNEL(f->desc->in) -
AFMT_EXTCHANNEL(f->desc->in),
@@ -546,7 +546,7 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip)
AFMT_CHANNEL(f->desc->out) -
AFMT_EXTCHANNEL(f->desc->out),
AFMT_EXTCHANNEL(f->desc->out));
- } else if (f->desc->type == FEEDER_RATE) {
+ } else if (f->class->type == FEEDER_RATE) {
sbuf_printf(&sb, "(%d -> %d)",
FEEDER_GET(f, FEEDRATE_SRC),
FEEDER_GET(f, FEEDRATE_DST));
@@ -1328,10 +1328,10 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose)
f = f->source;
while (f != NULL) {
sbuf_printf(s, "%s", f->class->name);
- if (f->desc->type == FEEDER_FORMAT) {
+ if (f->class->type == FEEDER_FORMAT) {
sbuf_printf(s, "(0x%08x -> 0x%08x)",
f->desc->in, f->desc->out);
- } else if (f->desc->type == FEEDER_MATRIX) {
+ } else if (f->class->type == FEEDER_MATRIX) {
sbuf_printf(s, "(%d.%d -> %d.%d)",
AFMT_CHANNEL(f->desc->in) -
AFMT_EXTCHANNEL(f->desc->in),
@@ -1339,7 +1339,7 @@ sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose)
AFMT_CHANNEL(f->desc->out) -
AFMT_EXTCHANNEL(f->desc->out),
AFMT_EXTCHANNEL(f->desc->out));
- } else if (f->desc->type == FEEDER_RATE) {
+ } else if (f->class->type == FEEDER_RATE) {
sbuf_printf(s,
"(0x%08x q:%d %d -> %d)",
f->desc->out,