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

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>

+40 -40
+25 -25
sound/ppc/awacs.c
··· 464 464 #define AMP_CH_SPK 0 465 465 #define AMP_CH_HD 1 466 466 467 - static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = { 467 + static const struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = { 468 468 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 469 469 .name = "Speaker Playback Volume", 470 470 .info = snd_pmac_awacs_info_volume_amp, ··· 582 582 /* 583 583 * lists of mixer elements 584 584 */ 585 - static struct snd_kcontrol_new snd_pmac_awacs_mixers[] = { 585 + static const struct snd_kcontrol_new snd_pmac_awacs_mixers[] = { 586 586 AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), 587 587 AWACS_VOLUME("Master Capture Volume", 0, 4, 0), 588 588 /* AWACS_SWITCH("Unknown Playback Switch", 6, SHIFT_PAROUT0, 0), */ 589 589 }; 590 590 591 - static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = { 591 + static const struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = { 592 592 AWACS_VOLUME("Master Playback Volume", 2, 6, 1), 593 593 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), 594 594 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 595 595 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0), 596 596 }; 597 597 598 - static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = { 598 + static const struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = { 599 599 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 600 600 }; 601 601 602 - static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = { 602 + static const struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = { 603 603 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), 604 604 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 605 605 }; 606 606 607 - static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = { 607 + static const struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = { 608 608 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 609 609 AWACS_VOLUME("Master Playback Volume", 5, 6, 1), 610 610 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 611 611 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 612 612 }; 613 613 614 - static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = { 614 + static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = { 615 615 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 616 616 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 617 617 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 618 618 }; 619 619 620 - static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = { 620 + static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = { 621 621 AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1), 622 622 }; 623 623 624 - static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = { 624 + static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = { 625 625 AWACS_VOLUME("Master Playback Volume", 2, 6, 1), 626 626 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 627 627 }; ··· 629 629 /* FIXME: is this correct order? 630 630 * screamer (powerbook G3 pismo) seems to have different bits... 631 631 */ 632 - static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = { 632 + static const struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = { 633 633 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0), 634 634 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0), 635 635 }; 636 636 637 - static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = { 637 + static const struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = { 638 638 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 639 639 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), 640 640 }; 641 641 642 - static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = { 642 + static const struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = { 643 643 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 644 644 }; 645 645 646 - static struct snd_kcontrol_new snd_pmac_awacs_master_sw = 646 + static const struct snd_kcontrol_new snd_pmac_awacs_master_sw = 647 647 AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); 648 648 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 = 650 650 AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1); 651 651 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 = 653 653 AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1); 654 654 655 - static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = { 655 + static const struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = { 656 656 AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 657 657 }; 658 658 659 - static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = { 659 + static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = { 660 660 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 661 661 .name = "Mic Boost Capture Volume", 662 662 .info = snd_pmac_screamer_mic_boost_info, ··· 665 665 }, 666 666 }; 667 667 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[] = 669 669 { 670 670 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 671 671 }; 672 672 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[] = 674 674 { 675 675 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 676 676 AWACS_SWITCH("CD Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0), 677 677 }; 678 678 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[] = 680 680 { 681 681 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 682 682 AWACS_SWITCH("Mic Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0), 683 683 }; 684 684 685 - static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = { 685 + static const struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = { 686 686 AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1), 687 687 }; 688 688 689 - static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw = 689 + static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw = 690 690 AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); 691 691 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 = 693 693 AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); 694 694 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 = 696 696 AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); 697 697 698 698 ··· 700 700 * add new mixer elements to the card 701 701 */ 702 702 static int build_mixers(struct snd_pmac *chip, int nums, 703 - struct snd_kcontrol_new *mixers) 703 + const struct snd_kcontrol_new *mixers) 704 704 { 705 705 int i, err; 706 706
+10 -10
sound/ppc/burgundy.c
··· 454 454 /* 455 455 * Burgundy mixers 456 456 */ 457 - static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] = { 457 + static const struct snd_kcontrol_new snd_pmac_burgundy_mixers[] = { 458 458 BURGUNDY_VOLUME_W("Master Playback Volume", 0, 459 459 MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8), 460 460 BURGUNDY_VOLUME_W("CD Capture Volume", 0, ··· 482 482 */ BURGUNDY_SWITCH_B("PCM Capture Switch", 0, 483 483 MASK_ADDR_BURGUNDY_HOSTIFEH, 0x01, 0, 0) 484 484 }; 485 - static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] = { 485 + static const struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] = { 486 486 BURGUNDY_VOLUME_W("Line in Capture Volume", 0, 487 487 MASK_ADDR_BURGUNDY_VOLLINE, 16), 488 488 BURGUNDY_VOLUME_W("Mic Capture Volume", 0, ··· 508 508 BURGUNDY_SWITCH_B("Mic Boost Capture Switch", 0, 509 509 MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1) 510 510 }; 511 - static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] = { 511 + static const struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] = { 512 512 BURGUNDY_VOLUME_W("Line in Capture Volume", 0, 513 513 MASK_ADDR_BURGUNDY_VOLMIC, 16), 514 514 BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0, ··· 524 524 /* BURGUNDY_SWITCH_B("Line in Boost Capture Switch", 0, 525 525 * MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1) */ 526 526 }; 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 = 528 528 BURGUNDY_SWITCH_B("Master Playback Switch", 0, 529 529 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 530 530 BURGUNDY_OUTPUT_LEFT | BURGUNDY_LINEOUT_LEFT | BURGUNDY_HP_LEFT, 531 531 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 = 533 533 BURGUNDY_SWITCH_B("Master Playback Switch", 0, 534 534 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 535 535 BURGUNDY_OUTPUT_INTERN 536 536 | 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 = 538 538 BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, 539 539 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 540 540 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 = 542 542 BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, 543 543 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 544 544 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 = 546 546 BURGUNDY_SWITCH_B("Line out Playback Switch", 0, 547 547 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 548 548 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 = 550 550 BURGUNDY_SWITCH_B("Line out Playback Switch", 0, 551 551 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 552 552 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 = 554 554 BURGUNDY_SWITCH_B("Headphone Playback Switch", 0, 555 555 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 556 556 BURGUNDY_HP_LEFT, BURGUNDY_HP_RIGHT, 1);
+1 -1
sound/ppc/daca.c
··· 186 186 return change; 187 187 } 188 188 189 - static struct snd_kcontrol_new daca_mixers[] = { 189 + static const struct snd_kcontrol_new daca_mixers[] = { 190 190 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 191 191 .name = "Deemphasis Switch", 192 192 .info = daca_info_deemphasis,
+1 -1
sound/ppc/pmac.c
··· 1104 1104 return 0; 1105 1105 } 1106 1106 1107 - static struct snd_kcontrol_new auto_mute_controls[] = { 1107 + static const struct snd_kcontrol_new auto_mute_controls[] = { 1108 1108 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1109 1109 .name = "Auto Mute Switch", 1110 1110 .info = snd_pmac_boolean_mono_info,
+1 -1
sound/ppc/snd_ps3.c
··· 715 715 return 0; 716 716 } 717 717 718 - static struct snd_kcontrol_new spdif_ctls[] = { 718 + static const struct snd_kcontrol_new spdif_ctls[] = { 719 719 { 720 720 .access = SNDRV_CTL_ELEM_ACCESS_READ, 721 721 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
+2 -2
sound/ppc/tumbler.c
··· 826 826 827 827 /* 828 828 */ 829 - static struct snd_kcontrol_new tumbler_mixers[] = { 829 + static const struct snd_kcontrol_new tumbler_mixers[] = { 830 830 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 831 831 .name = "Master Playback Volume", 832 832 .info = tumbler_info_master_volume, ··· 850 850 }, 851 851 }; 852 852 853 - static struct snd_kcontrol_new snapper_mixers[] = { 853 + static const struct snd_kcontrol_new snapper_mixers[] = { 854 854 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 855 855 .name = "Master Playback Volume", 856 856 .info = tumbler_info_master_volume,