summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2026-02-24 23:56:19 +0300
committerTakashi Iwai <tiwai@suse.de>2026-02-28 11:32:39 +0300
commit84446536f63d471ab16b2faa25eeab1df21ace0a (patch)
tree365d8b5ba9bff72a9eed854f8229a9fd863c85bb /include
parentd4d5633d8b19b0e745a7910aea49956b3b47900d (diff)
downloadlinux-84446536f63d471ab16b2faa25eeab1df21ace0a.tar.xz
ALSA: control: Verify put() result when in debug mode
The put() operation is expected to return: 1) 0 on success if no changes were made 2) 1 on success if changes were made 3) error code otherwise Currently 2) is usually ignored when writing control-operations. While forcing compliance is not an option right now, make it easier for developers to adhere to the expectations and notice problems by logging them when CONFIG_SND_CTL_DEBUG is enabled. Due to large size of struct snd_ctl_elem_value, 'value_buf' is provided as a reusable buffer for kctl->put() verification. This prevents exhausting the stack when verifying the operation. >From user perspective, patch introduces a new trace/events category 'snd_ctl' containing a single 'snd_ctl_put' event type. Log sample: amixer-1086 [003] ..... 8.035939: snd_ctl_put: success: expected=0, actual=0 for ctl numid=1, iface=MIXER, name='Master Playback Volume', index=0, device=0, subdevice=0, card=0 amixer-1087 [003] ..... 8.938721: snd_ctl_put: success: expected=1, actual=1 for ctl numid=1, iface=MIXER, name='Master Playback Volume', index=0, device=0, subdevice=0, card=0 amixer-1088 [003] ..... 9.631470: snd_ctl_put: success: expected=1, actual=1 for ctl numid=1, iface=MIXER, name='Master Playback Volume', index=0, device=0, subdevice=0, card=0 amixer-1089 [000] ..... 9.636786: snd_ctl_put: fail: expected=1, actual=0 for ctl numid=5, iface=MIXER, name='Loopback Mute', index=0, device=0, subdevice=0, card=0 Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Reviewed-by: Mark Brown <broonie@kernel.org> Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260224205619.584795-1-cezary.rojewski@intel.com
Diffstat (limited to 'include')
-rw-r--r--include/sound/core.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 64327e971122..4093ec82a0a1 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -133,6 +133,9 @@ struct snd_card {
#ifdef CONFIG_SND_DEBUG
struct dentry *debugfs_root; /* debugfs root for card */
#endif
+#ifdef CONFIG_SND_CTL_DEBUG
+ struct snd_ctl_elem_value *value_buf; /* buffer for kctl->put() verification */
+#endif
#ifdef CONFIG_PM
unsigned int power_state; /* power state */