ASoC: rsnd: core: make some arrays static const, makes object smaller
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 20 Aug 2021 04:09:14 +0000 (13:09 +0900)
committerMark Brown <broonie@kernel.org>
Fri, 20 Aug 2021 12:07:25 +0000 (13:07 +0100)
Don't populate arrays on the stack but instead them static const.
Makes the object code smaller by 48 bytes.

Before:
   text    data     bss     dec     hex filename
  20938     916     104   21958    55c6 ./sound/soc/sh/rcar/core.o

After:
   text    data     bss     dec     hex filename
  20890     916     104   21910    5596 ./sound/soc/sh/rcar/core.o

gcc version 11.1.0)

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tujkwydx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/core.c

index 5e382b5c9d45735e88d79b5557b83512e0847239..978bd0406729ae5a52bdb68adb6d3331429b14a8 100644 (file)
@@ -426,19 +426,19 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 
 u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod)
 {
-       enum rsnd_mod_type playback_mods[] = {
+       static const enum rsnd_mod_type playback_mods[] = {
                RSND_MOD_SRC,
                RSND_MOD_CMD,
                RSND_MOD_SSIU,
        };
-       enum rsnd_mod_type capture_mods[] = {
+       static const enum rsnd_mod_type capture_mods[] = {
                RSND_MOD_CMD,
                RSND_MOD_SRC,
                RSND_MOD_SSIU,
        };
        struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
        struct rsnd_mod *tmod = NULL;
-       enum rsnd_mod_type *mods =
+       const enum rsnd_mod_type *mods =
                rsnd_io_is_play(io) ?
                playback_mods : capture_mods;
        int i;