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

ALSA: usb: 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-42-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+36 -36
+4 -4
sound/usb/6fire/control.c
··· 397 397 return 0; 398 398 } 399 399 400 - static struct snd_kcontrol_new vol_elements[] = { 400 + static const struct snd_kcontrol_new vol_elements[] = { 401 401 { 402 402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 403 403 .name = "Analog Playback Volume", ··· 437 437 {} 438 438 }; 439 439 440 - static struct snd_kcontrol_new mute_elements[] = { 440 + static const struct snd_kcontrol_new mute_elements[] = { 441 441 { 442 442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 443 443 .name = "Analog Playback Switch", ··· 471 471 {} 472 472 }; 473 473 474 - static struct snd_kcontrol_new elements[] = { 474 + static const struct snd_kcontrol_new elements[] = { 475 475 { 476 476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 477 477 .name = "Line/Phono Capture Route", ··· 517 517 struct control_runtime *rt, 518 518 struct snd_card *card, 519 519 char *name, 520 - struct snd_kcontrol_new *elems) 520 + const struct snd_kcontrol_new *elems) 521 521 { 522 522 int ret; 523 523 int i;
+3 -3
sound/usb/mixer.c
··· 1445 1445 return 0; 1446 1446 } 1447 1447 1448 - static struct snd_kcontrol_new usb_feature_unit_ctl = { 1448 + static const struct snd_kcontrol_new usb_feature_unit_ctl = { 1449 1449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1450 1450 .name = "", /* will be filled later manually */ 1451 1451 .info = mixer_ctl_feature_info, ··· 1466 1466 * A control which shows the boolean value from reading a UAC control on 1467 1467 * the master channel. 1468 1468 */ 1469 - static struct snd_kcontrol_new usb_bool_master_control_ctl_ro = { 1469 + static const struct snd_kcontrol_new usb_bool_master_control_ctl_ro = { 1470 1470 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1471 1471 .name = "", /* will be filled later manually */ 1472 1472 .access = SNDRV_CTL_ELEM_ACCESS_READ, ··· 1488 1488 * This symbol is exported in order to allow the mixer quirks to 1489 1489 * hook up to the standard feature unit control mechanism 1490 1490 */ 1491 - struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl; 1491 + const struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl; 1492 1492 1493 1493 /* 1494 1494 * build a feature control
+1 -1
sound/usb/mixer.h
··· 116 116 117 117 extern void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl); 118 118 119 - extern struct snd_kcontrol_new *snd_usb_feature_unit_ctl; 119 + extern const struct snd_kcontrol_new *snd_usb_feature_unit_ctl; 120 120 121 121 #endif /* __USBMIXER_H */
+8 -8
sound/usb/mixer_quirks.c
··· 507 507 list->kctl->private_value); 508 508 } 509 509 510 - static struct snd_kcontrol_new snd_emu0204_control = { 510 + static const struct snd_kcontrol_new snd_emu0204_control = { 511 511 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 512 512 .name = "Front Jack Channels", 513 513 .info = snd_emu0204_ch_switch_info, ··· 575 575 list->kctl->private_value); 576 576 } 577 577 578 - static struct snd_kcontrol_new snd_xonar_u1_output_switch = { 578 + static const struct snd_kcontrol_new snd_xonar_u1_output_switch = { 579 579 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 580 580 .name = "Digital Playback Switch", 581 581 .info = snd_ctl_boolean_mono_info, ··· 702 702 return snd_mbox1_switch_update(list->mixer, list->kctl->private_value); 703 703 } 704 704 705 - static struct snd_kcontrol_new snd_mbox1_switch = { 705 + static const struct snd_kcontrol_new snd_mbox1_switch = { 706 706 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 707 707 .name = "Clock Source", 708 708 .index = 0, ··· 787 787 return err < 0 ? err : 1; 788 788 } 789 789 790 - static struct snd_kcontrol_new snd_nativeinstruments_ta6_mixers[] = { 790 + static const struct snd_kcontrol_new snd_nativeinstruments_ta6_mixers[] = { 791 791 { 792 792 .name = "Direct Thru Channel A", 793 793 .private_value = _MAKE_NI_CONTROL(0x01, 0x03), ··· 806 806 }, 807 807 }; 808 808 809 - static struct snd_kcontrol_new snd_nativeinstruments_ta10_mixers[] = { 809 + static const struct snd_kcontrol_new snd_nativeinstruments_ta10_mixers[] = { 810 810 { 811 811 .name = "Direct Thru Channel A", 812 812 .private_value = _MAKE_NI_CONTROL(0x01, 0x03), ··· 1662 1662 return err < 0 ? err : 1; 1663 1663 } 1664 1664 1665 - static struct snd_kcontrol_new snd_microii_mixer_spdif[] = { 1665 + static const struct snd_kcontrol_new snd_microii_mixer_spdif[] = { 1666 1666 { 1667 1667 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1668 1668 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), ··· 1769 1769 return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); 1770 1770 } 1771 1771 1772 - static struct snd_kcontrol_new snd_soundblaster_e1_input_switch = { 1772 + static const struct snd_kcontrol_new snd_soundblaster_e1_input_switch = { 1773 1773 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1774 1774 .name = "Input Source", 1775 1775 .info = snd_soundblaster_e1_switch_info, ··· 2093 2093 ARRAY_SIZE(sync_sources), sync_sources); 2094 2094 } 2095 2095 2096 - static struct snd_kcontrol_new snd_rme_controls[] = { 2096 + static const struct snd_kcontrol_new snd_rme_controls[] = { 2097 2097 { 2098 2098 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2099 2099 .name = "AES Rate",
+19 -19
sound/usb/mixer_us16x08.c
··· 760 760 return 1; 761 761 } 762 762 763 - static struct snd_kcontrol_new snd_us16x08_ch_boolean_ctl = { 763 + static const struct snd_kcontrol_new snd_us16x08_ch_boolean_ctl = { 764 764 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 765 765 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 766 766 .count = 16, ··· 770 770 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 1) 771 771 }; 772 772 773 - static struct snd_kcontrol_new snd_us16x08_ch_int_ctl = { 773 + static const struct snd_kcontrol_new snd_us16x08_ch_int_ctl = { 774 774 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 775 775 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 776 776 .count = 16, ··· 780 780 .private_value = SND_US16X08_KCSET(SND_US16X08_FADER_BIAS, 1, 0, 133) 781 781 }; 782 782 783 - static struct snd_kcontrol_new snd_us16x08_pan_int_ctl = { 783 + static const struct snd_kcontrol_new snd_us16x08_pan_int_ctl = { 784 784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 785 785 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 786 786 .count = 16, ··· 790 790 .private_value = SND_US16X08_KCSET(SND_US16X08_FADER_BIAS, 1, 0, 255) 791 791 }; 792 792 793 - static struct snd_kcontrol_new snd_us16x08_master_ctl = { 793 + static const struct snd_kcontrol_new snd_us16x08_master_ctl = { 794 794 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 795 795 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 796 796 .count = 1, ··· 800 800 .private_value = SND_US16X08_KCSET(SND_US16X08_FADER_BIAS, 1, 0, 133) 801 801 }; 802 802 803 - static struct snd_kcontrol_new snd_us16x08_route_ctl = { 803 + static const struct snd_kcontrol_new snd_us16x08_route_ctl = { 804 804 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 805 805 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 806 806 .count = 8, ··· 810 810 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 9) 811 811 }; 812 812 813 - static struct snd_kcontrol_new snd_us16x08_bus_ctl = { 813 + static const struct snd_kcontrol_new snd_us16x08_bus_ctl = { 814 814 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 815 815 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 816 816 .count = 1, ··· 820 820 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 1) 821 821 }; 822 822 823 - static struct snd_kcontrol_new snd_us16x08_compswitch_ctl = { 823 + static const struct snd_kcontrol_new snd_us16x08_compswitch_ctl = { 824 824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 825 825 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 826 826 .count = 16, ··· 830 830 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 1) 831 831 }; 832 832 833 - static struct snd_kcontrol_new snd_us16x08_comp_threshold_ctl = { 833 + static const struct snd_kcontrol_new snd_us16x08_comp_threshold_ctl = { 834 834 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 835 835 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 836 836 .count = 16, ··· 841 841 0, 0x20) 842 842 }; 843 843 844 - static struct snd_kcontrol_new snd_us16x08_comp_ratio_ctl = { 844 + static const struct snd_kcontrol_new snd_us16x08_comp_ratio_ctl = { 845 845 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 846 846 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 847 847 .count = 16, ··· 852 852 sizeof(ratio_map) - 1), /*max*/ 853 853 }; 854 854 855 - static struct snd_kcontrol_new snd_us16x08_comp_gain_ctl = { 855 + static const struct snd_kcontrol_new snd_us16x08_comp_gain_ctl = { 856 856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 857 857 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 858 858 .count = 16, ··· 862 862 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 0x14) 863 863 }; 864 864 865 - static struct snd_kcontrol_new snd_us16x08_comp_attack_ctl = { 865 + static const struct snd_kcontrol_new snd_us16x08_comp_attack_ctl = { 866 866 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 867 867 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 868 868 .count = 16, ··· 873 873 SND_US16X08_KCSET(SND_US16X08_COMP_ATTACK_BIAS, 1, 0, 0xc6), 874 874 }; 875 875 876 - static struct snd_kcontrol_new snd_us16x08_comp_release_ctl = { 876 + static const struct snd_kcontrol_new snd_us16x08_comp_release_ctl = { 877 877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 878 878 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 879 879 .count = 16, ··· 884 884 SND_US16X08_KCSET(SND_US16X08_COMP_RELEASE_BIAS, 1, 0, 0x63), 885 885 }; 886 886 887 - static struct snd_kcontrol_new snd_us16x08_eq_gain_ctl = { 887 + static const struct snd_kcontrol_new snd_us16x08_eq_gain_ctl = { 888 888 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 889 889 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 890 890 .count = 16, ··· 894 894 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 24), 895 895 }; 896 896 897 - static struct snd_kcontrol_new snd_us16x08_eq_low_freq_ctl = { 897 + static const struct snd_kcontrol_new snd_us16x08_eq_low_freq_ctl = { 898 898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 899 899 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 900 900 .count = 16, ··· 904 904 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 0x1F), 905 905 }; 906 906 907 - static struct snd_kcontrol_new snd_us16x08_eq_mid_freq_ctl = { 907 + static const struct snd_kcontrol_new snd_us16x08_eq_mid_freq_ctl = { 908 908 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 909 909 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 910 910 .count = 16, ··· 914 914 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 0x3F) 915 915 }; 916 916 917 - static struct snd_kcontrol_new snd_us16x08_eq_mid_width_ctl = { 917 + static const struct snd_kcontrol_new snd_us16x08_eq_mid_width_ctl = { 918 918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 919 919 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 920 920 .count = 16, ··· 924 924 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 0x06) 925 925 }; 926 926 927 - static struct snd_kcontrol_new snd_us16x08_eq_high_freq_ctl = { 927 + static const struct snd_kcontrol_new snd_us16x08_eq_high_freq_ctl = { 928 928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 929 929 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 930 930 .count = 16, ··· 935 935 SND_US16X08_KCSET(SND_US16X08_EQ_HIGHFREQ_BIAS, 1, 0, 0x1F) 936 936 }; 937 937 938 - static struct snd_kcontrol_new snd_us16x08_eq_switch_ctl = { 938 + static const struct snd_kcontrol_new snd_us16x08_eq_switch_ctl = { 939 939 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 940 940 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 941 941 .count = 16, ··· 945 945 .private_value = SND_US16X08_KCSET(SND_US16X08_NO_BIAS, 1, 0, 1) 946 946 }; 947 947 948 - static struct snd_kcontrol_new snd_us16x08_meter_ctl = { 948 + static const struct snd_kcontrol_new snd_us16x08_meter_ctl = { 949 949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 950 950 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 951 951 .count = 1,
+1 -1
sound/usb/mixer_us16x08.h
··· 108 108 }; 109 109 110 110 struct snd_us16x08_control_params { 111 - struct snd_kcontrol_new *kcontrol_new; 111 + const struct snd_kcontrol_new *kcontrol_new; 112 112 int control_id; 113 113 int type; 114 114 int num_channels;