On 12/8/21 2:17 PM, Mark Brown wrote:
From: Takashi Sakamoto o-takashi@sakamocchi.jp
The volatile attribute of control element means that the hardware can voluntarily change the state of control element independent of any operation by software. ALSA control core necessarily sends notification to userspace subscribers for any change from userspace application, while it doesn't for the hardware's voluntary change.
This commit adds optimization for the attribute. Even if read value is different from written value, the test reports success as long as the target control element has the attribute. On the other hand, the difference is itself reported for developers' convenience.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp Link: https://lore.kernel.org/r/Ya7TAHdMe9i41bsC@workstation Signed-off-by: Mark Brown broonie@kernel.org
tools/testing/selftests/alsa/mixer-test.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c index ab51cf7b9e03..171d33692c7b 100644 --- a/tools/testing/selftests/alsa/mixer-test.c +++ b/tools/testing/selftests/alsa/mixer-test.c @@ -307,9 +307,13 @@ bool show_mismatch(struct ctl_data *ctl, int index, }
if (expected_int != read_int) {
ksft_print_msg("%s.%d expected %lld but read %lld\n",
ctl->name, index, expected_int, read_int);
return true;
// NOTE: The volatile attribute means that the hardware can voluntarily change the
// state of control element independent of any operation by software.
Let's stick to kernel comment format :)
bool is_volatile = snd_ctl_elem_info_is_volatile(ctl->info);
ksft_print_msg("%s.%d expected %lld but read %lld, is_volatile %d\n",
ctl->name, index, expected_int, read_int, is_volatile);
} else { return false; }return !is_volatile;
With that change:
Reviewed-by: Shuah Khan skhan@linuxfoundation.org
thanks, -- Shuah