From patchwork Wed Feb 2 15:09:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 539350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCC52C433EF for ; Wed, 2 Feb 2022 15:10:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8FB16173E; Wed, 2 Feb 2022 16:09:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8FB16173E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1643814626; bh=KyvzvDEn31PT0qnOSvFcZh8V7MfsKqbcd2rduG4Pom8=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=pxsjMpDh53m7EtOsImEyrtAukCMcA1j0kwO1GPrX8oB1OWm/T3UtmqTZw4EKdquiz SWvu/hUmn+TDcg6pBv+KM4qHSQTO1skNF4r9oTchc90dn5Vk/a4BB5bHrY+l59+Dch TM6+HapKzHnY6yLpKVJn+mTg98EYr6jtrQsoTFP8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2DBE6F802E3; Wed, 2 Feb 2022 16:09:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B43E8F80171; Wed, 2 Feb 2022 16:09:32 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A49CEF80171 for ; Wed, 2 Feb 2022 16:09:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A49CEF80171 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZHHQzpij" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D6BC61523; Wed, 2 Feb 2022 15:09:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B58E6C004E1; Wed, 2 Feb 2022 15:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643814560; bh=KyvzvDEn31PT0qnOSvFcZh8V7MfsKqbcd2rduG4Pom8=; h=From:To:Cc:Subject:Date:From; b=ZHHQzpijn0B09vRNZMrtWhqREHP/A4SOSdpHK+/UImVrj4IoE6rnJW4PoP3eMloOp nZzugADsgmkBJtzFJLF/sE4JpUmxwB0w7awlI2dCETDiowivAT8+HEG4/2cdU+6saa HT9rXZBz5s/dZUOkfexCcPUBmn2wo6dVylAELUt9tDxHQHTPcd2O2evCreolSCQXlh b9CmnC+8ApqEU97xS2KC/WHTKBfnlqpXeL927b5KB+2ib0Yc00jOlrfr5IuYf7PBIc 4P2ka/F7QJZlZ97MyW7XN8QrNpCLEWD4re176xAzvetYADWH5gfC5lRTHAzwg3W25B LdW/hrCbt+D8w== From: Mark Brown To: Jaroslav Kysela , Takashi Iwai , Shuah Khan Subject: [PATCH v3 1/2] kselftest: alsa: Check for event generation when we write to controls Date: Wed, 2 Feb 2022 15:09:01 +0000 Message-Id: <20220202150902.19563-1-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8566; h=from:subject; bh=KyvzvDEn31PT0qnOSvFcZh8V7MfsKqbcd2rduG4Pom8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBh+p53G9/WK1AVrUgEKA7MN6qNkH7J0vuzv8Brhpm8 oUaUmImJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYfqedwAKCRAk1otyXVSH0NstB/ 9ha/7PtsimFQHzOzJSvzZQ7uXOdjSazQHRNX3u5uxTWgVScYu7TMPtPfxQ+speqsmdhSEIpx9TsgvP L3vZ9J9zfxKZeSkcfLlJxPYmzU3j6gy38Fn/vbcbcgpJ6jL7YHOD7QAyYEl0QFcsVUn6BYjvXkODYe QsN55xDyOJoMEMUkmhwsowAsPtph2tBq+NGfEnpkJpleqGe4FafxuxWZJilp9q4776NXqPsWnslVsb L+Q7JfPmJLPot1FMw3cPeNEtylksWRWQYRF563woqDmnSn1mxTu6tYtDbF60UYp5WR8S6+ryUfx8jK tC3PYKUMbZWY2UFvEKpBkAXfBXHDbr X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , Shuah Khan , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add some coverage of event generation to mixer-test. Rather than doing a separate set of writes designed to trigger events we add a step to the existing write_and_verify() which checks to see if the value we read back from non-volatile controls matches the value before writing and that an event is or isn't generated as appropriate. The "tests" for events then simply check that no spurious or missing events were detected. This avoids needing further logic to generate appropriate values for each control type and maximises coverage. When checking for events we use a timeout of 0. This relies on the kernel generating any event prior to returning to userspace when setting a control. That is currently the case and it is difficult to see it changing, if it does the test will need to be updated. Using a delay of 0 means that we don't slow things down unduly when checking for no event or when events fail to be generated. We don't check behaviour for volatile controls since we can't tell what the behaviour is supposed to be for any given control. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Reviewed-by: Jaroslav Kysela --- v3: - Add a check for a removal event when monitoring for events, if one is seen then return an error. v2: - Get the numid from the API rather than using the control index. tools/testing/selftests/alsa/mixer-test.c | 154 +++++++++++++++++++++- 1 file changed, 151 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c index 0e88f4f3d802..6edb7dca32af 100644 --- a/tools/testing/selftests/alsa/mixer-test.c +++ b/tools/testing/selftests/alsa/mixer-test.c @@ -3,7 +3,7 @@ // kselftest for the ALSA mixer API // // Original author: Mark Brown -// Copyright (c) 2021 Arm Limited +// Copyright (c) 2021-2 Arm Limited // This test will iterate over all cards detected in the system, exercising // every mixer control it can find. This may conflict with other system @@ -27,11 +27,12 @@ #include "../kselftest.h" -#define TESTS_PER_CONTROL 4 +#define TESTS_PER_CONTROL 6 struct card_data { snd_ctl_t *handle; int card; + struct pollfd pollfd; int num_ctls; snd_ctl_elem_list_t *ctls; struct card_data *next; @@ -43,6 +44,8 @@ struct ctl_data { snd_ctl_elem_info_t *info; snd_ctl_elem_value_t *def_val; int elem; + int event_missing; + int event_spurious; struct card_data *card; struct ctl_data *next; }; @@ -149,6 +152,7 @@ void find_controls(void) if (!ctl_data) ksft_exit_fail_msg("Out of memory\n"); + memset(ctl_data, 0, sizeof(*ctl_data)); ctl_data->card = card_data; ctl_data->elem = ctl; ctl_data->name = snd_ctl_elem_list_get_name(card_data->ctls, @@ -184,6 +188,26 @@ void find_controls(void) ctl_list = ctl_data; } + /* Set up for events */ + err = snd_ctl_subscribe_events(card_data->handle, true); + if (err < 0) { + ksft_exit_fail_msg("snd_ctl_subscribe_events() failed for card %d: %d\n", + card, err); + } + + err = snd_ctl_poll_descriptors_count(card_data->handle); + if (err != 1) { + ksft_exit_fail_msg("Unexpected desciptor count %d for card %d\n", + err, card); + } + + err = snd_ctl_poll_descriptors(card_data->handle, + &card_data->pollfd, 1); + if (err != 1) { + ksft_exit_fail_msg("snd_ctl_poll_descriptors() failed for %d\n", + card, err); + } + next_card: if (snd_card_next(&card) < 0) { ksft_print_msg("snd_card_next"); @@ -194,6 +218,79 @@ void find_controls(void) snd_config_delete(config); } +/* + * Block for up to timeout ms for an event, returns a negative value + * on error, 0 for no event and 1 for an event. + */ +int wait_for_event(struct ctl_data *ctl, int timeout) +{ + unsigned short revents; + snd_ctl_event_t *event; + int count, err; + unsigned int mask = 0; + unsigned int ev_id; + + snd_ctl_event_alloca(&event); + + do { + err = poll(&(ctl->card->pollfd), 1, timeout); + if (err < 0) { + ksft_print_msg("poll() failed for %s: %s (%d)\n", + ctl->name, strerror(errno), errno); + return -1; + } + /* Timeout */ + if (err == 0) + return 0; + + err = snd_ctl_poll_descriptors_revents(ctl->card->handle, + &(ctl->card->pollfd), + 1, &revents); + if (err < 0) { + ksft_print_msg("snd_ctl_poll_desciptors_revents() failed for %s: %d\n", + ctl->name, err); + return err; + } + if (revents & POLLERR) { + ksft_print_msg("snd_ctl_poll_desciptors_revents() reported POLLERR for %s\n", + ctl->name); + return -1; + } + /* No read events */ + if (!(revents & POLLIN)) { + ksft_print_msg("No POLLIN\n"); + continue; + } + + err = snd_ctl_read(ctl->card->handle, event); + if (err < 0) { + ksft_print_msg("snd_ctl_read() failed for %s: %d\n", + ctl->name, err); + return err; + } + + if (snd_ctl_event_get_type(event) != SND_CTL_EVENT_ELEM) + continue; + + /* The ID returned from the event is 1 less than numid */ + mask = snd_ctl_event_elem_get_mask(event); + ev_id = snd_ctl_event_elem_get_numid(event); + if (ev_id != snd_ctl_elem_info_get_numid(ctl->info)) { + ksft_print_msg("Event for unexpected ctl %s\n", + snd_ctl_event_elem_get_name(event)); + continue; + } + + if ((mask & SND_CTL_EVENT_MASK_REMOVE) == SND_CTL_EVENT_MASK_REMOVE) { + ksft_print_msg("Removal event for %s\n", + ctl->name); + return -1; + } + } while ((mask & SND_CTL_EVENT_MASK_VALUE) != SND_CTL_EVENT_MASK_VALUE); + + return 1; +} + bool ctl_value_index_valid(struct ctl_data *ctl, snd_ctl_elem_value_t *val, int index) { @@ -428,7 +525,8 @@ int write_and_verify(struct ctl_data *ctl, { int err, i; bool error_expected, mismatch_shown; - snd_ctl_elem_value_t *read_val, *w_val; + snd_ctl_elem_value_t *initial_val, *read_val, *w_val; + snd_ctl_elem_value_alloca(&initial_val); snd_ctl_elem_value_alloca(&read_val); snd_ctl_elem_value_alloca(&w_val); @@ -446,6 +544,18 @@ int write_and_verify(struct ctl_data *ctl, snd_ctl_elem_value_copy(expected_val, write_val); } + /* Store the value before we write */ + if (snd_ctl_elem_info_is_readable(ctl->info)) { + snd_ctl_elem_value_set_id(initial_val, ctl->id); + + err = snd_ctl_elem_read(ctl->card->handle, initial_val); + if (err < 0) { + ksft_print_msg("snd_ctl_elem_read() failed: %s\n", + snd_strerror(err)); + return err; + } + } + /* * Do the write, if we have an expected value ignore the error * and carry on to validate the expected value. @@ -470,6 +580,30 @@ int write_and_verify(struct ctl_data *ctl, return err; } + /* + * Check for an event if the value changed, or confirm that + * there was none if it didn't. We rely on the kernel + * generating the notification before it returns from the + * write, this is currently true, should that ever change this + * will most likely break and need updating. + */ + if (!snd_ctl_elem_info_is_volatile(ctl->info)) { + err = wait_for_event(ctl, 0); + if (snd_ctl_elem_value_compare(initial_val, read_val)) { + if (err < 1) { + ksft_print_msg("No event generated for %s\n", + ctl->name); + ctl->event_missing++; + } + } else { + if (err != 0) { + ksft_print_msg("Spurious event generated for %s\n", + ctl->name); + ctl->event_spurious++; + } + } + } + /* * Use the libray to compare values, if there's a mismatch * carry on and try to provide a more useful diagnostic than @@ -898,6 +1032,18 @@ void test_ctl_write_invalid(struct ctl_data *ctl) ctl->card->card, ctl->elem); } +void test_ctl_event_missing(struct ctl_data *ctl) +{ + ksft_test_result(!ctl->event_missing, "event_missing.%d.%d\n", + ctl->card->card, ctl->elem); +} + +void test_ctl_event_spurious(struct ctl_data *ctl) +{ + ksft_test_result(!ctl->event_spurious, "event_spurious.%d.%d\n", + ctl->card->card, ctl->elem); +} + int main(void) { struct ctl_data *ctl; @@ -917,6 +1063,8 @@ int main(void) test_ctl_write_default(ctl); test_ctl_write_valid(ctl); test_ctl_write_invalid(ctl); + test_ctl_event_missing(ctl); + test_ctl_event_spurious(ctl); } ksft_exit_pass(); From patchwork Wed Feb 2 15:09:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 539603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 889E3C433EF for ; Wed, 2 Feb 2022 15:11:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8F2CC1749; Wed, 2 Feb 2022 16:10:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8F2CC1749 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1643814660; bh=S7cvBuUA7E92mwC6z6HrbYredDqrn9Nav7s0tks3JW4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=efrhNep0d+C7g282UI87SBdhhNafmHY3WpTLuYp82IssLJEYrx/j8jOzCB84HxEBh PgqwPr3ceeiGqJpWaX+W5aUSZ9mVZ9tZvWtXzh4sRb93xPIk1NK20I5WXgUWeCSIqe 6jz73PmLPZCZ1xFrDaBKv0wD2xOCEeKNBi4PK5I4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B01E2F804B1; Wed, 2 Feb 2022 16:09:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7B52F80130; Wed, 2 Feb 2022 16:09:32 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 13390F80130 for ; Wed, 2 Feb 2022 16:09:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 13390F80130 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qum0W52C" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F9EA6154F; Wed, 2 Feb 2022 15:09:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFAFEC340EB; Wed, 2 Feb 2022 15:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643814562; bh=S7cvBuUA7E92mwC6z6HrbYredDqrn9Nav7s0tks3JW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qum0W52CXAyKZmLKbJGPEQw7yQT7uRckra3ogUSi27qOrm9iA6Lm9nDVsj/0q5Ebz TgouP7U+PlkM33Fcu8wBMD8UJ4pSxCNmifOR5HCKMb5UsCRormI+4wvSAhphVYOsCv MkuatE3x6I40ZoAkrImfio2B6/UAniiLdOnE6dvMfCO+8VSsHjNMGXw817xYxUa42E f4jcjBnCW6MQCGm86bL6B4C/KVZvcnfcNoz6iPpEZ3JEhkC630j2RlQ32+3UWC0js/ Vw0TquwvjZW2/PuMrVl3WIjIKBHN94p+6XaT7ZvgDvXpeOcNod1GVHywXlaKqmHIST fi+BRR9GqUCWw== From: Mark Brown To: Jaroslav Kysela , Takashi Iwai , Shuah Khan Subject: [PATCH v3 2/2] kselftest: alsa: Declare most functions static Date: Wed, 2 Feb 2022 15:09:02 +0000 Message-Id: <20220202150902.19563-2-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220202150902.19563-1-broonie@kernel.org> References: <20220202150902.19563-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7362; h=from:subject; bh=S7cvBuUA7E92mwC6z6HrbYredDqrn9Nav7s0tks3JW4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBh+p54d2FCbgYPVpYhArjxg/SQX6o8Lhuqcm+IuKiv SM+tWn2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYfqeeAAKCRAk1otyXVSH0LwMB/ 4heuGa2hUDlrJtfy/1/g0NUecT/g/CHW3B1E2DitxYmuqo7nYoXeKhmP+IBIc71MvgvfQe1IaUbvGx nE8/Yg6/OAY3x6e3LUDc5M8b6F9W6s7qfkO1pi1Ox36r+GeSj+t8ONZrBKUzb0xKGgfxmNRKAH/jhI Tq0PCdhkS4WBqwQXTFEdqovfaMC3sHbQ1ZJ4PcDt7OExxlLX54Qdwi7a5lx8mVm/ao0FzQRRVXErpU Z/YhaEQyHtmzUU4lfAusd5RYfSTZrktEMiQ0nd0KIOQjGXbmhlGtpT1oGF7d+bXcdtvdP3grRXrQsM EZtBWT+FKBSdcE8xIPV9vU8NGv3RU4 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , Shuah Khan , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This program has only one file so most functions can be static. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Reviewed-by: Jaroslav Kysela --- tools/testing/selftests/alsa/mixer-test.c | 58 ++++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c index 6edb7dca32af..d0b788b8d287 100644 --- a/tools/testing/selftests/alsa/mixer-test.c +++ b/tools/testing/selftests/alsa/mixer-test.c @@ -71,7 +71,8 @@ struct ctl_data *ctl_list = NULL; #endif #ifndef LIB_HAS_LOAD_STRING -int snd_config_load_string(snd_config_t **config, const char *s, size_t size) +static int snd_config_load_string(snd_config_t **config, const char *s, + size_t size) { snd_input_t *input; snd_config_t *dst; @@ -99,7 +100,7 @@ int snd_config_load_string(snd_config_t **config, const char *s, size_t size) } #endif -void find_controls(void) +static void find_controls(void) { char name[32]; int card, ctl, err; @@ -222,7 +223,7 @@ void find_controls(void) * Block for up to timeout ms for an event, returns a negative value * on error, 0 for no event and 1 for an event. */ -int wait_for_event(struct ctl_data *ctl, int timeout) +static int wait_for_event(struct ctl_data *ctl, int timeout) { unsigned short revents; snd_ctl_event_t *event; @@ -291,8 +292,9 @@ int wait_for_event(struct ctl_data *ctl, int timeout) return 1; } -bool ctl_value_index_valid(struct ctl_data *ctl, snd_ctl_elem_value_t *val, - int index) +static bool ctl_value_index_valid(struct ctl_data *ctl, + snd_ctl_elem_value_t *val, + int index) { long int_val; long long int64_val; @@ -403,7 +405,7 @@ bool ctl_value_index_valid(struct ctl_data *ctl, snd_ctl_elem_value_t *val, * Check that the provided value meets the constraints for the * provided control. */ -bool ctl_value_valid(struct ctl_data *ctl, snd_ctl_elem_value_t *val) +static bool ctl_value_valid(struct ctl_data *ctl, snd_ctl_elem_value_t *val) { int i; bool valid = true; @@ -419,7 +421,7 @@ bool ctl_value_valid(struct ctl_data *ctl, snd_ctl_elem_value_t *val) * Check that we can read the default value and it is valid. Write * tests use the read value to restore the default. */ -void test_ctl_get_value(struct ctl_data *ctl) +static void test_ctl_get_value(struct ctl_data *ctl) { int err; @@ -454,9 +456,9 @@ void test_ctl_get_value(struct ctl_data *ctl) ctl->card->card, ctl->elem); } -bool show_mismatch(struct ctl_data *ctl, int index, - snd_ctl_elem_value_t *read_val, - snd_ctl_elem_value_t *expected_val) +static bool show_mismatch(struct ctl_data *ctl, int index, + snd_ctl_elem_value_t *read_val, + snd_ctl_elem_value_t *expected_val) { long long expected_int, read_int; @@ -519,9 +521,9 @@ bool show_mismatch(struct ctl_data *ctl, int index, * the write to fail, for verifying that invalid writes don't corrupt * anything. */ -int write_and_verify(struct ctl_data *ctl, - snd_ctl_elem_value_t *write_val, - snd_ctl_elem_value_t *expected_val) +static int write_and_verify(struct ctl_data *ctl, + snd_ctl_elem_value_t *write_val, + snd_ctl_elem_value_t *expected_val) { int err, i; bool error_expected, mismatch_shown; @@ -628,7 +630,7 @@ int write_and_verify(struct ctl_data *ctl, * Make sure we can write the default value back to the control, this * should validate that at least some write works. */ -void test_ctl_write_default(struct ctl_data *ctl) +static void test_ctl_write_default(struct ctl_data *ctl) { int err; @@ -661,7 +663,7 @@ void test_ctl_write_default(struct ctl_data *ctl) ctl->card->card, ctl->elem); } -bool test_ctl_write_valid_boolean(struct ctl_data *ctl) +static bool test_ctl_write_valid_boolean(struct ctl_data *ctl) { int err, i, j; bool fail = false; @@ -682,7 +684,7 @@ bool test_ctl_write_valid_boolean(struct ctl_data *ctl) return !fail; } -bool test_ctl_write_valid_integer(struct ctl_data *ctl) +static bool test_ctl_write_valid_integer(struct ctl_data *ctl) { int err; int i; @@ -712,7 +714,7 @@ bool test_ctl_write_valid_integer(struct ctl_data *ctl) return !fail; } -bool test_ctl_write_valid_integer64(struct ctl_data *ctl) +static bool test_ctl_write_valid_integer64(struct ctl_data *ctl) { int err, i; long long j, step; @@ -740,7 +742,7 @@ bool test_ctl_write_valid_integer64(struct ctl_data *ctl) return !fail; } -bool test_ctl_write_valid_enumerated(struct ctl_data *ctl) +static bool test_ctl_write_valid_enumerated(struct ctl_data *ctl) { int err, i, j; bool fail = false; @@ -761,7 +763,7 @@ bool test_ctl_write_valid_enumerated(struct ctl_data *ctl) return !fail; } -void test_ctl_write_valid(struct ctl_data *ctl) +static void test_ctl_write_valid(struct ctl_data *ctl) { bool pass; int err; @@ -814,8 +816,8 @@ void test_ctl_write_valid(struct ctl_data *ctl) ctl->card->card, ctl->elem); } -bool test_ctl_write_invalid_value(struct ctl_data *ctl, - snd_ctl_elem_value_t *val) +static bool test_ctl_write_invalid_value(struct ctl_data *ctl, + snd_ctl_elem_value_t *val) { int err; long val_read; @@ -836,7 +838,7 @@ bool test_ctl_write_invalid_value(struct ctl_data *ctl, return !ctl_value_valid(ctl, val); } -bool test_ctl_write_invalid_boolean(struct ctl_data *ctl) +static bool test_ctl_write_invalid_boolean(struct ctl_data *ctl) { int err, i; long val_read; @@ -855,7 +857,7 @@ bool test_ctl_write_invalid_boolean(struct ctl_data *ctl) return !fail; } -bool test_ctl_write_invalid_integer(struct ctl_data *ctl) +static bool test_ctl_write_invalid_integer(struct ctl_data *ctl) { int i; bool fail = false; @@ -901,7 +903,7 @@ bool test_ctl_write_invalid_integer(struct ctl_data *ctl) return !fail; } -bool test_ctl_write_invalid_integer64(struct ctl_data *ctl) +static bool test_ctl_write_invalid_integer64(struct ctl_data *ctl) { int i; bool fail = false; @@ -947,7 +949,7 @@ bool test_ctl_write_invalid_integer64(struct ctl_data *ctl) return !fail; } -bool test_ctl_write_invalid_enumerated(struct ctl_data *ctl) +static bool test_ctl_write_invalid_enumerated(struct ctl_data *ctl) { int err, i; unsigned int val_read; @@ -979,7 +981,7 @@ bool test_ctl_write_invalid_enumerated(struct ctl_data *ctl) } -void test_ctl_write_invalid(struct ctl_data *ctl) +static void test_ctl_write_invalid(struct ctl_data *ctl) { bool pass; int err; @@ -1032,13 +1034,13 @@ void test_ctl_write_invalid(struct ctl_data *ctl) ctl->card->card, ctl->elem); } -void test_ctl_event_missing(struct ctl_data *ctl) +static void test_ctl_event_missing(struct ctl_data *ctl) { ksft_test_result(!ctl->event_missing, "event_missing.%d.%d\n", ctl->card->card, ctl->elem); } -void test_ctl_event_spurious(struct ctl_data *ctl) +static void test_ctl_event_spurious(struct ctl_data *ctl) { ksft_test_result(!ctl->event_spurious, "event_spurious.%d.%d\n", ctl->card->card, ctl->elem);