]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: mediatek: mt8183-afe-pcm: shorten mt8183_is_volatile_reg()
authorChen-Yu Tsai <wenst@chromium.org>
Thu, 15 May 2025 07:38:23 +0000 (15:38 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 15 May 2025 07:44:43 +0000 (09:44 +0200)
commit29552dcc044a233be84ab9b64539fdc7d8f4314e
tree4ef53eab7ac213b35a3845d4bcc59046ec130853
parent0be889823f93429dab396cb7ac061d02046bd962
ASoC: mediatek: mt8183-afe-pcm: shorten mt8183_is_volatile_reg()

mt8183_is_volatile_reg() is a large switch-case block that lists out
every register that is volatile. Since many pairs of registers have
consecutive addresses, the cases can be compressed down with the
ellipsis, i.e. GCC extension "case ranges" [1] to cover more addresses
in one case, shortening the source code.

This is not completely the same, since the addresses are 4-byte aligned,
and using the case ranges feature adds all unaligned addresses in
between. In practice this doesn't matter since the unaligned addresses
are blocked by the regmap core. This also ends up compiling slightly
smaller with a reduction of 128 bytes in the text section.

[1] https://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20250515073825.4155297-4-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c