Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2026 15:33:38 +0000
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 64ebbb1d7441 - main - sound: Retire MIXER_SIZE and use correct size in DEFINE_CLASS
Message-ID:  <6a170ed2.27266.287a6f95@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=64ebbb1d74415cb93445cc625da63449f01ac8c5

commit 64ebbb1d74415cb93445cc625da63449f01ac8c5
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-04-18 10:29:39 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-05-27 15:32:12 +0000

    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
---
 sys/dev/sound/pcm/mixer.c | 22 ----------------------
 sys/dev/sound/pcm/mixer.h | 32 ++++++++++++++++++++++++--------
 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_ */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a170ed2.27266.287a6f95>