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

ALSA: emu10k1: More constifications

Apply const prefix to the remaining possible places: the static tables
for init verbs and registers, the string arrays, the conversion
tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+37 -37
+6 -6
sound/pci/emu10k1/emu10k1_main.c
··· 100 100 } 101 101 } 102 102 103 - static unsigned int spi_dac_init[] = { 103 + static const unsigned int spi_dac_init[] = { 104 104 0x00ff, 105 105 0x02ff, 106 106 0x0400, ··· 124 124 0x1400, 125 125 }; 126 126 127 - static unsigned int i2c_adc_init[][2] = { 127 + static const unsigned int i2c_adc_init[][2] = { 128 128 { 0x17, 0x00 }, /* Reset */ 129 129 { 0x07, 0x00 }, /* Timeout */ 130 130 { 0x0b, 0x22 }, /* Interface control */ ··· 2050 2050 } 2051 2051 2052 2052 #ifdef CONFIG_PM_SLEEP 2053 - static unsigned char saved_regs[] = { 2053 + static const unsigned char saved_regs[] = { 2054 2054 CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP, 2055 2055 FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL, 2056 2056 ATKHLDM, DCYSUSM, LFOVAL2, IP, IFATN, PEFE, FMMOD, TREMFRQ, FM2FRQ2, ··· 2059 2059 SPBYPASS, AC97SLOT, CDSRCS, GPSRCS, ZVSRCS, MICIDX, ADCIDX, FXIDX, 2060 2060 0xff /* end */ 2061 2061 }; 2062 - static unsigned char saved_regs_audigy[] = { 2062 + static const unsigned char saved_regs_audigy[] = { 2063 2063 A_ADCIDX, A_MICIDX, A_FXWC1, A_FXWC2, A_SAMPLE_RATE, 2064 2064 A_FXRT2, A_SENDAMOUNTS, A_FXRT1, 2065 2065 0xff /* end */ ··· 2094 2094 void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu) 2095 2095 { 2096 2096 int i; 2097 - unsigned char *reg; 2097 + const unsigned char *reg; 2098 2098 unsigned int *val; 2099 2099 2100 2100 val = emu->saved_ptr; ··· 2127 2127 void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu) 2128 2128 { 2129 2129 int i; 2130 - unsigned char *reg; 2130 + const unsigned char *reg; 2131 2131 unsigned int *val; 2132 2132 2133 2133 snd_emu10k1_audio_enable(emu);
+7 -7
sound/pci/emu10k1/emufx.c
··· 46 46 * Tables 47 47 */ 48 48 49 - static char *fxbuses[16] = { 49 + static const char * const fxbuses[16] = { 50 50 /* 0x00 */ "PCM Left", 51 51 /* 0x01 */ "PCM Right", 52 52 /* 0x02 */ "PCM Surround Left", ··· 65 65 /* 0x0f */ NULL 66 66 }; 67 67 68 - static char *creative_ins[16] = { 68 + static const char * const creative_ins[16] = { 69 69 /* 0x00 */ "AC97 Left", 70 70 /* 0x01 */ "AC97 Right", 71 71 /* 0x02 */ "TTL IEC958 Left", ··· 84 84 /* 0x0f */ NULL 85 85 }; 86 86 87 - static char *audigy_ins[16] = { 87 + static const char * const audigy_ins[16] = { 88 88 /* 0x00 */ "AC97 Left", 89 89 /* 0x01 */ "AC97 Right", 90 90 /* 0x02 */ "Audigy CD Left", ··· 103 103 /* 0x0f */ NULL 104 104 }; 105 105 106 - static char *creative_outs[32] = { 106 + static const char * const creative_outs[32] = { 107 107 /* 0x00 */ "AC97 Left", 108 108 /* 0x01 */ "AC97 Right", 109 109 /* 0x02 */ "Optical IEC958 Left", ··· 138 138 /* 0x1f */ NULL, 139 139 }; 140 140 141 - static char *audigy_outs[32] = { 141 + static const char * const audigy_outs[32] = { 142 142 /* 0x00 */ "Digital Front Left", 143 143 /* 0x01 */ "Digital Front Right", 144 144 /* 0x02 */ "Digital Center", ··· 2485 2485 return 0; 2486 2486 } 2487 2487 2488 - static void copy_string(char *dst, char *src, char *null, int idx) 2488 + static void copy_string(char *dst, const char *src, const char *null, int idx) 2489 2489 { 2490 2490 if (src == NULL) 2491 2491 sprintf(dst, "%s %02X", null, idx); ··· 2496 2496 static void snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu, 2497 2497 struct snd_emu10k1_fx8010_info *info) 2498 2498 { 2499 - char **fxbus, **extin, **extout; 2499 + const char * const *fxbus, * const *extin, * const *extout; 2500 2500 unsigned short fxbus_mask, extin_mask, extout_mask; 2501 2501 int res; 2502 2502
+14 -14
sound/pci/emu10k1/emumixer.c
··· 183 183 /* 184 184 * List of data sources available for each destination 185 185 */ 186 - static unsigned int emu1010_src_regs[] = { 186 + static const unsigned int emu1010_src_regs[] = { 187 187 EMU_SRC_SILENCE,/* 0 */ 188 188 EMU_SRC_DOCK_MIC_A1, /* 1 */ 189 189 EMU_SRC_DOCK_MIC_B1, /* 2 */ ··· 240 240 }; 241 241 242 242 /* 1616(m) cardbus */ 243 - static unsigned int emu1616_src_regs[] = { 243 + static const unsigned int emu1616_src_regs[] = { 244 244 EMU_SRC_SILENCE, 245 245 EMU_SRC_DOCK_MIC_A1, 246 246 EMU_SRC_DOCK_MIC_B1, ··· 296 296 * Data destinations - physical EMU outputs. 297 297 * Each destination has an enum mixer control to choose a data source 298 298 */ 299 - static unsigned int emu1010_output_dst[] = { 299 + static const unsigned int emu1010_output_dst[] = { 300 300 EMU_DST_DOCK_DAC1_LEFT1, /* 0 */ 301 301 EMU_DST_DOCK_DAC1_RIGHT1, /* 1 */ 302 302 EMU_DST_DOCK_DAC2_LEFT1, /* 2 */ ··· 324 324 }; 325 325 326 326 /* 1616(m) cardbus */ 327 - static unsigned int emu1616_output_dst[] = { 327 + static const unsigned int emu1616_output_dst[] = { 328 328 EMU_DST_DOCK_DAC1_LEFT1, 329 329 EMU_DST_DOCK_DAC1_RIGHT1, 330 330 EMU_DST_DOCK_DAC2_LEFT1, ··· 350 350 * capture (EMU32 + I2S links) 351 351 * Each destination has an enum mixer control to choose a data source 352 352 */ 353 - static unsigned int emu1010_input_dst[] = { 353 + static const unsigned int emu1010_input_dst[] = { 354 354 EMU_DST_ALICE2_EMU32_0, 355 355 EMU_DST_ALICE2_EMU32_1, 356 356 EMU_DST_ALICE2_EMU32_2, ··· 1778 1778 int err, pcm; 1779 1779 struct snd_kcontrol *kctl; 1780 1780 struct snd_card *card = emu->card; 1781 - char **c; 1782 - static char *emu10k1_remove_ctls[] = { 1781 + const char * const *c; 1782 + static const char * const emu10k1_remove_ctls[] = { 1783 1783 /* no AC97 mono, surround, center/lfe */ 1784 1784 "Master Mono Playback Switch", 1785 1785 "Master Mono Playback Volume", ··· 1793 1793 "LFE Playback Volume", 1794 1794 NULL 1795 1795 }; 1796 - static char *emu10k1_rename_ctls[] = { 1796 + static const char * const emu10k1_rename_ctls[] = { 1797 1797 "Surround Digital Playback Volume", "Surround Playback Volume", 1798 1798 "Center Digital Playback Volume", "Center Playback Volume", 1799 1799 "LFE Digital Playback Volume", "LFE Playback Volume", 1800 1800 NULL 1801 1801 }; 1802 - static char *audigy_remove_ctls[] = { 1802 + static const char * const audigy_remove_ctls[] = { 1803 1803 /* Master/PCM controls on ac97 of Audigy has no effect */ 1804 1804 /* On the Audigy2 the AC97 playback is piped into 1805 1805 * the Philips ADC for 24bit capture */ ··· 1826 1826 "External Amplifier", 1827 1827 NULL 1828 1828 }; 1829 - static char *audigy_rename_ctls[] = { 1829 + static const char * const audigy_rename_ctls[] = { 1830 1830 /* use conventional names */ 1831 1831 "Wave Playback Volume", "PCM Playback Volume", 1832 1832 /* "Wave Capture Volume", "PCM Capture Volume", */ ··· 1836 1836 "Master Mono Playback Volume", "Phone Output Playback Volume", 1837 1837 NULL 1838 1838 }; 1839 - static char *audigy_rename_ctls_i2c_adc[] = { 1839 + static const char * const audigy_rename_ctls_i2c_adc[] = { 1840 1840 //"Analog Mix Capture Volume","OLD Analog Mix Capture Volume", 1841 1841 "Line Capture Volume", "Analog Mix Capture Volume", 1842 1842 "Wave Playback Volume", "OLD PCM Playback Volume", ··· 1845 1845 "CD Capture Volume", "IEC958 Optical Capture Volume", 1846 1846 NULL 1847 1847 }; 1848 - static char *audigy_remove_ctls_i2c_adc[] = { 1848 + static const char * const audigy_remove_ctls_i2c_adc[] = { 1849 1849 /* On the Audigy2 ZS Notebook 1850 1850 * Capture via WM8775 */ 1851 1851 "Mic Capture Volume", ··· 1854 1854 "IEC958 Optical Capture Volume", 1855 1855 NULL 1856 1856 }; 1857 - static char *audigy_remove_ctls_1361t_adc[] = { 1857 + static const char * const audigy_remove_ctls_1361t_adc[] = { 1858 1858 /* On the Audigy2 the AC97 playback is piped into 1859 1859 * the Philips ADC for 24bit capture */ 1860 1860 "PCM Playback Switch", ··· 1872 1872 "Line2 Capture Volume", 1873 1873 NULL 1874 1874 }; 1875 - static char *audigy_rename_ctls_1361t_adc[] = { 1875 + static const char * const audigy_rename_ctls_1361t_adc[] = { 1876 1876 "Master Playback Switch", "Master Capture Switch", 1877 1877 "Master Playback Volume", "Master Capture Volume", 1878 1878 "Wave Master Playback Volume", "Master Playback Volume",
+8 -8
sound/pci/emu10k1/emuproc.c
··· 26 26 int status_reg, 27 27 int rate_reg) 28 28 { 29 - static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" }; 30 - static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; 31 - static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; 32 - static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" }; 29 + static const char * const clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" }; 30 + static const int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; 31 + static const char * const channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; 32 + static const char * const emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" }; 33 33 unsigned int status, rate = 0; 34 34 35 35 status = snd_emu10k1_ptr_read(emu, status_reg, 0); ··· 67 67 struct snd_info_buffer *buffer) 68 68 { 69 69 /* FIXME - output names are in emufx.c too */ 70 - static char *creative_outs[32] = { 70 + static const char * const creative_outs[32] = { 71 71 /* 00 */ "AC97 Left", 72 72 /* 01 */ "AC97 Right", 73 73 /* 02 */ "Optical IEC958 Left", ··· 102 102 /* 31 */ "???" 103 103 }; 104 104 105 - static char *audigy_outs[64] = { 105 + static const char * const audigy_outs[64] = { 106 106 /* 00 */ "Digital Front Left", 107 107 /* 01 */ "Digital Front Right", 108 108 /* 02 */ "Digital Center", ··· 172 172 struct snd_emu10k1 *emu = entry->private_data; 173 173 unsigned int val, val1; 174 174 int nefx = emu->audigy ? 64 : 32; 175 - char **outputs = emu->audigy ? audigy_outs : creative_outs; 175 + const char * const *outputs = emu->audigy ? audigy_outs : creative_outs; 176 176 int idx; 177 177 178 178 snd_iprintf(buffer, "EMU10K1\n\n"); ··· 262 262 static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, 263 263 struct snd_info_buffer *buffer) 264 264 { 265 - static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; 265 + static const int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; 266 266 struct snd_emu10k1 *emu = entry->private_data; 267 267 unsigned int val, tmp, n; 268 268 val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0);
+2 -2
sound/pci/emu10k1/io.c
··· 510 510 511 511 unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate) 512 512 { 513 - static u32 logMagTable[128] = { 513 + static const u32 logMagTable[128] = { 514 514 0x00000, 0x02dfc, 0x05b9e, 0x088e6, 0x0b5d6, 0x0e26f, 0x10eb3, 0x13aa2, 515 515 0x1663f, 0x1918a, 0x1bc84, 0x1e72e, 0x2118b, 0x23b9a, 0x2655d, 0x28ed5, 516 516 0x2b803, 0x2e0e8, 0x30985, 0x331db, 0x359eb, 0x381b6, 0x3a93d, 0x3d081, ··· 528 528 0xe829f, 0xe9b31, 0xeb3a9, 0xecc08, 0xee44c, 0xefc78, 0xf148a, 0xf2c83, 529 529 0xf4463, 0xf5c2a, 0xf73da, 0xf8b71, 0xfa2f0, 0xfba57, 0xfd1a7, 0xfe8df 530 530 }; 531 - static char logSlopeTable[128] = { 531 + static const char logSlopeTable[128] = { 532 532 0x5c, 0x5c, 0x5b, 0x5a, 0x5a, 0x59, 0x58, 0x58, 533 533 0x57, 0x56, 0x56, 0x55, 0x55, 0x54, 0x53, 0x53, 534 534 0x52, 0x52, 0x51, 0x51, 0x50, 0x50, 0x4f, 0x4f,