From: Mark Brown <broonie@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Shuah Khan <shuah@kernel.org>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
linux-kselftest@vger.kernel.org
Subject: [PATCH v2 2/2] kselftest: alsa: Declare most functions static
Date: Wed, 2 Feb 2022 14:10:11 +0000 [thread overview]
Message-ID: <20220202141011.14924-2-broonie@kernel.org> (raw)
In-Reply-To: <20220202141011.14924-1-broonie@kernel.org>
This program has only one file so most functions can be static.
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
---
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 79ffbca429ee..ac40c7d17152 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;
@@ -285,8 +286,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;
@@ -397,7 +399,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;
@@ -413,7 +415,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;
@@ -448,9 +450,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;
@@ -513,9 +515,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;
@@ -622,7 +624,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;
@@ -655,7 +657,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;
@@ -676,7 +678,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;
@@ -706,7 +708,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;
@@ -734,7 +736,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;
@@ -755,7 +757,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;
@@ -808,8 +810,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;
@@ -830,7 +832,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;
@@ -849,7 +851,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;
@@ -895,7 +897,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;
@@ -941,7 +943,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;
@@ -973,7 +975,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;
@@ -1026,13 +1028,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);
--
2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Shuah Khan <shuah@kernel.org>
Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
Mark Brown <broonie@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: [PATCH v2 2/2] kselftest: alsa: Declare most functions static
Date: Wed, 2 Feb 2022 14:10:11 +0000 [thread overview]
Message-ID: <20220202141011.14924-2-broonie@kernel.org> (raw)
In-Reply-To: <20220202141011.14924-1-broonie@kernel.org>
This program has only one file so most functions can be static.
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
---
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 79ffbca429ee..ac40c7d17152 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;
@@ -285,8 +286,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;
@@ -397,7 +399,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;
@@ -413,7 +415,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;
@@ -448,9 +450,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;
@@ -513,9 +515,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;
@@ -622,7 +624,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;
@@ -655,7 +657,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;
@@ -676,7 +678,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;
@@ -706,7 +708,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;
@@ -734,7 +736,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;
@@ -755,7 +757,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;
@@ -808,8 +810,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;
@@ -830,7 +832,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;
@@ -849,7 +851,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;
@@ -895,7 +897,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;
@@ -941,7 +943,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;
@@ -973,7 +975,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;
@@ -1026,13 +1028,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);
--
2.30.2
next prev parent reply other threads:[~2022-02-02 14:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 14:10 [PATCH v2 1/2] kselftest: alsa: Check for event generation when we write to controls Mark Brown
2022-02-02 14:10 ` Mark Brown
2022-02-02 14:10 ` Mark Brown [this message]
2022-02-02 14:10 ` [PATCH v2 2/2] kselftest: alsa: Declare most functions static Mark Brown
2022-02-02 14:43 ` Jaroslav Kysela
2022-02-02 14:43 ` Jaroslav Kysela
2022-02-02 14:42 ` [PATCH v2 1/2] kselftest: alsa: Check for event generation when we write to controls Jaroslav Kysela
2022-02-02 14:42 ` Jaroslav Kysela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220202141011.14924-2-broonie@kernel.org \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.