LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ASoC: rsnd: make some arrays static const, makes object smaller
@ 2021-08-01  6:32 Colin King
  2021-08-01 23:11 ` Kuninori Morimoto
  2021-08-02 15:02 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-08-01  6:32 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Kuninori Morimoto, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate arrays on the stack but instead them static const.
Makes the object code smaller by 242 bytes.

Before:
   text    data     bss     dec     hex filename
  23827    8764       0   32591    7f4f ./sound/soc/sh/rcar/ssi.o

After:
   text    data     bss     dec     hex filename
  23361    8988       0   32349    7e5d ./sound/soc/sh/rcar/ssi.o

gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/sh/rcar/ssi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 27f34ca6059d..87e606f688d3 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -165,7 +165,7 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod,
 
 static u32 rsnd_ssi_multi_secondaries(struct rsnd_dai_stream *io)
 {
-	enum rsnd_mod_type types[] = {
+	static const enum rsnd_mod_type types[] = {
 		RSND_MOD_SSIM1,
 		RSND_MOD_SSIM2,
 		RSND_MOD_SSIM3,
@@ -228,7 +228,7 @@ unsigned int rsnd_ssi_clk_query(struct rsnd_dai *rdai,
 		       int param1, int param2, int *idx)
 {
 	struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
-	int ssi_clk_mul_table[] = {
+	static const int ssi_clk_mul_table[] = {
 		1, 2, 4, 8, 16, 6, 12,
 	};
 	int j, ret;
@@ -1079,7 +1079,7 @@ static void rsnd_ssi_connect(struct rsnd_mod *mod,
 			     struct rsnd_dai_stream *io)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	enum rsnd_mod_type types[] = {
+	static const enum rsnd_mod_type types[] = {
 		RSND_MOD_SSI,
 		RSND_MOD_SSIM1,
 		RSND_MOD_SSIM2,
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rsnd: make some arrays static const, makes object smaller
  2021-08-01  6:32 [PATCH] ASoC: rsnd: make some arrays static const, makes object smaller Colin King
@ 2021-08-01 23:11 ` Kuninori Morimoto
  2021-08-02 15:02 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Kuninori Morimoto @ 2021-08-01 23:11 UTC (permalink / raw)
  To: Colin King
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, kernel-janitors, linux-kernel


Hi Colin

Thank you for your patch

> Don't populate arrays on the stack but instead them static const.
> Makes the object code smaller by 242 bytes.
> 
> Before:
>    text    data     bss     dec     hex filename
>   23827    8764       0   32591    7f4f ./sound/soc/sh/rcar/ssi.o
> 
> After:
>    text    data     bss     dec     hex filename
>   23361    8988       0   32349    7e5d ./sound/soc/sh/rcar/ssi.o
> 
> gcc version 10.2.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Nice to know.

	Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Do you think we need similar patch to below ?
(In my quick check)

	core.c	rsnd_get_busif_shift()
		volume_ramp_rate[] // need static ?
	adg.c	rsnd_adg_clk_query()
		rsnd_adg_get_clkout()

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rsnd: make some arrays static const, makes object smaller
  2021-08-01  6:32 [PATCH] ASoC: rsnd: make some arrays static const, makes object smaller Colin King
  2021-08-01 23:11 ` Kuninori Morimoto
@ 2021-08-02 15:02 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-08-02 15:02 UTC (permalink / raw)
  To: alsa-devel, Kuninori Morimoto, Colin King, Takashi Iwai,
	Liam Girdwood, Jaroslav Kysela
  Cc: Mark Brown, linux-kernel, kernel-janitors

On Sun, 1 Aug 2021 07:32:37 +0100, Colin King wrote:
> Don't populate arrays on the stack but instead them static const.
> Makes the object code smaller by 242 bytes.
> 
> Before:
>    text    data     bss     dec     hex filename
>   23827    8764       0   32591    7f4f ./sound/soc/sh/rcar/ssi.o
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: rsnd: make some arrays static const, makes object smaller
      commit: 6dfeb70276def839aa605edd274f8e9f6189dba3

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-02 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01  6:32 [PATCH] ASoC: rsnd: make some arrays static const, makes object smaller Colin King
2021-08-01 23:11 ` Kuninori Morimoto
2021-08-02 15:02 ` Mark Brown

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox