aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2025-11-11 12:05:07 +0000
committerChristos Margiolis <christos@FreeBSD.org>2025-11-11 12:05:07 +0000
commit482d0d97885506a5eb2b1f2501f65e7e4fca6fdc (patch)
tree36aba125f37611af7f411d4ac4db619cdb954647
parent55540ebc33ad9a52bc4de121cb598243153981a8 (diff)
sound: Re-arrange sndbuf_create() arguments
Since we always use the channel name as the "drv" argument, we can just get rid of it and fetch it in sndbuf_create(). Also, put the "channel" argument first, as it is more intuitive. No functional change intended. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D53520
-rw-r--r--sys/dev/sound/pcm/buffer.c4
-rw-r--r--sys/dev/sound/pcm/buffer.h2
-rw-r--r--sys/dev/sound/pcm/channel.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c
index 0b77ab599aed..b162da97f9e2 100644
--- a/sys/dev/sound/pcm/buffer.c
+++ b/sys/dev/sound/pcm/buffer.c
@@ -41,12 +41,12 @@
#include "snd_fxdiv_gen.h"
struct snd_dbuf *
-sndbuf_create(char *drv, char *desc, struct pcm_channel *channel)
+sndbuf_create(struct pcm_channel *channel, const char *desc)
{
struct snd_dbuf *b;
b = malloc(sizeof(*b), M_DEVBUF, M_WAITOK | M_ZERO);
- snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", drv, desc);
+ snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", channel->name, desc);
b->channel = channel;
return b;
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index eaca6d8f313d..329a41d0b0a5 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -54,7 +54,7 @@ struct snd_dbuf {
char name[SNDBUF_NAMELEN];
};
-struct snd_dbuf *sndbuf_create(char *drv, char *desc, struct pcm_channel *channel);
+struct snd_dbuf *sndbuf_create(struct pcm_channel *channel, const char *desc);
void sndbuf_destroy(struct snd_dbuf *b);
void sndbuf_dump(struct snd_dbuf *b, char *s, u_int32_t what);
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index e7c0779ea2df..749ee4d9cdba 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -1269,8 +1269,8 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls,
goto fail;
}
- b = sndbuf_create(c->name, "primary", c);
- bs = sndbuf_create(c->name, "secondary", c);
+ b = sndbuf_create(c, "primary");
+ bs = sndbuf_create(c, "secondary");
if (b == NULL || bs == NULL) {
device_printf(d->dev, "%s(): failed to create %s buffer\n",
__func__, b == NULL ? "hardware" : "software");