Skip to content

Commit b4e5e70

Browse files
committed
ALSA: pci: 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-38-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 35ace5e commit b4e5e70

33 files changed

Lines changed: 76 additions & 76 deletions

‎sound/pci/ak4531_codec.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_master, -6200, 200, 0);
255255
static const DECLARE_TLV_DB_SCALE(db_scale_mono, -2800, 400, 0);
256256
static const DECLARE_TLV_DB_SCALE(db_scale_input, -5000, 200, 0);
257257

258-
static struct snd_kcontrol_new snd_ak4531_controls[] = {
258+
static const struct snd_kcontrol_new snd_ak4531_controls[] = {
259259

260260
AK4531_DOUBLE_TLV("Master Playback Switch", 0,
261261
AK4531_LMASTER, AK4531_RMASTER, 7, 7, 1, 1,

‎sound/pci/ali5451/ali5451.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ static int snd_ali5451_spdif_put(struct snd_kcontrol *kcontrol,
17761776
return change;
17771777
}
17781778

1779-
static struct snd_kcontrol_new snd_ali5451_mixer_spdif[] = {
1779+
static const struct snd_kcontrol_new snd_ali5451_mixer_spdif[] = {
17801780
/* spdif aplayback switch */
17811781
/* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */
17821782
ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), 0, 0),

‎sound/pci/au88x0/au88x0_pcm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static int snd_vortex_spdif_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
497497
}
498498

499499
/* spdif controls */
500-
static struct snd_kcontrol_new snd_vortex_mixer_spdif[] = {
500+
static const struct snd_kcontrol_new snd_vortex_mixer_spdif[] = {
501501
{
502502
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
503503
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),

‎sound/pci/azt3328.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol,
10941094
return (nreg != oreg);
10951095
}
10961096

1097-
static struct snd_kcontrol_new snd_azf3328_mixer_controls[] = {
1097+
static const struct snd_kcontrol_new snd_azf3328_mixer_controls[] = {
10981098
AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1),
10991099
AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1),
11001100
AZF3328_MIXER_SWITCH("PCM Playback Switch", IDX_MIXER_WAVEOUT, 15, 1),

‎sound/pci/ca0106/ca0106_mixer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ static int spi_mute_put(struct snd_kcontrol *kcontrol,
550550
.private_value = ((chid) << 8) | (reg) \
551551
}
552552

553-
static struct snd_kcontrol_new snd_ca0106_volume_ctls[] = {
553+
static const struct snd_kcontrol_new snd_ca0106_volume_ctls[] = {
554554
CA_VOLUME("Analog Front Playback Volume",
555555
CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2),
556556
CA_VOLUME("Analog Rear Playback Volume",
@@ -631,7 +631,7 @@ static struct snd_kcontrol_new snd_ca0106_volume_ctls[] = {
631631
.private_value = chid \
632632
}
633633

634-
static struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = {
634+
static const struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = {
635635
I2C_VOLUME("Phone Capture Volume", 0),
636636
I2C_VOLUME("Mic Capture Volume", 1),
637637
I2C_VOLUME("Line in Capture Volume", 2),

‎sound/pci/cmipci.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ static int snd_cmipci_put_native_mixer_sensitive(struct snd_kcontrol *kcontrol,
22562256
}
22572257

22582258

2259-
static struct snd_kcontrol_new snd_cmipci_mixers[] = {
2259+
static const struct snd_kcontrol_new snd_cmipci_mixers[] = {
22602260
CMIPCI_SB_VOL_STEREO("Master Playback Volume", SB_DSP4_MASTER_DEV, 3, 31),
22612261
CMIPCI_MIXER_SW_MONO("3D Control - Switch", CM_REG_MIXER1, CM_X3DEN_SHIFT, 0),
22622262
CMIPCI_SB_VOL_STEREO("PCM Playback Volume", SB_DSP4_PCM_DEV, 3, 31),
@@ -2567,7 +2567,7 @@ static int snd_cmipci_mic_in_mode_put(struct snd_kcontrol *kcontrol,
25672567
}
25682568

25692569
/* both for CM8338/8738 */
2570-
static struct snd_kcontrol_new snd_cmipci_mixer_switches[] = {
2570+
static const struct snd_kcontrol_new snd_cmipci_mixer_switches[] = {
25712571
DEFINE_MIXER_SWITCH("Four Channel Mode", fourch),
25722572
{
25732573
.name = "Line-In Mode",
@@ -2579,11 +2579,11 @@ static struct snd_kcontrol_new snd_cmipci_mixer_switches[] = {
25792579
};
25802580

25812581
/* for non-multichannel chips */
2582-
static struct snd_kcontrol_new snd_cmipci_nomulti_switch =
2582+
static const struct snd_kcontrol_new snd_cmipci_nomulti_switch =
25832583
DEFINE_MIXER_SWITCH("Exchange DAC", exchange_dac);
25842584

25852585
/* only for CM8738 */
2586-
static struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] = {
2586+
static const struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] = {
25872587
#if 0 /* controlled in pcm device */
25882588
DEFINE_MIXER_SWITCH("IEC958 In Record", spdif_in),
25892589
DEFINE_MIXER_SWITCH("IEC958 Out", spdif_out),
@@ -2605,14 +2605,14 @@ static struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] = {
26052605
};
26062606

26072607
/* only for model 033/037 */
2608-
static struct snd_kcontrol_new snd_cmipci_old_mixer_switches[] = {
2608+
static const struct snd_kcontrol_new snd_cmipci_old_mixer_switches[] = {
26092609
DEFINE_MIXER_SWITCH("IEC958 Mix Analog", spdif_dac_out),
26102610
DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase),
26112611
DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel1),
26122612
};
26132613

26142614
/* only for model 039 or later */
2615-
static struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] = {
2615+
static const struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] = {
26162616
DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel2),
26172617
DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase2),
26182618
{
@@ -2625,14 +2625,14 @@ static struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] = {
26252625
};
26262626

26272627
/* card control switches */
2628-
static struct snd_kcontrol_new snd_cmipci_modem_switch =
2628+
static const struct snd_kcontrol_new snd_cmipci_modem_switch =
26292629
DEFINE_CARD_SWITCH("Modem", modem);
26302630

26312631

26322632
static int snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device)
26332633
{
26342634
struct snd_card *card;
2635-
struct snd_kcontrol_new *sw;
2635+
const struct snd_kcontrol_new *sw;
26362636
struct snd_kcontrol *kctl;
26372637
unsigned int idx;
26382638
int err;

‎sound/pci/cs46xx/cs46xx_lib.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
22382238
#endif /* CONFIG_SND_CS46XX_NEW_DSP */
22392239

22402240

2241-
static struct snd_kcontrol_new snd_cs46xx_controls[] = {
2241+
static const struct snd_kcontrol_new snd_cs46xx_controls[] = {
22422242
{
22432243
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
22442244
.name = "DAC Volume",
@@ -2364,7 +2364,7 @@ static const struct snd_kcontrol_new snd_cs46xx_front_dup_ctl = {
23642364

23652365
#ifdef CONFIG_SND_CS46XX_NEW_DSP
23662366
/* Only available on the Hercules Game Theater XP soundcard */
2367-
static struct snd_kcontrol_new snd_hercules_controls[] = {
2367+
static const struct snd_kcontrol_new snd_hercules_controls[] = {
23682368
{
23692369
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
23702370
.name = "Optical/Coaxial SPDIF Input Switch",

‎sound/pci/cs5535audio/cs5535audio_olpc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int olpc_mic_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v)
111111
return 1;
112112
}
113113

114-
static struct snd_kcontrol_new olpc_cs5535audio_ctls[] = {
114+
static const struct snd_kcontrol_new olpc_cs5535audio_ctls[] = {
115115
{
116116
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
117117
.name = "DC Mode Enable",

‎sound/pci/emu10k1/emumixer.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
484484
.private_value = chid \
485485
}
486486

487-
static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] = {
487+
static const struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] = {
488488
EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0),
489489
EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1),
490490
EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2),
@@ -513,7 +513,7 @@ static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] = {
513513

514514

515515
/* 1616(m) cardbus */
516-
static struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] = {
516+
static const struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] = {
517517
EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0),
518518
EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1),
519519
EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2),
@@ -545,7 +545,7 @@ static struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] = {
545545
.private_value = chid \
546546
}
547547

548-
static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] = {
548+
static const struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] = {
549549
EMU1010_SOURCE_INPUT("DSP 0 Capture Enum", 0),
550550
EMU1010_SOURCE_INPUT("DSP 1 Capture Enum", 1),
551551
EMU1010_SOURCE_INPUT("DSP 2 Capture Enum", 2),
@@ -613,7 +613,7 @@ static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ct
613613
.private_value = chid \
614614
}
615615

616-
static struct snd_kcontrol_new snd_emu1010_adc_pads[] = {
616+
static const struct snd_kcontrol_new snd_emu1010_adc_pads[] = {
617617
EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1),
618618
EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2),
619619
EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3),
@@ -661,7 +661,7 @@ static int snd_emu1010_dac_pads_put(struct snd_kcontrol *kcontrol, struct snd_ct
661661
.private_value = chid \
662662
}
663663

664-
static struct snd_kcontrol_new snd_emu1010_dac_pads[] = {
664+
static const struct snd_kcontrol_new snd_emu1010_dac_pads[] = {
665665
EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1),
666666
EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2),
667667
EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3),
@@ -1051,7 +1051,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
10511051
}
10521052

10531053

1054-
static struct snd_kcontrol_new snd_audigy_i2c_volume_ctls[] = {
1054+
static const struct snd_kcontrol_new snd_audigy_i2c_volume_ctls[] = {
10551055
I2C_VOLUME("Mic Capture Volume", 0),
10561056
I2C_VOLUME("Line Capture Volume", 0)
10571057
};
@@ -1125,7 +1125,7 @@ static int snd_audigy_spdif_output_rate_put(struct snd_kcontrol *kcontrol,
11251125
return change;
11261126
}
11271127

1128-
static struct snd_kcontrol_new snd_audigy_spdif_output_rate =
1128+
static const struct snd_kcontrol_new snd_audigy_spdif_output_rate =
11291129
{
11301130
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
11311131
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,

‎sound/pci/emu10k1/p16v.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ static const DECLARE_TLV_DB_SCALE(snd_p16v_db_scale1, -5175, 25, 1);
776776
.private_value = ((xreg) | ((xhl) << 8)) \
777777
}
778778

779-
static struct snd_kcontrol_new p16v_mixer_controls[] = {
779+
static const struct snd_kcontrol_new p16v_mixer_controls[] = {
780780
P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0),
781781
P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1),
782782
P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1),

0 commit comments

Comments
 (0)