* [PATCH] ALSA: kunit: use const qualifier for immutable data
@ 2024-04-25 23:36 Takashi Sakamoto
2024-04-26 23:19 ` Ivan Orlov
2024-04-28 9:57 ` Takashi Iwai
0 siblings, 2 replies; 3+ messages in thread
From: Takashi Sakamoto @ 2024-04-25 23:36 UTC (permalink / raw)
To: tiwai; +Cc: linux-sound, colin.i.king
Some data for testing is immutable. In the case, the const qualifier is
available for any loader to place it to read-only segment.
Fixes: 3e39acf56ede ("ALSA: core: Add sound core KUnit test")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
sound/core/sound_kunit.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
index e34c4317f5eb..165bd0f5338a 100644
--- a/sound/core/sound_kunit.c
+++ b/sound/core/sound_kunit.c
@@ -45,7 +45,7 @@ struct avail_test_data {
snd_pcm_uframes_t expected_avail;
};
-static struct snd_format_test_data valid_fmt[] = {
+static const struct snd_format_test_data valid_fmt[] = {
DEFINE_FORMAT(S8, 8, 8, -1, 1, SILENCE()),
DEFINE_FORMAT(U8, 8, 8, -1, 0, SILENCE(0x80)),
DEFINE_FORMAT(S16_LE, 16, 16, 1, 1, SILENCE()),
@@ -154,7 +154,7 @@ static void test_format_endianness(struct kunit *test)
KUNIT_EXPECT_EQ(test, snd_pcm_format_big_endian(WRONG_FORMAT_2), -EINVAL);
}
-static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *data,
+static void _test_fill_silence(struct kunit *test, const struct snd_format_test_data *data,
u8 *buffer, size_t samples_count)
{
size_t sample_bytes = data->physical_bits >> 3;
@@ -191,7 +191,7 @@ static snd_pcm_uframes_t calculate_boundary(snd_pcm_uframes_t buffer_size)
return boundary;
}
-static struct avail_test_data p_avail_data[] = {
+static const struct avail_test_data p_avail_data[] = {
/* buf_size + hw_ptr < appl_ptr => avail = buf_size + hw_ptr - appl_ptr + boundary */
{ 128, 1000, 1129, 1073741824UL - 1 },
/*
@@ -220,7 +220,7 @@ static void test_playback_avail(struct kunit *test)
}
}
-static struct avail_test_data c_avail_data[] = {
+static const struct avail_test_data c_avail_data[] = {
/* hw_ptr - appl_ptr < 0 => avail = hw_ptr - appl_ptr + boundary */
{ 128, 1000, 1001, 1073741824UL - 1 },
/* standard case: avail = hw_ptr - appl_ptr */
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: kunit: use const qualifier for immutable data
2024-04-25 23:36 [PATCH] ALSA: kunit: use const qualifier for immutable data Takashi Sakamoto
@ 2024-04-26 23:19 ` Ivan Orlov
2024-04-28 9:57 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Ivan Orlov @ 2024-04-26 23:19 UTC (permalink / raw)
To: Takashi Sakamoto, tiwai; +Cc: linux-sound, colin.i.king
On 4/26/24 00:36, Takashi Sakamoto wrote:
> Some data for testing is immutable. In the case, the const qualifier is
> available for any loader to place it to read-only segment.
>
Hi Takashi,
Thank you for sending this patch. It would be good if you add me and
Jaroslav into the recipients list as well next time.
> Fixes: 3e39acf56ede ("ALSA: core: Add sound core KUnit test")
I'm not sure if the "Fixes" tag is applicable here, since this patch
doesn't fix a bug.
Anyway,
Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com>
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
> sound/core/sound_kunit.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
> index e34c4317f5eb..165bd0f5338a 100644
> --- a/sound/core/sound_kunit.c
> +++ b/sound/core/sound_kunit.c
> @@ -45,7 +45,7 @@ struct avail_test_data {
> snd_pcm_uframes_t expected_avail;
> };
>
> -static struct snd_format_test_data valid_fmt[] = {
> +static const struct snd_format_test_data valid_fmt[] = {
> DEFINE_FORMAT(S8, 8, 8, -1, 1, SILENCE()),
> DEFINE_FORMAT(U8, 8, 8, -1, 0, SILENCE(0x80)),
> DEFINE_FORMAT(S16_LE, 16, 16, 1, 1, SILENCE()),
> @@ -154,7 +154,7 @@ static void test_format_endianness(struct kunit *test)
> KUNIT_EXPECT_EQ(test, snd_pcm_format_big_endian(WRONG_FORMAT_2), -EINVAL);
> }
>
> -static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *data,
> +static void _test_fill_silence(struct kunit *test, const struct snd_format_test_data *data,
> u8 *buffer, size_t samples_count)
> {
> size_t sample_bytes = data->physical_bits >> 3;
> @@ -191,7 +191,7 @@ static snd_pcm_uframes_t calculate_boundary(snd_pcm_uframes_t buffer_size)
> return boundary;
> }
>
> -static struct avail_test_data p_avail_data[] = {
> +static const struct avail_test_data p_avail_data[] = {
> /* buf_size + hw_ptr < appl_ptr => avail = buf_size + hw_ptr - appl_ptr + boundary */
> { 128, 1000, 1129, 1073741824UL - 1 },
> /*
> @@ -220,7 +220,7 @@ static void test_playback_avail(struct kunit *test)
> }
> }
>
> -static struct avail_test_data c_avail_data[] = {
> +static const struct avail_test_data c_avail_data[] = {
> /* hw_ptr - appl_ptr < 0 => avail = hw_ptr - appl_ptr + boundary */
> { 128, 1000, 1001, 1073741824UL - 1 },
> /* standard case: avail = hw_ptr - appl_ptr */
--
Kind regards,
Ivan Orlov
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: kunit: use const qualifier for immutable data
2024-04-25 23:36 [PATCH] ALSA: kunit: use const qualifier for immutable data Takashi Sakamoto
2024-04-26 23:19 ` Ivan Orlov
@ 2024-04-28 9:57 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2024-04-28 9:57 UTC (permalink / raw)
To: Takashi Sakamoto; +Cc: tiwai, linux-sound, colin.i.king
On Fri, 26 Apr 2024 01:36:53 +0200,
Takashi Sakamoto wrote:
>
> Some data for testing is immutable. In the case, the const qualifier is
> available for any loader to place it to read-only segment.
>
> Fixes: 3e39acf56ede ("ALSA: core: Add sound core KUnit test")
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-28 9:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 23:36 [PATCH] ALSA: kunit: use const qualifier for immutable data Takashi Sakamoto
2024-04-26 23:19 ` Ivan Orlov
2024-04-28 9:57 ` Takashi Iwai
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.