]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: cs43130: Constify snd_soc_component_driver struct
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 29 Jul 2024 17:36:05 +0000 (19:36 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 2 Aug 2024 18:21:24 +0000 (19:21 +0100)
commit839e231a53b824a62bc3696ad3ba1dcedc4f4167
treeb72f98eb6596bef115fef799752cda36e60b411d
parenta1c2716738b7ba9e912e04872639dd39c72baa35
ASoC: cs43130: Constify snd_soc_component_driver struct

In order to constify `snd_soc_component_driver` struct, duplicate
`soc_component_dev_cs43130` into a `soc_component_dev_cs43130_digital` and
`soc_component_dev_cs43130_analog`.

These 2 new structures share the same .dapm_widgets and .dapm_routes
arrays but differ for .num_dapm_widgets and .num_dapm_routes.

In the digital case, the last entries are not taken into account.

Doing so has several advantages:
  - `snd_soc_component_driver` can be declared as const to move their
    declarations to read-only sections.
  - code in the probe is simpler. There is no need to concatenate some
    arrays to handle the "analog" case
  - this saves some memory because all_hp_widgets and analog_hp_routes can
    be removed.

Before :
======
   text    data     bss     dec     hex filename
  53965    8265    4512   66742   104b6 sound/soc/codecs/cs43130.o

After :
=====
   text    data     bss     dec     hex filename
  54409    7881      64   62354    f392 sound/soc/codecs/cs43130.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/1f04bb0366d9640d7ee361dae114ff79e4b381c1.1722274212.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs43130.c