soc: mediatek: mtk-svs: Build bank name string dynamically
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tue, 21 Nov 2023 12:50:28 +0000 (13:50 +0100)
committerAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 11 Dec 2023 10:36:13 +0000 (11:36 +0100)
commit07933fe29f9473f2cf42a70605e51b13b743133a
tree83ac368bb682a8d3ab91710e2c2381968ae6bdff
parent259919b3aa8eda1b27cc49855a8a534c4a0b9797
soc: mediatek: mtk-svs: Build bank name string dynamically

In svs_bank_resource_setup() there is a "big" switch assigning different
names depending on sw_id and type and this will surely grow: for example
MT8186 has got a two-line type (high/low) SVS bank for CPU_BIG, and this
would require more switch nesting.

Simplify all of this by changing that to a devm_kasprintf() call that
will concatenate the SW_ID string (e.g. SVSB_CPU_LITTLE) with the Type
string (e.g. _LOW), resulting in the expected full bank name (e.g.
SVSB_CPU_LITTLE_LOW).

This being a dynamic allocation can be slower, but this happens only
once in the life of this driver and it's not a performance path, so it's
totally acceptable.

Link: https://lore.kernel.org/r/20231121125044.78642-5-angelogioacchino.delregno@collabora.com
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
drivers/soc/mediatek/mtk-svs.c