Unverified Commit ed258130 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Mark Brown
Browse files

ASoC: intel: Constify struct snd_soc_ops



Constifying "struct snd_soc_ops" moves some data to a read-only section, so
increase overall security.

This structure is also part of scripts/const_structs.checkpatch.

As an example, on a x86_64, with allmodconfig:
Before:
   text	   data	    bss	    dec	    hex	filename
   6315	   3696	      0	  10011	   271b	sound/soc/intel/boards/ehl_rt5660.o

After:
   text	   data	    bss	    dec	    hex	filename
   6379	   3648	      0	  10027	   272b	sound/soc/intel/boards/ehl_rt5660.o

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://msgid.link/r/2f0613bf4c6018569cdaac876d0589e49cf38a80.1715622793.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5dfd8f78
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ static int bdw_rt5650_hw_params(struct snd_pcm_substream *substream,
	return ret;
}

static struct snd_soc_ops bdw_rt5650_ops = {
static const struct snd_soc_ops bdw_rt5650_ops = {
	.hw_params = bdw_rt5650_hw_params,
};

+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ static int rt5660_hw_params(struct snd_pcm_substream *substream,
	return ret;
}

static struct snd_soc_ops rt5660_ops = {
static const struct snd_soc_ops rt5660_ops = {
	.hw_params = rt5660_hw_params,
};

+2 −2
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
			SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
}

static struct snd_soc_ops kabylake_dmic_ops = {
static const struct snd_soc_ops kabylake_dmic_ops = {
	.startup = kabylake_dmic_startup,
};

@@ -388,7 +388,7 @@ static int kabylake_refcap_startup(struct snd_pcm_substream *substream)
					&constraints_16000);
}

static struct snd_soc_ops skylake_refcap_ops = {
static const struct snd_soc_ops skylake_refcap_ops = {
	.startup = kabylake_refcap_startup,
};

+3 −3
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ static int kabylake_ssp0_trigger(struct snd_pcm_substream *substream, int cmd)
	return 0;
}

static struct snd_soc_ops kabylake_ssp0_ops = {
static const struct snd_soc_ops kabylake_ssp0_ops = {
	.hw_params = kabylake_ssp0_hw_params,
	.trigger = kabylake_ssp0_trigger,
};
@@ -535,7 +535,7 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
			SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
}

static struct snd_soc_ops kabylake_dmic_ops = {
static const struct snd_soc_ops kabylake_dmic_ops = {
	.startup = kabylake_dmic_startup,
};

@@ -569,7 +569,7 @@ static int kabylake_refcap_startup(struct snd_pcm_substream *substream)
}


static struct snd_soc_ops skylake_refcap_ops = {
static const struct snd_soc_ops skylake_refcap_ops = {
	.startup = kabylake_refcap_startup,
};

+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ static int kabylake_rt5660_hw_params(struct snd_pcm_substream *substream,
	return ret;
}

static struct snd_soc_ops kabylake_rt5660_ops = {
static const struct snd_soc_ops kabylake_rt5660_ops = {
	.hw_params = kabylake_rt5660_hw_params,
};

Loading