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

ALSA: isa: 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-36-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+45 -45
+1 -1
sound/isa/ad1816a/ad1816a_lib.c
··· 884 884 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); 885 885 static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 886 886 887 - static struct snd_kcontrol_new snd_ad1816a_controls[] = { 887 + static const struct snd_kcontrol_new snd_ad1816a_controls[] = { 888 888 AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1), 889 889 AD1816A_DOUBLE_TLV("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1, 890 890 db_scale_5bit),
+1 -1
sound/isa/cmi8330.c
··· 179 179 #endif 180 180 181 181 182 - static struct snd_kcontrol_new snd_cmi8330_controls[] = { 182 + static const struct snd_kcontrol_new snd_cmi8330_controls[] = { 183 183 WSS_DOUBLE("Master Playback Volume", 0, 184 184 CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), 185 185 WSS_SINGLE("Loud Playback Switch", 0,
+7 -7
sound/isa/cs423x/cs4236_lib.c
··· 758 758 static const DECLARE_TLV_DB_SCALE(db_scale_2bit, -1800, 600, 0); 759 759 static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 760 760 761 - static struct snd_kcontrol_new snd_cs4236_controls[] = { 761 + static const struct snd_kcontrol_new snd_cs4236_controls[] = { 762 762 763 763 CS4236_DOUBLE("Master Digital Playback Switch", 0, 764 764 CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), ··· 853 853 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_6db_max, -5600, 200, 0); 854 854 static const DECLARE_TLV_DB_SCALE(db_scale_2bit_16db_max, -2400, 800, 0); 855 855 856 - static struct snd_kcontrol_new snd_cs4235_controls[] = { 856 + static const struct snd_kcontrol_new snd_cs4235_controls[] = { 857 857 858 858 WSS_DOUBLE("Master Playback Switch", 0, 859 859 CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), ··· 986 986 return change; 987 987 } 988 988 989 - static struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { 989 + static const struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { 990 990 CS4236_IEC958_ENABLE("IEC958 Output Enable", 0), 991 991 CS4236_SINGLEC("IEC958 Output Validity", 0, 4, 4, 1, 0), 992 992 CS4236_SINGLEC("IEC958 Output User", 0, 4, 5, 1, 0), ··· 995 995 CS4236_SINGLEC("IEC958 Output Channel Status High", 0, 6, 0, 255, 0) 996 996 }; 997 997 998 - static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { 998 + static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { 999 999 CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), 1000 1000 CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1) 1001 1001 }; 1002 1002 1003 - static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { 1003 + static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { 1004 1004 CS4236_SINGLEC("3D Control - Switch", 0, 3, 7, 1, 0), 1005 1005 CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), 1006 1006 CS4236_SINGLEC("3D Control - Center", 0, 2, 0, 15, 1), ··· 1008 1008 CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0) 1009 1009 }; 1010 1010 1011 - static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { 1011 + static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { 1012 1012 CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), 1013 1013 CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), 1014 1014 CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1), ··· 1020 1020 struct snd_card *card; 1021 1021 unsigned int idx, count; 1022 1022 int err; 1023 - struct snd_kcontrol_new *kcontrol; 1023 + const struct snd_kcontrol_new *kcontrol; 1024 1024 1025 1025 if (snd_BUG_ON(!chip || !chip->card)) 1026 1026 return -EINVAL;
+1 -1
sound/isa/es1688/es1688_lib.c
··· 924 924 return change; 925 925 } 926 926 927 - static struct snd_kcontrol_new snd_es1688_controls[] = { 927 + static const struct snd_kcontrol_new snd_es1688_controls[] = { 928 928 ES1688_DOUBLE("Master Playback Volume", 0, ES1688_MASTER_DEV, ES1688_MASTER_DEV, 4, 0, 15, 0), 929 929 ES1688_DOUBLE("PCM Playback Volume", 0, ES1688_PCM_DEV, ES1688_PCM_DEV, 4, 0, 15, 0), 930 930 ES1688_DOUBLE("Line Playback Volume", 0, ES1688_LINE_DEV, ES1688_LINE_DEV, 4, 0, 15, 0),
+13 -13
sound/isa/es18xx.c
··· 1246 1246 * The controls that are universal to all chipsets are fully initialized 1247 1247 * here. 1248 1248 */ 1249 - static struct snd_kcontrol_new snd_es18xx_base_controls[] = { 1249 + static const struct snd_kcontrol_new snd_es18xx_base_controls[] = { 1250 1250 ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), 1251 1251 ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), 1252 1252 ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0), ··· 1265 1265 } 1266 1266 }; 1267 1267 1268 - static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { 1268 + static const struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { 1269 1269 ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), 1270 1270 ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), 1271 1271 ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0), ··· 1277 1277 /* 1278 1278 * The chipset specific mixer controls 1279 1279 */ 1280 - static struct snd_kcontrol_new snd_es18xx_opt_speaker = 1280 + static const struct snd_kcontrol_new snd_es18xx_opt_speaker = 1281 1281 ES18XX_SINGLE("Beep Playback Volume", 0, 0x3c, 0, 7, 0); 1282 1282 1283 - static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { 1283 + static const struct snd_kcontrol_new snd_es18xx_opt_1869[] = { 1284 1284 ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, ES18XX_FL_INVERT), 1285 1285 ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0), 1286 1286 ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), 1287 1287 ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) 1288 1288 }; 1289 1289 1290 - static struct snd_kcontrol_new snd_es18xx_opt_1878 = 1290 + static const struct snd_kcontrol_new snd_es18xx_opt_1878 = 1291 1291 ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0); 1292 1292 1293 - static struct snd_kcontrol_new snd_es18xx_opt_1879[] = { 1293 + static const struct snd_kcontrol_new snd_es18xx_opt_1879[] = { 1294 1294 ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0), 1295 1295 ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), 1296 1296 ES18XX_DOUBLE("Video Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) 1297 1297 }; 1298 1298 1299 - static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { 1299 + static const struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { 1300 1300 ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), 1301 1301 }; 1302 1302 1303 - static struct snd_kcontrol_new snd_es18xx_pcm2_controls[] = { 1303 + static const struct snd_kcontrol_new snd_es18xx_pcm2_controls[] = { 1304 1304 ES18XX_DOUBLE("PCM Playback Volume", 0, 0x7c, 0x7c, 4, 0, 15, 0), 1305 1305 ES18XX_DOUBLE("PCM Playback Volume", 1, 0x14, 0x14, 4, 0, 15, 0) 1306 1306 }; 1307 1307 1308 - static struct snd_kcontrol_new snd_es18xx_spatializer_controls[] = { 1308 + static const struct snd_kcontrol_new snd_es18xx_spatializer_controls[] = { 1309 1309 ES18XX_SINGLE("3D Control - Level", 0, 0x52, 0, 63, 0), 1310 1310 { 1311 1311 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ··· 1316 1316 } 1317 1317 }; 1318 1318 1319 - static struct snd_kcontrol_new snd_es18xx_micpre1_control = 1319 + static const struct snd_kcontrol_new snd_es18xx_micpre1_control = 1320 1320 ES18XX_SINGLE("Mic Boost (+26dB)", 0, 0xa9, 2, 1, 0); 1321 1321 1322 - static struct snd_kcontrol_new snd_es18xx_micpre2_control = 1322 + static const struct snd_kcontrol_new snd_es18xx_micpre2_control = 1323 1323 ES18XX_SINGLE("Mic Boost (+26dB)", 0, 0x7d, 3, 1, 0); 1324 1324 1325 - static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { 1325 + static const struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { 1326 1326 { 1327 1327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1328 1328 .name = "Hardware Master Playback Volume", ··· 1340 1340 ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), 1341 1341 }; 1342 1342 1343 - static struct snd_kcontrol_new snd_es18xx_opt_gpo_2bit[] = { 1343 + static const struct snd_kcontrol_new snd_es18xx_opt_gpo_2bit[] = { 1344 1344 ES18XX_SINGLE("GPO0 Switch", 0, ES18XX_PM, 0, 1, ES18XX_FL_PMPORT), 1345 1345 ES18XX_SINGLE("GPO1 Switch", 0, ES18XX_PM, 1, 1, ES18XX_FL_PMPORT), 1346 1346 };
+2 -2
sound/isa/gus/gus_mixer.c
··· 120 120 return change; 121 121 } 122 122 123 - static struct snd_kcontrol_new snd_gf1_controls[] = { 123 + static const struct snd_kcontrol_new snd_gf1_controls[] = { 124 124 GF1_SINGLE("Master Playback Switch", 0, 1, 1), 125 125 GF1_SINGLE("Line Switch", 0, 0, 1), 126 126 GF1_SINGLE("Mic Switch", 0, 2, 0) 127 127 }; 128 128 129 - static struct snd_kcontrol_new snd_ics_controls[] = { 129 + static const struct snd_kcontrol_new snd_ics_controls[] = { 130 130 GF1_SINGLE("Master Playback Switch", 0, 1, 1), 131 131 ICS_DOUBLE("Master Playback Volume", 0, SNDRV_ICS_MASTER_DEV), 132 132 ICS_DOUBLE("Synth Playback Volume", 0, SNDRV_ICS_GF1_DEV),
+1 -1
sound/isa/msnd/msnd_pinnacle_mixer.c
··· 275 275 .private_value = addr } 276 276 277 277 278 - static struct snd_kcontrol_new snd_msnd_controls[] = { 278 + static const struct snd_kcontrol_new snd_msnd_controls[] = { 279 279 DUMMY_VOLUME("Master Volume", 0, MSND_MIXER_VOLUME), 280 280 DUMMY_VOLUME("PCM Volume", 0, MSND_MIXER_PCM), 281 281 DUMMY_VOLUME("Aux Volume", 0, MSND_MIXER_AUX),
+2 -2
sound/isa/opl3sa2.c
··· 457 457 static const DECLARE_TLV_DB_SCALE(db_scale_master, -3000, 200, 0); 458 458 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); 459 459 460 - static struct snd_kcontrol_new snd_opl3sa2_controls[] = { 460 + static const struct snd_kcontrol_new snd_opl3sa2_controls[] = { 461 461 OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), 462 462 OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1, 463 463 db_scale_master), ··· 467 467 OPL3SA2_SINGLE("ZV Port Switch", 0, 0x02, 0, 1, 0), 468 468 }; 469 469 470 - static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { 470 + static const struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { 471 471 OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0), 472 472 OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0), 473 473 OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0)
+7 -7
sound/isa/opti9xx/miro.c
··· 577 577 return change; 578 578 } 579 579 580 - static struct snd_kcontrol_new snd_miro_controls[] = { 580 + static const struct snd_kcontrol_new snd_miro_controls[] = { 581 581 MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), 582 582 MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), 583 583 MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), ··· 589 589 590 590 /* Equalizer with seven bands (only PCM20) 591 591 from -12dB up to +12dB on each band */ 592 - static struct snd_kcontrol_new snd_miro_eq_controls[] = { 592 + static const struct snd_kcontrol_new snd_miro_eq_controls[] = { 593 593 MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), 594 594 MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), 595 595 MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), ··· 599 599 MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), 600 600 }; 601 601 602 - static struct snd_kcontrol_new snd_miro_radio_control[] = { 602 + static const struct snd_kcontrol_new snd_miro_radio_control[] = { 603 603 MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), 604 604 }; 605 605 606 - static struct snd_kcontrol_new snd_miro_line_control[] = { 606 + static const struct snd_kcontrol_new snd_miro_line_control[] = { 607 607 MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), 608 608 }; 609 609 610 - static struct snd_kcontrol_new snd_miro_preamp_control[] = { 610 + static const struct snd_kcontrol_new snd_miro_preamp_control[] = { 611 611 { 612 612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 613 613 .name = "Mic Boost", ··· 617 617 .put = snd_miro_put_preamp, 618 618 }}; 619 619 620 - static struct snd_kcontrol_new snd_miro_amp_control[] = { 620 + static const struct snd_kcontrol_new snd_miro_amp_control[] = { 621 621 { 622 622 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 623 623 .name = "Line Boost", ··· 627 627 .put = snd_miro_put_amp, 628 628 }}; 629 629 630 - static struct snd_kcontrol_new snd_miro_capture_control[] = { 630 + static const struct snd_kcontrol_new snd_miro_capture_control[] = { 631 631 { 632 632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 633 633 .name = "PCM Capture Switch",
+1 -1
sound/isa/opti9xx/opti92x-ad1848.c
··· 550 550 static const DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0); 551 551 static const DECLARE_TLV_DB_SCALE(db_scale_4bit_12db_max, -3300, 300, 0); 552 552 553 - static struct snd_kcontrol_new snd_opti93x_controls[] = { 553 + static const struct snd_kcontrol_new snd_opti93x_controls[] = { 554 554 WSS_DOUBLE("Master Playback Switch", 0, 555 555 OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), 556 556 WSS_DOUBLE_TLV("Master Playback Volume", 0,
+7 -7
sound/isa/sb/emu8000.c
··· 855 855 return change; 856 856 } 857 857 858 - static struct snd_kcontrol_new mixer_bass_control = 858 + static const struct snd_kcontrol_new mixer_bass_control = 859 859 { 860 860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 861 861 .name = "Synth Tone Control - Bass", ··· 865 865 .private_value = 0, 866 866 }; 867 867 868 - static struct snd_kcontrol_new mixer_treble_control = 868 + static const struct snd_kcontrol_new mixer_treble_control = 869 869 { 870 870 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 871 871 .name = "Synth Tone Control - Treble", ··· 922 922 return change; 923 923 } 924 924 925 - static struct snd_kcontrol_new mixer_chorus_mode_control = 925 + static const struct snd_kcontrol_new mixer_chorus_mode_control = 926 926 { 927 927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 928 928 .name = "Chorus Mode", ··· 932 932 .private_value = 1, 933 933 }; 934 934 935 - static struct snd_kcontrol_new mixer_reverb_mode_control = 935 + static const struct snd_kcontrol_new mixer_reverb_mode_control = 936 936 { 937 937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 938 938 .name = "Reverb Mode", ··· 984 984 return change; 985 985 } 986 986 987 - static struct snd_kcontrol_new mixer_fm_chorus_depth_control = 987 + static const struct snd_kcontrol_new mixer_fm_chorus_depth_control = 988 988 { 989 989 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 990 990 .name = "FM Chorus Depth", ··· 994 994 .private_value = 1, 995 995 }; 996 996 997 - static struct snd_kcontrol_new mixer_fm_reverb_depth_control = 997 + static const struct snd_kcontrol_new mixer_fm_reverb_depth_control = 998 998 { 999 999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1000 1000 .name = "FM Reverb Depth", ··· 1005 1005 }; 1006 1006 1007 1007 1008 - static struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = { 1008 + static const struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = { 1009 1009 &mixer_bass_control, 1010 1010 &mixer_treble_control, 1011 1011 &mixer_chorus_mode_control,
+1 -1
sound/isa/sb/sb_mixer.c
··· 438 438 */ 439 439 int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value) 440 440 { 441 - static struct snd_kcontrol_new newctls[] = { 441 + static const struct snd_kcontrol_new newctls[] = { 442 442 [SB_MIX_SINGLE] = { 443 443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 444 444 .info = snd_sbmixer_info_single,
+1 -1
sound/isa/wss/wss_lib.c
··· 2157 2157 static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 2158 2158 static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); 2159 2159 2160 - static struct snd_kcontrol_new snd_wss_controls[] = { 2160 + static const struct snd_kcontrol_new snd_wss_controls[] = { 2161 2161 WSS_DOUBLE("PCM Playback Switch", 0, 2162 2162 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 2163 2163 WSS_DOUBLE_TLV("PCM Playback Volume", 0,