Skip to content

Commit 905e46a

Browse files
goyalbhumikatiwai
authored andcommitted
ALSA: declare snd_kcontrol_new structures as const
Declare snd_kcontrol_new structures as const as they are only passed an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having this property can be made const. Done using Coccinelle: @r disable optional_qualifier@ identifier x; position p; @@ static struct snd_kcontrol_new x@p={...}; @ok@ identifier r.x; position p; @@ snd_ctl_new1(&x@p,...) @bad@ position p != {r.p,ok.p}; identifier r.x; @@ x@p @Depends on !bad disable optional_qualifier@ identifier r.x; @@ +const struct snd_kcontrol_new x; Cross compiled these files: sound/aoa/codecs/tas.c - powerpc sound/mips/{hal2.c/sgio2audio.c} - mips sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc sound/soc/sh/siu_dai.c - sh Could not find an architecture to compile sound/sh/aica.c. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 2c4842d commit 905e46a

14 files changed

Lines changed: 51 additions & 51 deletions

File tree

‎sound/aoa/codecs/tas.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static int tas_snd_vol_put(struct snd_kcontrol *kcontrol,
271271
return 1;
272272
}
273273

274-
static struct snd_kcontrol_new volume_control = {
274+
static const struct snd_kcontrol_new volume_control = {
275275
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
276276
.name = "Master Playback Volume",
277277
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -314,7 +314,7 @@ static int tas_snd_mute_put(struct snd_kcontrol *kcontrol,
314314
return 1;
315315
}
316316

317-
static struct snd_kcontrol_new mute_control = {
317+
static const struct snd_kcontrol_new mute_control = {
318318
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
319319
.name = "Master Playback Switch",
320320
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -426,7 +426,7 @@ static int tas_snd_drc_range_put(struct snd_kcontrol *kcontrol,
426426
return 1;
427427
}
428428

429-
static struct snd_kcontrol_new drc_range_control = {
429+
static const struct snd_kcontrol_new drc_range_control = {
430430
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
431431
.name = "DRC Range",
432432
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -466,7 +466,7 @@ static int tas_snd_drc_switch_put(struct snd_kcontrol *kcontrol,
466466
return 1;
467467
}
468468

469-
static struct snd_kcontrol_new drc_switch_control = {
469+
static const struct snd_kcontrol_new drc_switch_control = {
470470
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
471471
.name = "DRC Range Switch",
472472
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -524,7 +524,7 @@ static int tas_snd_capture_source_put(struct snd_kcontrol *kcontrol,
524524
return 1;
525525
}
526526

527-
static struct snd_kcontrol_new capture_source_control = {
527+
static const struct snd_kcontrol_new capture_source_control = {
528528
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
529529
/* If we name this 'Input Source', it properly shows up in
530530
* alsamixer as a selection, * but it's shown under the
@@ -586,7 +586,7 @@ static int tas_snd_treble_put(struct snd_kcontrol *kcontrol,
586586
return 1;
587587
}
588588

589-
static struct snd_kcontrol_new treble_control = {
589+
static const struct snd_kcontrol_new treble_control = {
590590
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
591591
.name = "Treble",
592592
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -637,7 +637,7 @@ static int tas_snd_bass_put(struct snd_kcontrol *kcontrol,
637637
return 1;
638638
}
639639

640-
static struct snd_kcontrol_new bass_control = {
640+
static const struct snd_kcontrol_new bass_control = {
641641
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
642642
.name = "Bass",
643643
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,

‎sound/aoa/fabrics/layout.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ static int detect_choice_put(struct snd_kcontrol *kcontrol,
707707
return 1;
708708
}
709709

710-
static struct snd_kcontrol_new headphone_detect_choice = {
710+
static const struct snd_kcontrol_new headphone_detect_choice = {
711711
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
712712
.name = "Headphone Detect Autoswitch",
713713
.info = control_info,
@@ -717,7 +717,7 @@ static struct snd_kcontrol_new headphone_detect_choice = {
717717
.private_value = 0,
718718
};
719719

720-
static struct snd_kcontrol_new lineout_detect_choice = {
720+
static const struct snd_kcontrol_new lineout_detect_choice = {
721721
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
722722
.name = "Line-Out Detect Autoswitch",
723723
.info = control_info,
@@ -749,7 +749,7 @@ static int detected_get(struct snd_kcontrol *kcontrol,
749749
return 0;
750750
}
751751

752-
static struct snd_kcontrol_new headphone_detected = {
752+
static const struct snd_kcontrol_new headphone_detected = {
753753
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
754754
.name = "Headphone Detected",
755755
.info = control_info,
@@ -758,7 +758,7 @@ static struct snd_kcontrol_new headphone_detected = {
758758
.private_value = 0,
759759
};
760760

761-
static struct snd_kcontrol_new lineout_detected = {
761+
static const struct snd_kcontrol_new lineout_detected = {
762762
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
763763
.name = "Line-Out Detected",
764764
.info = control_info,

‎sound/core/ctljack.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol,
2323
return 0;
2424
}
2525

26-
static struct snd_kcontrol_new jack_detect_kctl = {
26+
static const struct snd_kcontrol_new jack_detect_kctl = {
2727
/* name is filled later */
2828
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
2929
.access = SNDRV_CTL_ELEM_ACCESS_READ,

‎sound/drivers/vx/vx_mixer.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static int vx_output_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
455455
return 0;
456456
}
457457

458-
static struct snd_kcontrol_new vx_control_output_level = {
458+
static const struct snd_kcontrol_new vx_control_output_level = {
459459
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
460460
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
461461
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
@@ -514,7 +514,7 @@ static int vx_audio_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
514514
return 0;
515515
}
516516

517-
static struct snd_kcontrol_new vx_control_audio_src = {
517+
static const struct snd_kcontrol_new vx_control_audio_src = {
518518
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
519519
.name = "Capture Source",
520520
.info = vx_audio_src_info,
@@ -558,7 +558,7 @@ static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
558558
return 0;
559559
}
560560

561-
static struct snd_kcontrol_new vx_control_clock_mode = {
561+
static const struct snd_kcontrol_new vx_control_clock_mode = {
562562
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
563563
.name = "Clock Mode",
564564
.info = vx_clock_mode_info,
@@ -717,7 +717,7 @@ static int vx_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
717717

718718
static const DECLARE_TLV_DB_SCALE(db_scale_audio_gain, -10975, 25, 0);
719719

720-
static struct snd_kcontrol_new vx_control_audio_gain = {
720+
static const struct snd_kcontrol_new vx_control_audio_gain = {
721721
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
722722
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
723723
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
@@ -727,14 +727,14 @@ static struct snd_kcontrol_new vx_control_audio_gain = {
727727
.put = vx_audio_gain_put,
728728
.tlv = { .p = db_scale_audio_gain },
729729
};
730-
static struct snd_kcontrol_new vx_control_output_switch = {
730+
static const struct snd_kcontrol_new vx_control_output_switch = {
731731
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
732732
.name = "PCM Playback Switch",
733733
.info = vx_audio_sw_info,
734734
.get = vx_audio_sw_get,
735735
.put = vx_audio_sw_put
736736
};
737-
static struct snd_kcontrol_new vx_control_monitor_gain = {
737+
static const struct snd_kcontrol_new vx_control_monitor_gain = {
738738
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
739739
.name = "Monitoring Volume",
740740
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -744,7 +744,7 @@ static struct snd_kcontrol_new vx_control_monitor_gain = {
744744
.put = vx_audio_monitor_put,
745745
.tlv = { .p = db_scale_audio_gain },
746746
};
747-
static struct snd_kcontrol_new vx_control_monitor_switch = {
747+
static const struct snd_kcontrol_new vx_control_monitor_switch = {
748748
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
749749
.name = "Monitoring Switch",
750750
.info = vx_audio_sw_info, /* shared */
@@ -805,15 +805,15 @@ static int vx_iec958_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
805805
return 0;
806806
}
807807

808-
static struct snd_kcontrol_new vx_control_iec958_mask = {
808+
static const struct snd_kcontrol_new vx_control_iec958_mask = {
809809
.access = SNDRV_CTL_ELEM_ACCESS_READ,
810810
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
811811
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
812812
.info = vx_iec958_info, /* shared */
813813
.get = vx_iec958_mask_get,
814814
};
815815

816-
static struct snd_kcontrol_new vx_control_iec958 = {
816+
static const struct snd_kcontrol_new vx_control_iec958 = {
817817
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
818818
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
819819
.info = vx_iec958_info,
@@ -878,23 +878,23 @@ static int vx_saturation_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
878878
return 0;
879879
}
880880

881-
static struct snd_kcontrol_new vx_control_vu_meter = {
881+
static const struct snd_kcontrol_new vx_control_vu_meter = {
882882
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
883883
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
884884
/* name will be filled later */
885885
.info = vx_vu_meter_info,
886886
.get = vx_vu_meter_get,
887887
};
888888

889-
static struct snd_kcontrol_new vx_control_peak_meter = {
889+
static const struct snd_kcontrol_new vx_control_peak_meter = {
890890
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
891891
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
892892
/* name will be filled later */
893893
.info = vx_vu_meter_info, /* shared */
894894
.get = vx_peak_meter_get,
895895
};
896896

897-
static struct snd_kcontrol_new vx_control_saturation = {
897+
static const struct snd_kcontrol_new vx_control_saturation = {
898898
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
899899
.name = "Input Saturation",
900900
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,

‎sound/firewire/bebob/bebob_maudio.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ static int special_clk_ctl_put(struct snd_kcontrol *kctl,
396396

397397
return err;
398398
}
399-
static struct snd_kcontrol_new special_clk_ctl = {
399+
static const struct snd_kcontrol_new special_clk_ctl = {
400400
.name = "Clock Source",
401401
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
402402
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -429,7 +429,7 @@ static int special_sync_ctl_get(struct snd_kcontrol *kctl,
429429

430430
return 0;
431431
}
432-
static struct snd_kcontrol_new special_sync_ctl = {
432+
static const struct snd_kcontrol_new special_sync_ctl = {
433433
.name = "Sync Status",
434434
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
435435
.access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -521,7 +521,7 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl,
521521
mutex_unlock(&bebob->mutex);
522522
return err;
523523
}
524-
static struct snd_kcontrol_new special_dig_in_iface_ctl = {
524+
static const struct snd_kcontrol_new special_dig_in_iface_ctl = {
525525
.name = "Digital Input Interface",
526526
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
527527
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -577,7 +577,7 @@ static int special_dig_out_iface_ctl_set(struct snd_kcontrol *kctl,
577577
mutex_unlock(&bebob->mutex);
578578
return err;
579579
}
580-
static struct snd_kcontrol_new special_dig_out_iface_ctl = {
580+
static const struct snd_kcontrol_new special_dig_out_iface_ctl = {
581581
.name = "Digital Output Interface",
582582
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
583583
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,

‎sound/mips/hal2.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int hal2_gain_put(struct snd_kcontrol *kcontrol,
264264
return old != new;
265265
}
266266

267-
static struct snd_kcontrol_new hal2_ctrl_headphone = {
267+
static const struct snd_kcontrol_new hal2_ctrl_headphone = {
268268
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
269269
.name = "Headphone Playback Volume",
270270
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -274,7 +274,7 @@ static struct snd_kcontrol_new hal2_ctrl_headphone = {
274274
.put = hal2_gain_put,
275275
};
276276

277-
static struct snd_kcontrol_new hal2_ctrl_mic = {
277+
static const struct snd_kcontrol_new hal2_ctrl_mic = {
278278
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
279279
.name = "Mic Capture Volume",
280280
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,

‎sound/mips/sgio2audio.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static int sgio2audio_source_put(struct snd_kcontrol *kcontrol,
230230
}
231231

232232
/* dac1/pcm0 mixer control */
233-
static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 = {
233+
static const struct snd_kcontrol_new sgio2audio_ctrl_pcm0 = {
234234
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
235235
.name = "PCM Playback Volume",
236236
.index = 0,
@@ -242,7 +242,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 = {
242242
};
243243

244244
/* dac2/pcm1 mixer control */
245-
static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 = {
245+
static const struct snd_kcontrol_new sgio2audio_ctrl_pcm1 = {
246246
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
247247
.name = "PCM Playback Volume",
248248
.index = 1,
@@ -254,7 +254,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 = {
254254
};
255255

256256
/* record level mixer control */
257-
static struct snd_kcontrol_new sgio2audio_ctrl_reclevel = {
257+
static const struct snd_kcontrol_new sgio2audio_ctrl_reclevel = {
258258
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
259259
.name = "Capture Volume",
260260
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -265,7 +265,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_reclevel = {
265265
};
266266

267267
/* record level source control */
268-
static struct snd_kcontrol_new sgio2audio_ctrl_recsource = {
268+
static const struct snd_kcontrol_new sgio2audio_ctrl_recsource = {
269269
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
270270
.name = "Capture Source",
271271
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -275,7 +275,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_recsource = {
275275
};
276276

277277
/* line mixer control */
278-
static struct snd_kcontrol_new sgio2audio_ctrl_line = {
278+
static const struct snd_kcontrol_new sgio2audio_ctrl_line = {
279279
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
280280
.name = "Line Playback Volume",
281281
.index = 0,
@@ -287,7 +287,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_line = {
287287
};
288288

289289
/* cd mixer control */
290-
static struct snd_kcontrol_new sgio2audio_ctrl_cd = {
290+
static const struct snd_kcontrol_new sgio2audio_ctrl_cd = {
291291
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
292292
.name = "Line Playback Volume",
293293
.index = 1,
@@ -299,7 +299,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_cd = {
299299
};
300300

301301
/* mic mixer control */
302-
static struct snd_kcontrol_new sgio2audio_ctrl_mic = {
302+
static const struct snd_kcontrol_new sgio2audio_ctrl_mic = {
303303
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
304304
.name = "Mic Playback Volume",
305305
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,

‎sound/pcmcia/vx/vxp_mixer.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
6969

7070
static const DECLARE_TLV_DB_SCALE(db_scale_mic, -21, 3, 0);
7171

72-
static struct snd_kcontrol_new vx_control_mic_level = {
72+
static const struct snd_kcontrol_new vx_control_mic_level = {
7373
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7474
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
7575
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
@@ -109,7 +109,7 @@ static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
109109
return 0;
110110
}
111111

112-
static struct snd_kcontrol_new vx_control_mic_boost = {
112+
static const struct snd_kcontrol_new vx_control_mic_boost = {
113113
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
114114
.name = "Mic Boost",
115115
.info = vx_mic_boost_info,

‎sound/ppc/awacs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = {
514514
},
515515
};
516516

517-
static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw = {
517+
static const struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw = {
518518
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
519519
.name = "Headphone Playback Switch",
520520
.info = snd_pmac_boolean_stereo_info,
@@ -523,7 +523,7 @@ static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw = {
523523
.private_value = AMP_CH_HD,
524524
};
525525

526-
static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw = {
526+
static const struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw = {
527527
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
528528
.name = "Speaker Playback Switch",
529529
.info = snd_pmac_boolean_stereo_info,

‎sound/ppc/beep.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol,
206206
return oval != chip->beep->volume;
207207
}
208208

209-
static struct snd_kcontrol_new snd_pmac_beep_mixer = {
209+
static const struct snd_kcontrol_new snd_pmac_beep_mixer = {
210210
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
211211
.name = "Beep Playback Volume",
212212
.info = snd_pmac_info_beep,

0 commit comments

Comments
 (0)