git: c30f531ddb62 - main - sound: Shorten channel names
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Oct 2024 08:45:03 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=c30f531ddb629ab51359fb540c8ef6068bab288b
commit c30f531ddb629ab51359fb540c8ef6068bab288b
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-10-18 08:40:50 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-10-18 08:40:50 +0000
sound: Shorten channel names
The current channel naming convention is:
pcmX:[virtual_]play|record:dspX.[v]p|rY
- pcmX and dspX share the same unit numbers
- "[v]p|r" gives us the same information as "[virtual_]play|record"
Remove the redundant information, so that the channel names become more
readable: dspX.[virtual_]play|record.Y
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D46836
---
sys/dev/sound/pcm/channel.c | 10 ++--------
sys/dev/sound/pcm/dsp.c | 20 ++++++++++----------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 5b0bb105c505..1e68be161322 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -1182,7 +1182,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls,
struct pcm_channel *c;
struct feeder_class *fc;
struct snd_dbuf *b, *bs;
- char *dirs, buf[CHN_NAMELEN];
+ char buf[CHN_NAMELEN];
int i, direction, type;
PCM_BUSYASSERT(d);
@@ -1190,22 +1190,18 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls,
switch (dir) {
case PCMDIR_PLAY:
- dirs = "play";
direction = PCMDIR_PLAY;
type = SND_DEV_DSPHW_PLAY;
break;
case PCMDIR_PLAY_VIRTUAL:
- dirs = "virtual_play";
direction = PCMDIR_PLAY;
type = SND_DEV_DSPHW_VPLAY;
break;
case PCMDIR_REC:
- dirs = "record";
direction = PCMDIR_REC;
type = SND_DEV_DSPHW_REC;
break;
case PCMDIR_REC_VIRTUAL:
- dirs = "virtual_record";
direction = PCMDIR_REC;
type = SND_DEV_DSPHW_VREC;
break;
@@ -1239,9 +1235,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls,
c->dev = d->dev;
c->trigger = PCMTRIG_STOP;
- snprintf(c->name, sizeof(c->name), "%s:%s:%s",
- device_get_nameunit(c->dev), dirs,
- dsp_unit2name(buf, sizeof(buf), c));
+ strlcpy(c->name, dsp_unit2name(buf, sizeof(buf), c), sizeof(c->name));
c->matrix = *feeder_matrix_id_map(SND_CHN_MATRIX_1_0);
c->matrix.id = SND_CHN_MATRIX_PCMCHANNEL;
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 2b765bc8b115..bf68f64929c3 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -170,17 +170,17 @@ static const struct {
char *sep;
char *alias;
} dsp_cdevs[] = {
- { SND_DEV_DSP, "dsp", ".", NULL },
- { SND_DEV_DSPHW_PLAY, "dsp", ".p", NULL },
- { SND_DEV_DSPHW_VPLAY, "dsp", ".vp", NULL },
- { SND_DEV_DSPHW_REC, "dsp", ".r", NULL },
- { SND_DEV_DSPHW_VREC, "dsp", ".vr", NULL },
+ { SND_DEV_DSP, "dsp", ".", NULL },
+ { SND_DEV_DSPHW_PLAY, "dsp", ".play.", NULL },
+ { SND_DEV_DSPHW_VPLAY, "dsp", ".virtual_play.", NULL },
+ { SND_DEV_DSPHW_REC, "dsp", ".record.", NULL },
+ { SND_DEV_DSPHW_VREC, "dsp", ".virtual_record.", NULL },
/* Low priority, OSSv4 aliases. */
- { SND_DEV_DSP, "dsp_ac3", ".", "dsp" },
- { SND_DEV_DSP, "dsp_mmap", ".", "dsp" },
- { SND_DEV_DSP, "dsp_multich", ".", "dsp" },
- { SND_DEV_DSP, "dsp_spdifout", ".", "dsp" },
- { SND_DEV_DSP, "dsp_spdifin", ".", "dsp" },
+ { SND_DEV_DSP, "dsp_ac3", ".", "dsp" },
+ { SND_DEV_DSP, "dsp_mmap", ".", "dsp" },
+ { SND_DEV_DSP, "dsp_multich", ".", "dsp" },
+ { SND_DEV_DSP, "dsp_spdifout", ".", "dsp" },
+ { SND_DEV_DSP, "dsp_spdifin", ".", "dsp" },
};
static void