Skip to content

Commit 078c95f

Browse files
takaswietiwai
authored andcommitted
ALSA: kunit: use const qualifier for immutable data
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: 3e39acf ("ALSA: core: Add sound core KUnit test") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Message-ID: <20240425233653.218434-1-o-takashi@sakamocchi.jp>
1 parent 957a36c commit 078c95f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sound/core/sound_kunit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct avail_test_data {
4545
snd_pcm_uframes_t expected_avail;
4646
};
4747

48-
static struct snd_format_test_data valid_fmt[] = {
48+
static const struct snd_format_test_data valid_fmt[] = {
4949
DEFINE_FORMAT(S8, 8, 8, -1, 1, SILENCE()),
5050
DEFINE_FORMAT(U8, 8, 8, -1, 0, SILENCE(0x80)),
5151
DEFINE_FORMAT(S16_LE, 16, 16, 1, 1, SILENCE()),
@@ -154,7 +154,7 @@ static void test_format_endianness(struct kunit *test)
154154
KUNIT_EXPECT_EQ(test, snd_pcm_format_big_endian(WRONG_FORMAT_2), -EINVAL);
155155
}
156156

157-
static void _test_fill_silence(struct kunit *test, struct snd_format_test_data *data,
157+
static void _test_fill_silence(struct kunit *test, const struct snd_format_test_data *data,
158158
u8 *buffer, size_t samples_count)
159159
{
160160
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)
191191
return boundary;
192192
}
193193

194-
static struct avail_test_data p_avail_data[] = {
194+
static const struct avail_test_data p_avail_data[] = {
195195
/* buf_size + hw_ptr < appl_ptr => avail = buf_size + hw_ptr - appl_ptr + boundary */
196196
{ 128, 1000, 1129, 1073741824UL - 1 },
197197
/*
@@ -220,7 +220,7 @@ static void test_playback_avail(struct kunit *test)
220220
}
221221
}
222222

223-
static struct avail_test_data c_avail_data[] = {
223+
static const struct avail_test_data c_avail_data[] = {
224224
/* hw_ptr - appl_ptr < 0 => avail = hw_ptr - appl_ptr + boundary */
225225
{ 128, 1000, 1001, 1073741824UL - 1 },
226226
/* standard case: avail = hw_ptr - appl_ptr */

0 commit comments

Comments
 (0)