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

ASoC: renesas: fsi: Constify struct fsi_stream_handler

'struct fsi_stream_handler' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
51837 12312 64 64213 fad5 sound/soc/renesas/fsi.o

After:
=====
text data bss dec hex filename
52125 12024 64 64213 fad5 sound/soc/renesas/fsi.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/88ca34df9006b74a7596b91714e700bcff666c4b.1761507792.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Christophe JAILLET and committed by
Mark Brown
d29479ab c17fa4cb

+4 -4
+4 -4
sound/soc/renesas/fsi.c
··· 220 220 /* 221 221 * these are initialized by fsi_handler_init() 222 222 */ 223 - struct fsi_stream_handler *handler; 223 + const struct fsi_stream_handler *handler; 224 224 struct fsi_priv *priv; 225 225 226 226 /* ··· 1215 1215 return 0; 1216 1216 } 1217 1217 1218 - static struct fsi_stream_handler fsi_pio_push_handler = { 1218 + static const struct fsi_stream_handler fsi_pio_push_handler = { 1219 1219 .init = fsi_pio_push_init, 1220 1220 .transfer = fsi_pio_push, 1221 1221 .start_stop = fsi_pio_start_stop, 1222 1222 }; 1223 1223 1224 - static struct fsi_stream_handler fsi_pio_pop_handler = { 1224 + static const struct fsi_stream_handler fsi_pio_pop_handler = { 1225 1225 .init = fsi_pio_pop_init, 1226 1226 .transfer = fsi_pio_pop, 1227 1227 .start_stop = fsi_pio_start_stop, ··· 1418 1418 return 0; 1419 1419 } 1420 1420 1421 - static struct fsi_stream_handler fsi_dma_push_handler = { 1421 + static const struct fsi_stream_handler fsi_dma_push_handler = { 1422 1422 .init = fsi_dma_init, 1423 1423 .probe = fsi_dma_probe, 1424 1424 .transfer = fsi_dma_transfer,