Skip to content

Commit c031b0c

Browse files
committed
ALSA: ppc: 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-39-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent b4e5e70 commit c031b0c

6 files changed

Lines changed: 40 additions & 40 deletions

File tree

‎sound/ppc/awacs.c‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol,
464464
#define AMP_CH_SPK 0
465465
#define AMP_CH_HD 1
466466

467-
static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = {
467+
static const struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = {
468468
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
469469
.name = "Speaker Playback Volume",
470470
.info = snd_pmac_awacs_info_volume_amp,
@@ -582,81 +582,81 @@ static int snd_pmac_screamer_mic_boost_put(struct snd_kcontrol *kcontrol,
582582
/*
583583
* lists of mixer elements
584584
*/
585-
static struct snd_kcontrol_new snd_pmac_awacs_mixers[] = {
585+
static const struct snd_kcontrol_new snd_pmac_awacs_mixers[] = {
586586
AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0),
587587
AWACS_VOLUME("Master Capture Volume", 0, 4, 0),
588588
/* AWACS_SWITCH("Unknown Playback Switch", 6, SHIFT_PAROUT0, 0), */
589589
};
590590

591-
static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = {
591+
static const struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = {
592592
AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
593593
AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
594594
AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
595595
AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0),
596596
};
597597

598-
static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = {
598+
static const struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = {
599599
AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
600600
};
601601

602-
static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = {
602+
static const struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = {
603603
AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
604604
AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
605605
};
606606

607-
static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = {
607+
static const struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = {
608608
AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
609609
AWACS_VOLUME("Master Playback Volume", 5, 6, 1),
610610
AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
611611
AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
612612
};
613613

614-
static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = {
614+
static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = {
615615
AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
616616
AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
617617
AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
618618
};
619619

620-
static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = {
620+
static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = {
621621
AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1),
622622
};
623623

624-
static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = {
624+
static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = {
625625
AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
626626
AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
627627
};
628628

629629
/* FIXME: is this correct order?
630630
* screamer (powerbook G3 pismo) seems to have different bits...
631631
*/
632-
static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = {
632+
static const struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = {
633633
AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0),
634634
AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0),
635635
};
636636

637-
static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = {
637+
static const struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = {
638638
AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
639639
AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0),
640640
};
641641

642-
static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = {
642+
static const struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = {
643643
AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
644644
};
645645

646-
static struct snd_kcontrol_new snd_pmac_awacs_master_sw =
646+
static const struct snd_kcontrol_new snd_pmac_awacs_master_sw =
647647
AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1);
648648

649-
static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac =
649+
static const struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac =
650650
AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1);
651651

652-
static struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 =
652+
static const struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 =
653653
AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1);
654654

655-
static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = {
655+
static const struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = {
656656
AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
657657
};
658658

659-
static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = {
659+
static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = {
660660
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
661661
.name = "Mic Boost Capture Volume",
662662
.info = snd_pmac_screamer_mic_boost_info,
@@ -665,42 +665,42 @@ static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = {
665665
},
666666
};
667667

668-
static struct snd_kcontrol_new snd_pmac_awacs_mic_boost_pmac7500[] =
668+
static const struct snd_kcontrol_new snd_pmac_awacs_mic_boost_pmac7500[] =
669669
{
670670
AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
671671
};
672672

673-
static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_beige[] =
673+
static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost_beige[] =
674674
{
675675
AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
676676
AWACS_SWITCH("CD Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0),
677677
};
678678

679-
static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] =
679+
static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] =
680680
{
681681
AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
682682
AWACS_SWITCH("Mic Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0),
683683
};
684684

685-
static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = {
685+
static const struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = {
686686
AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1),
687687
};
688688

689-
static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw =
689+
static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw =
690690
AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
691691

692-
static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 =
692+
static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 =
693693
AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
694694

695-
static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 =
695+
static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 =
696696
AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
697697

698698

699699
/*
700700
* add new mixer elements to the card
701701
*/
702702
static int build_mixers(struct snd_pmac *chip, int nums,
703-
struct snd_kcontrol_new *mixers)
703+
const struct snd_kcontrol_new *mixers)
704704
{
705705
int i, err;
706706

‎sound/ppc/burgundy.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int snd_pmac_burgundy_put_switch_b(struct snd_kcontrol *kcontrol,
454454
/*
455455
* Burgundy mixers
456456
*/
457-
static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] = {
457+
static const struct snd_kcontrol_new snd_pmac_burgundy_mixers[] = {
458458
BURGUNDY_VOLUME_W("Master Playback Volume", 0,
459459
MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8),
460460
BURGUNDY_VOLUME_W("CD Capture Volume", 0,
@@ -482,7 +482,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] = {
482482
*/ BURGUNDY_SWITCH_B("PCM Capture Switch", 0,
483483
MASK_ADDR_BURGUNDY_HOSTIFEH, 0x01, 0, 0)
484484
};
485-
static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] = {
485+
static const struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] = {
486486
BURGUNDY_VOLUME_W("Line in Capture Volume", 0,
487487
MASK_ADDR_BURGUNDY_VOLLINE, 16),
488488
BURGUNDY_VOLUME_W("Mic Capture Volume", 0,
@@ -508,7 +508,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] = {
508508
BURGUNDY_SWITCH_B("Mic Boost Capture Switch", 0,
509509
MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1)
510510
};
511-
static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] = {
511+
static const struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] = {
512512
BURGUNDY_VOLUME_W("Line in Capture Volume", 0,
513513
MASK_ADDR_BURGUNDY_VOLMIC, 16),
514514
BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0,
@@ -524,33 +524,33 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] = {
524524
/* BURGUNDY_SWITCH_B("Line in Boost Capture Switch", 0,
525525
* MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1) */
526526
};
527-
static struct snd_kcontrol_new snd_pmac_burgundy_master_sw_imac =
527+
static const struct snd_kcontrol_new snd_pmac_burgundy_master_sw_imac =
528528
BURGUNDY_SWITCH_B("Master Playback Switch", 0,
529529
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
530530
BURGUNDY_OUTPUT_LEFT | BURGUNDY_LINEOUT_LEFT | BURGUNDY_HP_LEFT,
531531
BURGUNDY_OUTPUT_RIGHT | BURGUNDY_LINEOUT_RIGHT | BURGUNDY_HP_RIGHT, 1);
532-
static struct snd_kcontrol_new snd_pmac_burgundy_master_sw_pmac =
532+
static const struct snd_kcontrol_new snd_pmac_burgundy_master_sw_pmac =
533533
BURGUNDY_SWITCH_B("Master Playback Switch", 0,
534534
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
535535
BURGUNDY_OUTPUT_INTERN
536536
| BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1);
537-
static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac =
537+
static const struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac =
538538
BURGUNDY_SWITCH_B("Speaker Playback Switch", 0,
539539
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
540540
BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1);
541-
static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac =
541+
static const struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac =
542542
BURGUNDY_SWITCH_B("Speaker Playback Switch", 0,
543543
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
544544
BURGUNDY_OUTPUT_INTERN, 0, 0);
545-
static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac =
545+
static const struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac =
546546
BURGUNDY_SWITCH_B("Line out Playback Switch", 0,
547547
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
548548
BURGUNDY_LINEOUT_LEFT, BURGUNDY_LINEOUT_RIGHT, 1);
549-
static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_pmac =
549+
static const struct snd_kcontrol_new snd_pmac_burgundy_line_sw_pmac =
550550
BURGUNDY_SWITCH_B("Line out Playback Switch", 0,
551551
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
552552
BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1);
553-
static struct snd_kcontrol_new snd_pmac_burgundy_hp_sw_imac =
553+
static const struct snd_kcontrol_new snd_pmac_burgundy_hp_sw_imac =
554554
BURGUNDY_SWITCH_B("Headphone Playback Switch", 0,
555555
MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
556556
BURGUNDY_HP_LEFT, BURGUNDY_HP_RIGHT, 1);

‎sound/ppc/daca.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static int daca_put_amp(struct snd_kcontrol *kcontrol,
186186
return change;
187187
}
188188

189-
static struct snd_kcontrol_new daca_mixers[] = {
189+
static const struct snd_kcontrol_new daca_mixers[] = {
190190
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
191191
.name = "Deemphasis Switch",
192192
.info = daca_info_deemphasis,

‎sound/ppc/pmac.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ static int pmac_hp_detect_get(struct snd_kcontrol *kcontrol,
11041104
return 0;
11051105
}
11061106

1107-
static struct snd_kcontrol_new auto_mute_controls[] = {
1107+
static const struct snd_kcontrol_new auto_mute_controls[] = {
11081108
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11091109
.name = "Auto Mute Switch",
11101110
.info = snd_pmac_boolean_mono_info,

‎sound/ppc/snd_ps3.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ static int snd_ps3_spdif_default_put(struct snd_kcontrol *kcontrol,
715715
return 0;
716716
}
717717

718-
static struct snd_kcontrol_new spdif_ctls[] = {
718+
static const struct snd_kcontrol_new spdif_ctls[] = {
719719
{
720720
.access = SNDRV_CTL_ELEM_ACCESS_READ,
721721
.iface = SNDRV_CTL_ELEM_IFACE_PCM,

‎sound/ppc/tumbler.c‎

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

827827
/*
828828
*/
829-
static struct snd_kcontrol_new tumbler_mixers[] = {
829+
static const struct snd_kcontrol_new tumbler_mixers[] = {
830830
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
831831
.name = "Master Playback Volume",
832832
.info = tumbler_info_master_volume,
@@ -850,7 +850,7 @@ static struct snd_kcontrol_new tumbler_mixers[] = {
850850
},
851851
};
852852

853-
static struct snd_kcontrol_new snapper_mixers[] = {
853+
static const struct snd_kcontrol_new snapper_mixers[] = {
854854
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
855855
.name = "Master Playback Volume",
856856
.info = tumbler_info_master_volume,

0 commit comments

Comments
 (0)