Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: fsl_spdif: Constify some structures

'struct fsl_spdif_soc_data' and 'struct snd_kcontrol_new' are not modified
in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
53548 25576 128 79252 13594 sound/soc/fsl/fsl_spdif.o

After:
=====
text data bss dec hex filename
54828 24296 128 79252 13594 sound/soc/fsl/fsl_spdif.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/5fe08f028395a6c6f50d11eee8fdb4a90b1f68ab.1762151503.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Christophe JAILLET and committed by
Mark Brown
1a884794 947eaef2

+8 -8
+8 -8
sound/soc/fsl/fsl_spdif.c
··· 148 148 struct clk *pll11k_clk; 149 149 }; 150 150 151 - static struct fsl_spdif_soc_data fsl_spdif_vf610 = { 151 + static const struct fsl_spdif_soc_data fsl_spdif_vf610 = { 152 152 .imx = false, 153 153 .shared_root_clock = false, 154 154 .raw_capture_mode = false, ··· 158 158 .tx_formats = FSL_SPDIF_FORMATS_PLAYBACK, 159 159 }; 160 160 161 - static struct fsl_spdif_soc_data fsl_spdif_imx35 = { 161 + static const struct fsl_spdif_soc_data fsl_spdif_imx35 = { 162 162 .imx = true, 163 163 .shared_root_clock = false, 164 164 .raw_capture_mode = false, ··· 168 168 .tx_formats = FSL_SPDIF_FORMATS_PLAYBACK, 169 169 }; 170 170 171 - static struct fsl_spdif_soc_data fsl_spdif_imx6sx = { 171 + static const struct fsl_spdif_soc_data fsl_spdif_imx6sx = { 172 172 .imx = true, 173 173 .shared_root_clock = true, 174 174 .raw_capture_mode = false, ··· 179 179 180 180 }; 181 181 182 - static struct fsl_spdif_soc_data fsl_spdif_imx8qm = { 182 + static const struct fsl_spdif_soc_data fsl_spdif_imx8qm = { 183 183 .imx = true, 184 184 .shared_root_clock = true, 185 185 .raw_capture_mode = false, ··· 189 189 .tx_formats = SNDRV_PCM_FMTBIT_S24_LE, /* Applied for EDMA */ 190 190 }; 191 191 192 - static struct fsl_spdif_soc_data fsl_spdif_imx8mm = { 192 + static const struct fsl_spdif_soc_data fsl_spdif_imx8mm = { 193 193 .imx = true, 194 194 .shared_root_clock = false, 195 195 .raw_capture_mode = true, ··· 199 199 .tx_formats = FSL_SPDIF_FORMATS_PLAYBACK, 200 200 }; 201 201 202 - static struct fsl_spdif_soc_data fsl_spdif_imx8ulp = { 202 + static const struct fsl_spdif_soc_data fsl_spdif_imx8ulp = { 203 203 .imx = true, 204 204 .shared_root_clock = true, 205 205 .raw_capture_mode = false, ··· 1146 1146 } 1147 1147 1148 1148 /* FSL SPDIF IEC958 controller defines */ 1149 - static struct snd_kcontrol_new fsl_spdif_ctrls[] = { 1149 + static const struct snd_kcontrol_new fsl_spdif_ctrls[] = { 1150 1150 /* Status cchanel controller */ 1151 1151 { 1152 1152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ··· 1233 1233 }, 1234 1234 }; 1235 1235 1236 - static struct snd_kcontrol_new fsl_spdif_ctrls_rcm[] = { 1236 + static const struct snd_kcontrol_new fsl_spdif_ctrls_rcm[] = { 1237 1237 { 1238 1238 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1239 1239 .name = "IEC958 Raw Capture Mode",