Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: mediatek: Constify struct mtk_adsp_ipc_ops

'struct mtk_adsp_ipc_ops' is not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security.

In order to do it, "struct mtk_adsp_ipc" also needs to be adjusted to this
new const qualifier.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
15533 2383 0 17916 45fc sound/soc/sof/mediatek/mt8195/mt8195.o

After:
=====
text data bss dec hex filename
15557 2367 0 17924 4604 sound/soc/sof/mediatek/mt8195/mt8195.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://msgid.link/r/a45d6b2b5ec040ea0fc78fca662c2dca3f13a49f.1718312321.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Christophe JAILLET and committed by
Mark Brown
1c75adb2 2618b2ec

+3 -3
+1 -1
include/linux/firmware/mediatek/mtk-adsp-ipc.h
··· 40 40 struct mtk_adsp_ipc { 41 41 struct mtk_adsp_chan chans[MTK_ADSP_MBOX_NUM]; 42 42 struct device *dev; 43 - struct mtk_adsp_ipc_ops *ops; 43 + const struct mtk_adsp_ipc_ops *ops; 44 44 void *private_data; 45 45 }; 46 46
+1 -1
sound/soc/sof/mediatek/mt8186/mt8186.c
··· 82 82 } 83 83 } 84 84 85 - static struct mtk_adsp_ipc_ops dsp_ops = { 85 + static const struct mtk_adsp_ipc_ops dsp_ops = { 86 86 .handle_reply = mt8186_dsp_handle_reply, 87 87 .handle_request = mt8186_dsp_handle_request, 88 88 };
+1 -1
sound/soc/sof/mediatek/mt8195/mt8195.c
··· 82 82 } 83 83 } 84 84 85 - static struct mtk_adsp_ipc_ops dsp_ops = { 85 + static const struct mtk_adsp_ipc_ops dsp_ops = { 86 86 .handle_reply = mt8195_dsp_handle_reply, 87 87 .handle_request = mt8195_dsp_handle_request, 88 88 };