]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: mediatek: Constify struct mtk_adsp_ipc_ops
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 13 Jun 2024 20:59:09 +0000 (22:59 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 17 Jun 2024 12:08:31 +0000 (13:08 +0100)
'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>
include/linux/firmware/mediatek/mtk-adsp-ipc.h
sound/soc/sof/mediatek/mt8186/mt8186.c
sound/soc/sof/mediatek/mt8195/mt8195.c

index 5b1d16fa3f568cf9f0cb462ed1a3c41890e53371..6e86799a7dc43a6b83750b4e89ba536e10f50e13 100644 (file)
@@ -40,7 +40,7 @@ struct mtk_adsp_chan {
 struct mtk_adsp_ipc {
        struct mtk_adsp_chan chans[MTK_ADSP_MBOX_NUM];
        struct device *dev;
-       struct mtk_adsp_ipc_ops *ops;
+       const struct mtk_adsp_ipc_ops *ops;
        void *private_data;
 };
 
index bea1b9d9ca2886db2b1f513ab10327b77f10b764..74522400207e12a70ab046b49952ceb8178265f0 100644 (file)
@@ -82,7 +82,7 @@ static void mt8186_dsp_handle_request(struct mtk_adsp_ipc *ipc)
        }
 }
 
-static struct mtk_adsp_ipc_ops dsp_ops = {
+static const struct mtk_adsp_ipc_ops dsp_ops = {
        .handle_reply           = mt8186_dsp_handle_reply,
        .handle_request         = mt8186_dsp_handle_request,
 };
index 31dc98d1b1d8bddde8f91047125ea034b912f691..24ae1d4959be59a9d683310248f420eab5b55ef2 100644 (file)
@@ -82,7 +82,7 @@ static void mt8195_dsp_handle_request(struct mtk_adsp_ipc *ipc)
        }
 }
 
-static struct mtk_adsp_ipc_ops dsp_ops = {
+static const struct mtk_adsp_ipc_ops dsp_ops = {
        .handle_reply           = mt8195_dsp_handle_reply,
        .handle_request         = mt8195_dsp_handle_request,
 };