LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ASoC: tlv320aic32x4: make array clocks static, makes object smaller
@ 2021-08-01  6:48 Colin King
  2021-08-01 15:35 ` Joe Perches
  2021-08-02 20:44 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-08-01  6:48 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, alsa-devel
  Cc: kernel-janitors, linux-kernel

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

Don't populate the array clocks on the stack but instead it
static. Makes the object code smaller by 316 bytes.

Before:
   text    data     bss     dec     hex filename
  63668   28264       0   91932   1671c ./sound/soc/codecs/tlv320aic32x4.o

After:
   text    data     bss     dec     hex filename
  62616   29000       0   91616   165e0 ./sound/soc/codecs/tlv320aic32x4.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/codecs/tlv320aic32x4.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 254a016cb1f3..d31ffb6d5b4b 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -714,7 +714,7 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
 	unsigned long adc_clock_rate, dac_clock_rate;
 	int ret;
 
-	struct clk_bulk_data clocks[] = {
+	static struct clk_bulk_data clocks[] = {
 		{ .id = "pll" },
 		{ .id = "nadc" },
 		{ .id = "madc" },
@@ -878,7 +878,7 @@ static int aic32x4_set_bias_level(struct snd_soc_component *component,
 {
 	int ret;
 
-	struct clk_bulk_data clocks[] = {
+	static struct clk_bulk_data clocks[] = {
 		{ .id = "madc" },
 		{ .id = "mdac" },
 		{ .id = "bdiv" },
@@ -994,7 +994,7 @@ static int aic32x4_component_probe(struct snd_soc_component *component)
 	u32 tmp_reg;
 	int ret;
 
-	struct clk_bulk_data clocks[] = {
+	static struct clk_bulk_data clocks[] = {
 		{ .id = "codec_clkin" },
 		{ .id = "pll" },
 		{ .id = "bdiv" },
@@ -1144,7 +1144,7 @@ static int aic32x4_tas2505_component_probe(struct snd_soc_component *component)
 	u32 tmp_reg;
 	int ret;
 
-	struct clk_bulk_data clocks[] = {
+	static struct clk_bulk_data clocks[] = {
 		{ .id = "codec_clkin" },
 		{ .id = "pll" },
 		{ .id = "bdiv" },
-- 
2.31.1


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

* Re: [PATCH] ASoC: tlv320aic32x4: make array clocks static, makes object smaller
  2021-08-01  6:48 [PATCH] ASoC: tlv320aic32x4: make array clocks static, makes object smaller Colin King
@ 2021-08-01 15:35 ` Joe Perches
  2021-08-02 20:44 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2021-08-01 15:35 UTC (permalink / raw)
  To: Colin King, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, alsa-devel
  Cc: kernel-janitors, linux-kernel

On Sun, 2021-08-01 at 07:48 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array clocks on the stack but instead it
> static. Makes the object code smaller by 316 bytes.
> 
> Before:
>    text    data     bss     dec     hex filename
>   63668   28264       0   91932   1671c ./sound/soc/codecs/tlv320aic32x4.o
> 
> After:
>    text    data     bss     dec     hex filename
>   62616   29000       0   91616   165e0 ./sound/soc/codecs/tlv320aic32x4.o
> 
> (gcc version 10.2.0)

That's likely also compiled allyesconfig.
allyesconfig compilations create a lot of superfluous data and text.

It's rather smaller with a defconfig and just the driver selected.

And here are a few additional possibilities for this driver.

$ size sound/soc/codecs/tlv320aic32x4.o*
   text	   data	    bss	    dec	    hex	filename
  38542	   2684	      0	  41226	   a10a	sound/soc/codecs/tlv320aic32x4.o.defconfig.new
  38446	   2792	      0	  41238	   a116	sound/soc/codecs/tlv320aic32x4.o.defconfig.old
  64184	  27880	      0	  92064	  167a0	sound/soc/codecs/tlv320aic32x4.o.allyesconfig.new
  63800	  28264	      0	  92064	  167a0	sound/soc/codecs/tlv320aic32x4.o.allyesconfig.old
---
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 254a016cb1f36..aeac45cbe1955 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -243,29 +243,29 @@ static const struct snd_kcontrol_new aic32x4_mfp5[] = {
 };
 
 /* 0dB min, 0.5dB steps */
-static DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0);
+static const DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0);
 /* -63.5dB min, 0.5dB steps */
-static DECLARE_TLV_DB_SCALE(tlv_pcm, -6350, 50, 0);
+static const DECLARE_TLV_DB_SCALE(tlv_pcm, -6350, 50, 0);
 /* -6dB min, 1dB steps */
-static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0);
+static const DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0);
 /* -12dB min, 0.5dB steps */
-static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0);
+static const DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0);
 /* -6dB min, 1dB steps */
-static DECLARE_TLV_DB_SCALE(tlv_tas_driver_gain, -5850, 50, 0);
-static DECLARE_TLV_DB_SCALE(tlv_amp_vol, 0, 600, 1);
+static const DECLARE_TLV_DB_SCALE(tlv_tas_driver_gain, -5850, 50, 0);
+static const DECLARE_TLV_DB_SCALE(tlv_amp_vol, 0, 600, 1);
 
 static const char * const lo_cm_text[] = {
 	"Full Chip", "1.65V",
 };
 
-static SOC_ENUM_SINGLE_DECL(lo_cm_enum, AIC32X4_CMMODE, 3, lo_cm_text);
+static const SOC_ENUM_SINGLE_DECL(lo_cm_enum, AIC32X4_CMMODE, 3, lo_cm_text);
 
 static const char * const ptm_text[] = {
 	"P3", "P2", "P1",
 };
 
-static SOC_ENUM_SINGLE_DECL(l_ptm_enum, AIC32X4_LPLAYBACK, 2, ptm_text);
-static SOC_ENUM_SINGLE_DECL(r_ptm_enum, AIC32X4_RPLAYBACK, 2, ptm_text);
+static const SOC_ENUM_SINGLE_DECL(l_ptm_enum, AIC32X4_LPLAYBACK, 2, ptm_text);
+static const SOC_ENUM_SINGLE_DECL(r_ptm_enum, AIC32X4_RPLAYBACK, 2, ptm_text);
 
 static const struct snd_kcontrol_new aic32x4_snd_controls[] = {
 	SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL,
@@ -341,14 +341,14 @@ static const char * const resistor_text[] = {
 };
 
 /* Left mixer pins */
-static SOC_ENUM_SINGLE_DECL(in1l_lpga_p_enum, AIC32X4_LMICPGAPIN, 6, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in2l_lpga_p_enum, AIC32X4_LMICPGAPIN, 4, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in3l_lpga_p_enum, AIC32X4_LMICPGAPIN, 2, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in1r_lpga_p_enum, AIC32X4_LMICPGAPIN, 0, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in1l_lpga_p_enum, AIC32X4_LMICPGAPIN, 6, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in2l_lpga_p_enum, AIC32X4_LMICPGAPIN, 4, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in3l_lpga_p_enum, AIC32X4_LMICPGAPIN, 2, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in1r_lpga_p_enum, AIC32X4_LMICPGAPIN, 0, resistor_text);
 
-static SOC_ENUM_SINGLE_DECL(cml_lpga_n_enum, AIC32X4_LMICPGANIN, 6, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in2r_lpga_n_enum, AIC32X4_LMICPGANIN, 4, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in3r_lpga_n_enum, AIC32X4_LMICPGANIN, 2, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(cml_lpga_n_enum, AIC32X4_LMICPGANIN, 6, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in2r_lpga_n_enum, AIC32X4_LMICPGANIN, 4, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in3r_lpga_n_enum, AIC32X4_LMICPGANIN, 2, resistor_text);
 
 static const struct snd_kcontrol_new in1l_to_lmixer_controls[] = {
 	SOC_DAPM_ENUM("IN1_L L+ Switch", in1l_lpga_p_enum),
@@ -373,13 +373,13 @@ static const struct snd_kcontrol_new in3r_to_lmixer_controls[] = {
 };
 
 /*	Right mixer pins */
-static SOC_ENUM_SINGLE_DECL(in1r_rpga_p_enum, AIC32X4_RMICPGAPIN, 6, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in2r_rpga_p_enum, AIC32X4_RMICPGAPIN, 4, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in3r_rpga_p_enum, AIC32X4_RMICPGAPIN, 2, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in2l_rpga_p_enum, AIC32X4_RMICPGAPIN, 0, resistor_text);
-static SOC_ENUM_SINGLE_DECL(cmr_rpga_n_enum, AIC32X4_RMICPGANIN, 6, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in1l_rpga_n_enum, AIC32X4_RMICPGANIN, 4, resistor_text);
-static SOC_ENUM_SINGLE_DECL(in3l_rpga_n_enum, AIC32X4_RMICPGANIN, 2, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in1r_rpga_p_enum, AIC32X4_RMICPGAPIN, 6, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in2r_rpga_p_enum, AIC32X4_RMICPGAPIN, 4, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in3r_rpga_p_enum, AIC32X4_RMICPGAPIN, 2, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in2l_rpga_p_enum, AIC32X4_RMICPGAPIN, 0, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(cmr_rpga_n_enum, AIC32X4_RMICPGANIN, 6, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in1l_rpga_n_enum, AIC32X4_RMICPGANIN, 4, resistor_text);
+static const SOC_ENUM_SINGLE_DECL(in3l_rpga_n_enum, AIC32X4_RMICPGANIN, 2, resistor_text);
 
 static const struct snd_kcontrol_new in1r_to_rmixer_controls[] = {
 	SOC_DAPM_ENUM("IN1_R R+ Switch", in1r_rpga_p_enum),


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

* Re: [PATCH] ASoC: tlv320aic32x4: make array clocks static, makes object smaller
  2021-08-01  6:48 [PATCH] ASoC: tlv320aic32x4: make array clocks static, makes object smaller Colin King
  2021-08-01 15:35 ` Joe Perches
@ 2021-08-02 20:44 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-08-02 20:44 UTC (permalink / raw)
  To: Liam Girdwood, Takashi Iwai, Jaroslav Kysela, Colin King, alsa-devel
  Cc: Mark Brown, kernel-janitors, linux-kernel

On Sun, 1 Aug 2021 07:48:07 +0100, Colin King wrote:
> Don't populate the array clocks on the stack but instead it
> static. Makes the object code smaller by 316 bytes.
> 
> Before:
>    text    data     bss     dec     hex filename
>   63668   28264       0   91932   1671c ./sound/soc/codecs/tlv320aic32x4.o
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: tlv320aic32x4: make array clocks static, makes object smaller
      commit: ea9df9840fd5d766b9e98b0073890de4be68b062

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 20:44 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:48 [PATCH] ASoC: tlv320aic32x4: make array clocks static, makes object smaller Colin King
2021-08-01 15:35 ` Joe Perches
2021-08-02 20:44 ` Mark Brown

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