This began as an investigation of this memleak bug: https://bugs.freedesktop.org/show_bug.cgi?id=74213 It turned out that ALSA's snd_mixer API was using the hctl callbacks (and userdata) to, among other things, deallocate the data it has previously allocated. I couldn't just simply call the ALSA's callback from my own callback, because there is no API to get the current/old callback function pointer (doh!). While looking I also found a different way to accessing the mixer - by making a new "mixer class". This mixer class gets notifications, provided that the class creates its own mixer elements. Finally, with everything moved over to the "mixer class" API instead of the hctl API, we can remove a lot of "hctl_handle" variables all over. David Henningsson (3): alsa-util: Add functions for accessing mixer elements through mixer class alsa-mixer/card: Move to use the new mixer interface alsa: Remove unnecessary hctl handles being passed around src/modules/alsa/alsa-mixer.c | 14 ++--- src/modules/alsa/alsa-mixer.h | 6 +- src/modules/alsa/alsa-sink.c | 6 +- src/modules/alsa/alsa-source.c | 6 +- src/modules/alsa/alsa-ucm.c | 7 +-- src/modules/alsa/alsa-util.c | 111 ++++++++++++++++++++++++------------ src/modules/alsa/alsa-util.h | 7 +-- src/modules/alsa/module-alsa-card.c | 50 ++++++++-------- 8 files changed, 120 insertions(+), 87 deletions(-) -- 1.9.1