1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

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
This commit is contained in:
Christos Margiolis
2026-04-18 12:29:39 +02:00
parent 5589a7499a
commit 64ebbb1d74
2 changed files with 24 additions and 30 deletions
-22
View File
@@ -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,
+24 -8
View File
@@ -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_ */