aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2026-04-18 10:29:39 +0000
committerChristos Margiolis <christos@FreeBSD.org>2026-05-27 15:32:12 +0000
commit64ebbb1d74415cb93445cc625da63449f01ac8c5 (patch)
tree2a0ffdae21054c45f5cb06b53747b8010c7551f5
parent5589a7499add5912a88e9424b0aec843e099fb60 (diff)
sound: Retire MIXER_SIZE and use correct size in DEFINE_CLASS
I am not sure why this hack was needed, but the size should be sizeof(struct snd_mixer). Unfortunately, we have to expose snd_mixer, but it should be better than relying on a hack. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18
-rw-r--r--sys/dev/sound/pcm/mixer.c22
-rw-r--r--sys/dev/sound/pcm/mixer.h32
2 files changed, 24 insertions, 30 deletions
diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index e61371d13610..8d96486c862b 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -37,28 +37,6 @@
#include "feeder_if.h"
#include "mixer_if.h"
-#define MIXER_NAMELEN 16
-struct snd_mixer {
- KOBJ_FIELDS;
- void *devinfo;
- int hwvol_mixer;
- int hwvol_step;
- int type;
- device_t dev;
- u_int32_t devs;
- u_int32_t mutedevs;
- u_int32_t recdevs;
- u_int32_t recsrc;
- u_int16_t level[32];
- u_int16_t level_muted[32];
- u_int8_t parent[32];
- u_int32_t child[32];
- u_int8_t realdev[32];
- char name[MIXER_NAMELEN];
- struct mtx lock;
- int modify_counter;
-};
-
static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVICES] = {
[SOUND_MIXER_VOLUME] = 75,
[SOUND_MIXER_BASS] = 50,
diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h
index b16256862b4f..34f0514c6271 100644
--- a/sys/dev/sound/pcm/mixer.h
+++ b/sys/dev/sound/pcm/mixer.h
@@ -30,6 +30,28 @@
#ifndef _PCM_MIXER_H_
#define _PCM_MIXER_H_
+#define MIXER_NAMELEN 16
+struct snd_mixer {
+ KOBJ_FIELDS;
+ void *devinfo;
+ int hwvol_mixer;
+ int hwvol_step;
+ int type;
+ device_t dev;
+ u_int32_t devs;
+ u_int32_t mutedevs;
+ u_int32_t recdevs;
+ u_int32_t recsrc;
+ u_int16_t level[32];
+ u_int16_t level_muted[32];
+ u_int8_t parent[32];
+ u_int32_t child[32];
+ u_int8_t realdev[32];
+ char name[MIXER_NAMELEN];
+ struct mtx lock;
+ int modify_counter;
+};
+
struct snd_mixer *mixer_create(device_t dev, kobj_class_t cls, void *devinfo,
const char *desc);
int mixer_delete(struct snd_mixer *m);
@@ -65,13 +87,7 @@ void *mix_getdevinfo(struct snd_mixer *m);
#define MIXER_TYPE_PRIMARY 0 /* mixer_init() */
#define MIXER_TYPE_SECONDARY 1 /* mixer_create() */
-/*
- * this is a kludge to allow hiding of the struct snd_mixer definition
- * 512 should be enough for all architectures
- */
-#define MIXER_SIZE (512 + sizeof(struct kobj) + \
- sizeof(oss_mixer_enuminfo))
-
-#define MIXER_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, MIXER_SIZE)
+#define MIXER_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, \
+ sizeof(struct snd_mixer))
#endif /* _PCM_MIXER_H_ */