ASoC: sti-sas: Constify snd_soc_component_driver struct

In order to constify `snd_soc_component_driver` struct, simplify the logic
and the `sti_sas_dev_data` struct.

Since commit 165a57a3df ("ASoC: sti-sas: clean legacy in sti-sas") only
only chip is supported and `sti_sas_driver` can be fully defined at
compilation time.

Before:
======
   text	   data	    bss	    dec	    hex	filename
   8033	   1547	     16	   9596	   257c	sound/soc/codecs/sti-sas.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   8257	   1163	     16	   9436	   24dc	sound/soc/codecs/sti-sas.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/2c08558813e3bbfae0a5302199cf6ca226e7cde1.1722544073.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Christophe JAILLET 2024-08-01 22:30:05 +02:00 committed by Mark Brown
parent 92b796845a
commit 11c2d22371
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -63,10 +63,6 @@ struct sti_spdif_audio {
struct sti_sas_dev_data {
const struct regmap_config *regmap;
const struct snd_soc_dai_ops *dac_ops; /* DAC function callbacks */
const struct snd_soc_dapm_widget *dapm_widgets; /* dapms declaration */
const int num_dapm_widgets; /* dapms declaration */
const struct snd_soc_dapm_route *dapm_routes; /* route declaration */
const int num_dapm_routes; /* route declaration */
};
/* driver data structure */
@ -324,10 +320,6 @@ static const struct regmap_config stih407_sas_regmap = {
static const struct sti_sas_dev_data stih407_data = {
.regmap = &stih407_sas_regmap,
.dac_ops = &stih407_dac_ops,
.dapm_widgets = stih407_sas_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(stih407_sas_dapm_widgets),
.dapm_routes = stih407_sas_route,
.num_dapm_routes = ARRAY_SIZE(stih407_sas_route),
};
static struct snd_soc_dai_driver sti_sas_dai[] = {
@ -386,12 +378,16 @@ static int sti_sas_component_probe(struct snd_soc_component *component)
return sti_sas_init_sas_registers(component, drvdata);
}
static struct snd_soc_component_driver sti_sas_driver = {
static const struct snd_soc_component_driver sti_sas_driver = {
.probe = sti_sas_component_probe,
.resume = sti_sas_resume,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.dapm_widgets = stih407_sas_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(stih407_sas_dapm_widgets),
.dapm_routes = stih407_sas_route,
.num_dapm_routes = ARRAY_SIZE(stih407_sas_route),
};
static const struct of_device_id sti_sas_dev_match[] = {
@ -446,13 +442,6 @@ static int sti_sas_driver_probe(struct platform_device *pdev)
sti_sas_dai[STI_SAS_DAI_ANALOG_OUT].ops = drvdata->dev_data->dac_ops;
/* Set dapms*/
sti_sas_driver.dapm_widgets = drvdata->dev_data->dapm_widgets;
sti_sas_driver.num_dapm_widgets = drvdata->dev_data->num_dapm_widgets;
sti_sas_driver.dapm_routes = drvdata->dev_data->dapm_routes;
sti_sas_driver.num_dapm_routes = drvdata->dev_data->num_dapm_routes;
/* Store context */
dev_set_drvdata(&pdev->dev, drvdata);