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

ALSA: ppc: More constifications

Apply const prefix to each possible place: the static tables for rate,
volume, etc.

Just for minor optimization and no functional changes.

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

+22 -22
+1 -1
sound/ppc/beep.c
··· 44 44 * so we can multiply by an amplitude in the range 0..100 to get a 45 45 * signed short value to put in the output buffer. 46 46 */ 47 - static short beep_wform[256] = { 47 + static const short beep_wform[256] = { 48 48 0, 40, 79, 117, 153, 187, 218, 245, 49 49 269, 288, 304, 316, 323, 327, 327, 324, 50 50 318, 310, 299, 288, 275, 262, 249, 236,
+4 -4
sound/ppc/pmac.c
··· 24 24 25 25 26 26 /* fixed frequency table for awacs, screamer, burgundy, DACA (44100 max) */ 27 - static int awacs_freqs[8] = { 27 + static const int awacs_freqs[8] = { 28 28 44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350 29 29 }; 30 30 /* fixed frequency table for tumbler */ 31 - static int tumbler_freqs[1] = { 31 + static const int tumbler_freqs[1] = { 32 32 44100 33 33 }; 34 34 ··· 1174 1174 np = chip->node; 1175 1175 chip->requested = 0; 1176 1176 if (chip->is_k2) { 1177 - static char *rnames[] = { 1177 + static const char * const rnames[] = { 1178 1178 "Sound Control", "Sound DMA" }; 1179 1179 for (i = 0; i < 2; i ++) { 1180 1180 if (of_address_to_resource(np->parent, i, ··· 1199 1199 txdma_addr = chip->rsrc[1].start; 1200 1200 rxdma_addr = txdma_addr + 0x100; 1201 1201 } else { 1202 - static char *rnames[] = { 1202 + static const char * const rnames[] = { 1203 1203 "Sound Control", "Sound Tx DMA", "Sound Rx DMA" }; 1204 1204 for (i = 0; i < 3; i ++) { 1205 1205 if (of_address_to_resource(np, i,
+1 -1
sound/ppc/pmac.h
··· 104 104 struct resource rsrc[3]; 105 105 106 106 int num_freqs; 107 - int *freq_table; 107 + const int *freq_table; 108 108 unsigned int freqs_ok; /* bit flags */ 109 109 unsigned int formats_ok; /* pcm hwinfo */ 110 110 int active;
+10 -10
sound/ppc/tumbler.c
··· 106 106 /* 107 107 */ 108 108 109 - static int send_init_client(struct pmac_keywest *i2c, unsigned int *regs) 109 + static int send_init_client(struct pmac_keywest *i2c, const unsigned int *regs) 110 110 { 111 111 while (*regs > 0) { 112 112 int err, count = 10; ··· 128 128 129 129 static int tumbler_init_client(struct pmac_keywest *i2c) 130 130 { 131 - static unsigned int regs[] = { 131 + static const unsigned int regs[] = { 132 132 /* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */ 133 133 TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0, 134 134 0, /* terminator */ ··· 139 139 140 140 static int snapper_init_client(struct pmac_keywest *i2c) 141 141 { 142 - static unsigned int regs[] = { 142 + static const unsigned int regs[] = { 143 143 /* normal operation, SCLK=64fps, i2s output, 16bit width */ 144 144 TAS_REG_MCS, (1<<6)|(2<<4)|0, 145 145 /* normal operation, all-pass mode */ ··· 478 478 int reg; 479 479 int bytes; 480 480 unsigned int max; 481 - unsigned int *table; 481 + const unsigned int *table; 482 482 }; 483 483 484 484 static int tumbler_set_mono_volume(struct pmac_tumbler *mix, 485 - struct tumbler_mono_vol *info) 485 + const struct tumbler_mono_vol *info) 486 486 { 487 487 unsigned char block[4]; 488 488 unsigned int vol; ··· 553 553 } 554 554 555 555 /* TAS3001c mono volumes */ 556 - static struct tumbler_mono_vol tumbler_pcm_vol_info = { 556 + static const struct tumbler_mono_vol tumbler_pcm_vol_info = { 557 557 .index = VOL_IDX_PCM_MONO, 558 558 .reg = TAS_REG_PCM, 559 559 .bytes = 3, ··· 561 561 .table = mixer_volume_table, 562 562 }; 563 563 564 - static struct tumbler_mono_vol tumbler_bass_vol_info = { 564 + static const struct tumbler_mono_vol tumbler_bass_vol_info = { 565 565 .index = VOL_IDX_BASS, 566 566 .reg = TAS_REG_BASS, 567 567 .bytes = 1, ··· 569 569 .table = bass_volume_table, 570 570 }; 571 571 572 - static struct tumbler_mono_vol tumbler_treble_vol_info = { 572 + static const struct tumbler_mono_vol tumbler_treble_vol_info = { 573 573 .index = VOL_IDX_TREBLE, 574 574 .reg = TAS_REG_TREBLE, 575 575 .bytes = 1, ··· 578 578 }; 579 579 580 580 /* TAS3004 mono volumes */ 581 - static struct tumbler_mono_vol snapper_bass_vol_info = { 581 + static const struct tumbler_mono_vol snapper_bass_vol_info = { 582 582 .index = VOL_IDX_BASS, 583 583 .reg = TAS_REG_BASS, 584 584 .bytes = 1, ··· 586 586 .table = snapper_bass_volume_table, 587 587 }; 588 588 589 - static struct tumbler_mono_vol snapper_treble_vol_info = { 589 + static const struct tumbler_mono_vol snapper_treble_vol_info = { 590 590 .index = VOL_IDX_TREBLE, 591 591 .reg = TAS_REG_TREBLE, 592 592 .bytes = 1,
+6 -6
sound/ppc/tumbler_volume.h
··· 2 2 /* volume tables, taken from TAS3001c data manual */ 3 3 /* volume gain values */ 4 4 /* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */ 5 - static unsigned int master_volume_table[] = { 5 + static const unsigned int master_volume_table[] = { 6 6 0x00000015, 0x00000016, 0x00000017, 7 7 0x00000019, 0x0000001a, 0x0000001c, 8 8 0x0000001d, 0x0000001f, 0x00000021, ··· 66 66 67 67 /* treble table for TAS3001c */ 68 68 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ 69 - static unsigned int treble_volume_table[] = { 69 + static const unsigned int treble_volume_table[] = { 70 70 0x96, 0x95, 0x94, 71 71 0x93, 0x92, 0x91, 72 72 0x90, 0x8f, 0x8e, ··· 96 96 97 97 /* bass table for TAS3001c */ 98 98 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ 99 - static unsigned int bass_volume_table[] = { 99 + static const unsigned int bass_volume_table[] = { 100 100 0x86, 0x82, 0x7f, 101 101 0x7d, 0x7a, 0x78, 102 102 0x76, 0x74, 0x72, ··· 126 126 127 127 /* mixer (pcm) volume table */ 128 128 /* 0 = -70 dB, 175 = 18.0 dB in 0.5 dB step */ 129 - static unsigned int mixer_volume_table[] = { 129 + static const unsigned int mixer_volume_table[] = { 130 130 0x00014b, 0x00015f, 0x000174, 131 131 0x00018a, 0x0001a1, 0x0001ba, 132 132 0x0001d4, 0x0001f0, 0x00020d, ··· 191 191 192 192 /* treble table for TAS3004 */ 193 193 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ 194 - static unsigned int snapper_treble_volume_table[] = { 194 + static const unsigned int snapper_treble_volume_table[] = { 195 195 0x96, 0x95, 0x94, 196 196 0x93, 0x92, 0x91, 197 197 0x90, 0x8f, 0x8e, ··· 221 221 222 222 /* bass table for TAS3004 */ 223 223 /* 0 = -18 dB, 72 = 18 dB in 0.5 dB step */ 224 - static unsigned int snapper_bass_volume_table[] = { 224 + static const unsigned int snapper_bass_volume_table[] = { 225 225 0x96, 0x95, 0x94, 226 226 0x93, 0x92, 0x91, 227 227 0x90, 0x8f, 0x8e,