Skip to content

Commit f3b827e

Browse files
goyalbhumikatiwai
authored andcommitted
ALSA: pci: constify snd_kcontrol_new structures
Declare snd_kcontrol_new structures as const as they are only passed as an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having the same property can be made const too. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct snd_kcontrol_new i@p = {...}; @ok1@ identifier r1.i; position p; expression e1; @@ snd_ctl_new1(&i@p,e1) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @Depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct snd_kcontrol_new i; Signed-off-by: Bhumika Goyal <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 34371d2 commit f3b827e

28 files changed

+123
-123
lines changed

sound/pci/au88x0/au88x0_a3d.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol,
846846
return changed;
847847
}
848848

849-
static struct snd_kcontrol_new vortex_a3d_kcontrol = {
849+
static const struct snd_kcontrol_new vortex_a3d_kcontrol = {
850850
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
851851
.name = "Playback PCM advanced processing",
852852
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,

sound/pci/au88x0/au88x0_eq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ snd_vortex_eqtoggle_put(struct snd_kcontrol *kcontrol,
757757
return 1; /* Allways changes */
758758
}
759759

760-
static struct snd_kcontrol_new vortex_eqtoggle_kcontrol = {
760+
static const struct snd_kcontrol_new vortex_eqtoggle_kcontrol = {
761761
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
762762
.name = "EQ Enable",
763763
.index = 0,
@@ -815,7 +815,7 @@ snd_vortex_eq_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucon
815815
return changed;
816816
}
817817

818-
static struct snd_kcontrol_new vortex_eq_kcontrol = {
818+
static const struct snd_kcontrol_new vortex_eq_kcontrol = {
819819
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
820820
.name = " .",
821821
.index = 0,
@@ -855,7 +855,7 @@ snd_vortex_peaks_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
855855
return 0;
856856
}
857857

858-
static struct snd_kcontrol_new vortex_levels_kcontrol = {
858+
static const struct snd_kcontrol_new vortex_levels_kcontrol = {
859859
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
860860
.name = "EQ Peaks",
861861
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,

sound/pci/au88x0/au88x0_pcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int snd_vortex_pcm_vol_put(struct snd_kcontrol *kcontrol,
601601

602602
static const DECLARE_TLV_DB_MINMAX(vortex_pcm_vol_db_scale, -9600, 2400);
603603

604-
static struct snd_kcontrol_new snd_vortex_pcm_vol = {
604+
static const struct snd_kcontrol_new snd_vortex_pcm_vol = {
605605
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
606606
.name = "PCM Playback Volume",
607607
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |

sound/pci/aw2/aw2-alsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static const struct snd_pcm_ops snd_aw2_capture_ops = {
202202
.pointer = snd_aw2_pcm_pointer_capture,
203203
};
204204

205-
static struct snd_kcontrol_new aw2_control = {
205+
static const struct snd_kcontrol_new aw2_control = {
206206
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
207207
.name = "PCM Capture Route",
208208
.index = 0,

sound/pci/bt87x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static int snd_bt87x_capture_volume_put(struct snd_kcontrol *kcontrol,
598598
return changed;
599599
}
600600

601-
static struct snd_kcontrol_new snd_bt87x_capture_volume = {
601+
static const struct snd_kcontrol_new snd_bt87x_capture_volume = {
602602
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
603603
.name = "Capture Volume",
604604
.info = snd_bt87x_capture_volume_info,
@@ -634,7 +634,7 @@ static int snd_bt87x_capture_boost_put(struct snd_kcontrol *kcontrol,
634634
return changed;
635635
}
636636

637-
static struct snd_kcontrol_new snd_bt87x_capture_boost = {
637+
static const struct snd_kcontrol_new snd_bt87x_capture_boost = {
638638
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
639639
.name = "Capture Boost",
640640
.info = snd_bt87x_capture_boost_info,
@@ -676,7 +676,7 @@ static int snd_bt87x_capture_source_put(struct snd_kcontrol *kcontrol,
676676
return changed;
677677
}
678678

679-
static struct snd_kcontrol_new snd_bt87x_capture_source = {
679+
static const struct snd_kcontrol_new snd_bt87x_capture_source = {
680680
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
681681
.name = "Capture Source",
682682
.info = snd_bt87x_capture_source_info,

sound/pci/ca0106/ca0106_mixer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static int snd_ca0106_capture_mic_line_in_put(struct snd_kcontrol *kcontrol,
301301
return change;
302302
}
303303

304-
static struct snd_kcontrol_new snd_ca0106_capture_mic_line_in =
304+
static const struct snd_kcontrol_new snd_ca0106_capture_mic_line_in =
305305
{
306306
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
307307
.name = "Shared Mic/Line in Capture Switch",
@@ -310,7 +310,7 @@ static struct snd_kcontrol_new snd_ca0106_capture_mic_line_in =
310310
.put = snd_ca0106_capture_mic_line_in_put
311311
};
312312

313-
static struct snd_kcontrol_new snd_ca0106_capture_line_in_side_out =
313+
static const struct snd_kcontrol_new snd_ca0106_capture_line_in_side_out =
314314
{
315315
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
316316
.name = "Shared Line in/Side out Capture Switch",

sound/pci/cmipci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ static int snd_cmipci_spdif_default_put(struct snd_kcontrol *kcontrol,
10451045
return change;
10461046
}
10471047

1048-
static struct snd_kcontrol_new snd_cmipci_spdif_default =
1048+
static const struct snd_kcontrol_new snd_cmipci_spdif_default =
10491049
{
10501050
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
10511051
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -1072,7 +1072,7 @@ static int snd_cmipci_spdif_mask_get(struct snd_kcontrol *kcontrol,
10721072
return 0;
10731073
}
10741074

1075-
static struct snd_kcontrol_new snd_cmipci_spdif_mask =
1075+
static const struct snd_kcontrol_new snd_cmipci_spdif_mask =
10761076
{
10771077
.access = SNDRV_CTL_ELEM_ACCESS_READ,
10781078
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1119,7 +1119,7 @@ static int snd_cmipci_spdif_stream_put(struct snd_kcontrol *kcontrol,
11191119
return change;
11201120
}
11211121

1122-
static struct snd_kcontrol_new snd_cmipci_spdif_stream =
1122+
static const struct snd_kcontrol_new snd_cmipci_spdif_stream =
11231123
{
11241124
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
11251125
.iface = SNDRV_CTL_ELEM_IFACE_PCM,

sound/pci/cs4281.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ static int snd_cs4281_put_volume(struct snd_kcontrol *kcontrol,
10551055

10561056
static const DECLARE_TLV_DB_SCALE(db_scale_dsp, -4650, 150, 0);
10571057

1058-
static struct snd_kcontrol_new snd_cs4281_fm_vol =
1058+
static const struct snd_kcontrol_new snd_cs4281_fm_vol =
10591059
{
10601060
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10611061
.name = "Synth Playback Volume",
@@ -1066,7 +1066,7 @@ static struct snd_kcontrol_new snd_cs4281_fm_vol =
10661066
.tlv = { .p = db_scale_dsp },
10671067
};
10681068

1069-
static struct snd_kcontrol_new snd_cs4281_pcm_vol =
1069+
static const struct snd_kcontrol_new snd_cs4281_pcm_vol =
10701070
{
10711071
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10721072
.name = "PCM Stream Playback Volume",

sound/pci/echoaudio/echoaudio.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
10391039

10401040
#ifdef ECHOCARD_HAS_LINE_OUT_GAIN
10411041
/* On the Mia this one controls the line-out volume */
1042-
static struct snd_kcontrol_new snd_echo_line_output_gain = {
1042+
static const struct snd_kcontrol_new snd_echo_line_output_gain = {
10431043
.name = "Line Playback Volume",
10441044
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10451045
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -1050,7 +1050,7 @@ static struct snd_kcontrol_new snd_echo_line_output_gain = {
10501050
.tlv = {.p = db_scale_output_gain},
10511051
};
10521052
#else
1053-
static struct snd_kcontrol_new snd_echo_pcm_output_gain = {
1053+
static const struct snd_kcontrol_new snd_echo_pcm_output_gain = {
10541054
.name = "PCM Playback Volume",
10551055
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10561056
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -1120,7 +1120,7 @@ static int snd_echo_input_gain_put(struct snd_kcontrol *kcontrol,
11201120

11211121
static const DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0);
11221122

1123-
static struct snd_kcontrol_new snd_echo_line_input_gain = {
1123+
static const struct snd_kcontrol_new snd_echo_line_input_gain = {
11241124
.name = "Line Capture Volume",
11251125
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11261126
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -1184,7 +1184,7 @@ static int snd_echo_output_nominal_put(struct snd_kcontrol *kcontrol,
11841184
return changed;
11851185
}
11861186

1187-
static struct snd_kcontrol_new snd_echo_output_nominal_level = {
1187+
static const struct snd_kcontrol_new snd_echo_output_nominal_level = {
11881188
.name = "Line Playback Switch (-10dBV)",
11891189
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11901190
.info = snd_echo_output_nominal_info,
@@ -1250,7 +1250,7 @@ static int snd_echo_input_nominal_put(struct snd_kcontrol *kcontrol,
12501250
return changed;
12511251
}
12521252

1253-
static struct snd_kcontrol_new snd_echo_intput_nominal_level = {
1253+
static const struct snd_kcontrol_new snd_echo_intput_nominal_level = {
12541254
.name = "Line Capture Switch (-10dBV)",
12551255
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12561256
.info = snd_echo_input_nominal_info,
@@ -1477,7 +1477,7 @@ static int snd_echo_digital_mode_put(struct snd_kcontrol *kcontrol,
14771477
return changed;
14781478
}
14791479

1480-
static struct snd_kcontrol_new snd_echo_digital_mode_switch = {
1480+
static const struct snd_kcontrol_new snd_echo_digital_mode_switch = {
14811481
.name = "Digital mode Switch",
14821482
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
14831483
.info = snd_echo_digital_mode_info,
@@ -1527,7 +1527,7 @@ static int snd_echo_spdif_mode_put(struct snd_kcontrol *kcontrol,
15271527
return 0;
15281528
}
15291529

1530-
static struct snd_kcontrol_new snd_echo_spdif_mode_switch = {
1530+
static const struct snd_kcontrol_new snd_echo_spdif_mode_switch = {
15311531
.name = "S/PDIF mode Switch",
15321532
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
15331533
.info = snd_echo_spdif_mode_info,
@@ -1600,7 +1600,7 @@ static int snd_echo_clock_source_put(struct snd_kcontrol *kcontrol,
16001600
return changed;
16011601
}
16021602

1603-
static struct snd_kcontrol_new snd_echo_clock_source_switch = {
1603+
static const struct snd_kcontrol_new snd_echo_clock_source_switch = {
16041604
.name = "Sample Clock Source",
16051605
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
16061606
.info = snd_echo_clock_source_info,
@@ -1643,7 +1643,7 @@ static int snd_echo_phantom_power_put(struct snd_kcontrol *kcontrol,
16431643
return changed;
16441644
}
16451645

1646-
static struct snd_kcontrol_new snd_echo_phantom_power_switch = {
1646+
static const struct snd_kcontrol_new snd_echo_phantom_power_switch = {
16471647
.name = "Phantom power Switch",
16481648
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
16491649
.info = snd_echo_phantom_power_info,
@@ -1686,7 +1686,7 @@ static int snd_echo_automute_put(struct snd_kcontrol *kcontrol,
16861686
return changed;
16871687
}
16881688

1689-
static struct snd_kcontrol_new snd_echo_automute_switch = {
1689+
static const struct snd_kcontrol_new snd_echo_automute_switch = {
16901690
.name = "Digital Capture Switch (automute)",
16911691
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
16921692
.info = snd_echo_automute_info,
@@ -1713,7 +1713,7 @@ static int snd_echo_vumeters_switch_put(struct snd_kcontrol *kcontrol,
17131713
return 1;
17141714
}
17151715

1716-
static struct snd_kcontrol_new snd_echo_vumeters_switch = {
1716+
static const struct snd_kcontrol_new snd_echo_vumeters_switch = {
17171717
.name = "VU-meters Switch",
17181718
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
17191719
.access = SNDRV_CTL_ELEM_ACCESS_WRITE,
@@ -1751,7 +1751,7 @@ static int snd_echo_vumeters_get(struct snd_kcontrol *kcontrol,
17511751
return 0;
17521752
}
17531753

1754-
static struct snd_kcontrol_new snd_echo_vumeters = {
1754+
static const struct snd_kcontrol_new snd_echo_vumeters = {
17551755
.name = "VU-meters",
17561756
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17571757
.access = SNDRV_CTL_ELEM_ACCESS_READ |
@@ -1804,7 +1804,7 @@ static int snd_echo_channels_info_get(struct snd_kcontrol *kcontrol,
18041804
return 0;
18051805
}
18061806

1807-
static struct snd_kcontrol_new snd_echo_channels_info = {
1807+
static const struct snd_kcontrol_new snd_echo_channels_info = {
18081808
.name = "Channels info",
18091809
.iface = SNDRV_CTL_ELEM_IFACE_HWDEP,
18101810
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,

sound/pci/emu10k1/emu10k1x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ static int snd_emu10k1x_shared_spdif_put(struct snd_kcontrol *kcontrol,
11121112
return change;
11131113
}
11141114

1115-
static struct snd_kcontrol_new snd_emu10k1x_shared_spdif =
1115+
static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif =
11161116
{
11171117
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11181118
.name = "Analog/Digital Output Jack",
@@ -1171,7 +1171,7 @@ static int snd_emu10k1x_spdif_put(struct snd_kcontrol *kcontrol,
11711171
return change;
11721172
}
11731173

1174-
static struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control =
1174+
static const struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control =
11751175
{
11761176
.access = SNDRV_CTL_ELEM_ACCESS_READ,
11771177
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1181,7 +1181,7 @@ static struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control =
11811181
.get = snd_emu10k1x_spdif_get_mask
11821182
};
11831183

1184-
static struct snd_kcontrol_new snd_emu10k1x_spdif_control =
1184+
static const struct snd_kcontrol_new snd_emu10k1x_spdif_control =
11851185
{
11861186
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
11871187
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),

0 commit comments

Comments
 (0)