[PATCH] ASoC: renesas: fsi: Constify struct fsi_stream_handler

Christophe JAILLET posted 1 patch 3 months, 2 weeks ago
sound/soc/renesas/fsi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] ASoC: renesas: fsi: Constify struct fsi_stream_handler
Posted by Christophe JAILLET 3 months, 2 weeks ago
'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>
---
 sound/soc/renesas/fsi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c
index 630c2f52e1cf..1491c2f2cc96 100644
--- a/sound/soc/renesas/fsi.c
+++ b/sound/soc/renesas/fsi.c
@@ -220,7 +220,7 @@ struct fsi_stream {
 	/*
 	 * these are initialized by fsi_handler_init()
 	 */
-	struct fsi_stream_handler *handler;
+	const struct fsi_stream_handler *handler;
 	struct fsi_priv		*priv;
 
 	/*
@@ -1215,13 +1215,13 @@ static int fsi_pio_pop_init(struct fsi_priv *fsi, struct fsi_stream *io)
 	return 0;
 }
 
-static struct fsi_stream_handler fsi_pio_push_handler = {
+static const struct fsi_stream_handler fsi_pio_push_handler = {
 	.init		= fsi_pio_push_init,
 	.transfer	= fsi_pio_push,
 	.start_stop	= fsi_pio_start_stop,
 };
 
-static struct fsi_stream_handler fsi_pio_pop_handler = {
+static const struct fsi_stream_handler fsi_pio_pop_handler = {
 	.init		= fsi_pio_pop_init,
 	.transfer	= fsi_pio_pop,
 	.start_stop	= fsi_pio_start_stop,
@@ -1418,7 +1418,7 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 	return 0;
 }
 
-static struct fsi_stream_handler fsi_dma_push_handler = {
+static const struct fsi_stream_handler fsi_dma_push_handler = {
 	.init		= fsi_dma_init,
 	.probe		= fsi_dma_probe,
 	.transfer	= fsi_dma_transfer,
-- 
2.51.0
Re: [PATCH] ASoC: renesas: fsi: Constify struct fsi_stream_handler
Posted by Mark Brown 3 months, 1 week ago
On Sun, 26 Oct 2025 20:43:36 +0100, Christophe JAILLET wrote:
> '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
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: renesas: fsi: Constify struct fsi_stream_handler
      commit: d29479abaded34b2b1dab2e17efe96a65eba3d61

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH] ASoC: renesas: fsi: Constify struct fsi_stream_handler
Posted by Kuninori Morimoto 3 months, 2 weeks ago
Hi

> '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>

Thank you for your help !!

Best regards
---
Kuninori Morimoto