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

ALSA: hda: Constify snd_kcontrol_new items

Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-37-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+7 -7
+4 -4
sound/pci/hda/hda_codec.c
··· 2387 2387 return change; 2388 2388 } 2389 2389 2390 - static struct snd_kcontrol_new dig_mixes[] = { 2390 + static const struct snd_kcontrol_new dig_mixes[] = { 2391 2391 { 2392 2392 .access = SNDRV_CTL_ELEM_ACCESS_READ, 2393 2393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ··· 2437 2437 { 2438 2438 int err; 2439 2439 struct snd_kcontrol *kctl; 2440 - struct snd_kcontrol_new *dig_mix; 2440 + const struct snd_kcontrol_new *dig_mix; 2441 2441 int idx = 0; 2442 2442 int val = 0; 2443 2443 const int spdif_index = 16; ··· 2655 2655 return 0; 2656 2656 } 2657 2657 2658 - static struct snd_kcontrol_new dig_in_ctls[] = { 2658 + static const struct snd_kcontrol_new dig_in_ctls[] = { 2659 2659 { 2660 2660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2661 2661 .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH), ··· 2687 2687 { 2688 2688 int err; 2689 2689 struct snd_kcontrol *kctl; 2690 - struct snd_kcontrol_new *dig_mix; 2690 + const struct snd_kcontrol_new *dig_mix; 2691 2691 int idx; 2692 2692 2693 2693 idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch", 0);
+3 -3
sound/pci/hda/patch_sigmatel.c
··· 825 825 struct sigmatel_spec *spec = codec->spec; 826 826 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); 827 827 struct snd_kcontrol_new *knew; 828 - static struct snd_kcontrol_new abeep_mute_ctl = 828 + static const struct snd_kcontrol_new abeep_mute_ctl = 829 829 HDA_CODEC_MUTE(NULL, 0, 0, 0); 830 - static struct snd_kcontrol_new dbeep_mute_ctl = 830 + static const struct snd_kcontrol_new dbeep_mute_ctl = 831 831 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0); 832 - static struct snd_kcontrol_new beep_vol_ctl = 832 + static const struct snd_kcontrol_new beep_vol_ctl = 833 833 HDA_CODEC_VOLUME(NULL, 0, 0, 0); 834 834 835 835 /* check for mute support for the the amp */