ASoC: audio-iio-aux: Use flex array to simplify code
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 24 Sep 2023 07:36:01 +0000 (09:36 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 25 Sep 2023 12:27:04 +0000 (14:27 +0200)
commitc351835058419c1eb8791941a057c3f3e6068cb6
treed762422de99f0dbf42fce258f5fc812d7faea17b
parent39fce972fd7259395663586e59388d702afec30e
ASoC: audio-iio-aux: Use flex array to simplify code

"io-channel-names" is expected to have few values, so there is no real
point to allocate audio_iio_aux_chan structure with a dedicate memory
allocation.

Using a flexible array for struct audio_iio_aux->chans avoids the
overhead of an additional, managed, memory allocation.

This also saves an indirection when the array is accessed.

Finally, __counted_by() can be used for run-time bounds checking if
configured and supported by the compiler.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/1c0090aaf49504eaeaff5e7dd119fd37173290b5.1695540940.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/audio-iio-aux.c