Commit 15a1af95 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: gus: More constifications

Apply const prefix to each possible place: the static resource tables,
the volume table, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-50-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fce67097
...@@ -403,7 +403,7 @@ void snd_gf1_select_active_voices(struct snd_gus_card * gus) ...@@ -403,7 +403,7 @@ void snd_gf1_select_active_voices(struct snd_gus_card * gus)
{ {
unsigned short voices; unsigned short voices;
static unsigned short voices_tbl[32 - 14 + 1] = static const unsigned short voices_tbl[32 - 14 + 1] =
{ {
44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400, 28063, 26843, 44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400, 28063, 26843,
25725, 24696, 23746, 22866, 22050, 21289, 20580, 19916, 19293 25725, 24696, 23746, 22866, 22050, 21289, 20580, 19916, 19293
......
...@@ -267,9 +267,9 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches) ...@@ -267,9 +267,9 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches)
struct snd_card *card; struct snd_card *card;
unsigned long flags; unsigned long flags;
int irq, dma1, dma2; int irq, dma1, dma2;
static unsigned char irqs[16] = static const unsigned char irqs[16] =
{0, 0, 1, 3, 0, 2, 0, 4, 0, 1, 0, 5, 6, 0, 0, 7}; {0, 0, 1, 3, 0, 2, 0, 4, 0, 1, 0, 5, 6, 0, 0, 7};
static unsigned char dmas[8] = static const unsigned char dmas[8] =
{6, 1, 0, 2, 0, 3, 4, 5}; {6, 1, 0, 2, 0, 3, 4, 5};
if (snd_BUG_ON(!gus)) if (snd_BUG_ON(!gus))
......
...@@ -62,7 +62,7 @@ unsigned int snd_gf1_calc_ramp_rate(struct snd_gus_card * gus, ...@@ -62,7 +62,7 @@ unsigned int snd_gf1_calc_ramp_rate(struct snd_gus_card * gus,
unsigned short end, unsigned short end,
unsigned int us) unsigned int us)
{ {
static unsigned char vol_rates[19] = static const unsigned char vol_rates[19] =
{ {
23, 24, 26, 28, 29, 31, 32, 34, 23, 24, 26, 28, 29, 31, 32, 34,
36, 37, 39, 40, 42, 44, 45, 47, 36, 37, 39, 40, 42, 44, 45, 47,
...@@ -113,7 +113,7 @@ unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int fr ...@@ -113,7 +113,7 @@ unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int fr
short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) short snd_gf1_compute_vibrato(short cents, unsigned short fc_register)
{ {
static short vibrato_table[] = static const short vibrato_table[] =
{ {
0, 0, 32, 592, 61, 1175, 93, 1808, 0, 0, 32, 592, 61, 1175, 93, 1808,
124, 2433, 152, 3007, 182, 3632, 213, 4290, 124, 2433, 152, 3007, 182, 3632, 213, 4290,
...@@ -121,7 +121,8 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) ...@@ -121,7 +121,8 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register)
}; };
long depth; long depth;
short *vi1, *vi2, pcents, v1; const short *vi1, *vi2;
short pcents, v1;
pcents = cents < 0 ? -cents : cents; pcents = cents < 0 ? -cents : cents;
for (vi1 = vibrato_table, vi2 = vi1 + 2; pcents > *vi2; vi1 = vi2, vi2 += 2); for (vi1 = vibrato_table, vi2 = vi1 + 2; pcents > *vi2; vi1 = vi2, vi2 += 2);
...@@ -145,7 +146,7 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) ...@@ -145,7 +146,7 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register)
unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens) unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens)
{ {
static long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933}; static const long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933};
int wheel, sensitivity; int wheel, sensitivity;
unsigned int mantissa, f1, f2; unsigned int mantissa, f1, f2;
unsigned short semitones, f1_index, f2_index, f1_power, f2_power; unsigned short semitones, f1_index, f2_index, f1_power, f2_power;
......
...@@ -67,9 +67,9 @@ static int snd_gusclassic_create(struct snd_card *card, ...@@ -67,9 +67,9 @@ static int snd_gusclassic_create(struct snd_card *card,
struct device *dev, unsigned int n, struct device *dev, unsigned int n,
struct snd_gus_card **rgus) struct snd_gus_card **rgus)
{ {
static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; static const long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260};
static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1};
static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; static const int possible_dmas[] = {5, 6, 7, 1, 3, -1};
int i, error; int i, error;
......
...@@ -83,9 +83,9 @@ static int snd_gusextreme_es1688_create(struct snd_card *card, ...@@ -83,9 +83,9 @@ static int snd_gusextreme_es1688_create(struct snd_card *card,
struct snd_es1688 *chip, struct snd_es1688 *chip,
struct device *dev, unsigned int n) struct device *dev, unsigned int n)
{ {
static long possible_ports[] = {0x220, 0x240, 0x260}; static const long possible_ports[] = {0x220, 0x240, 0x260};
static int possible_irqs[] = {5, 9, 10, 7, -1}; static const int possible_irqs[] = {5, 9, 10, 7, -1};
static int possible_dmas[] = {1, 3, 0, -1}; static const int possible_dmas[] = {1, 3, 0, -1};
int i, error; int i, error;
...@@ -122,8 +122,8 @@ static int snd_gusextreme_gus_card_create(struct snd_card *card, ...@@ -122,8 +122,8 @@ static int snd_gusextreme_gus_card_create(struct snd_card *card,
struct device *dev, unsigned int n, struct device *dev, unsigned int n,
struct snd_gus_card **rgus) struct snd_gus_card **rgus)
{ {
static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; static const int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1};
static int possible_dmas[] = {5, 6, 7, 3, 1, -1}; static const int possible_dmas[] = {5, 6, 7, 3, 1, -1};
if (gf1_irq[n] == SNDRV_AUTO_IRQ) { if (gf1_irq[n] == SNDRV_AUTO_IRQ) {
gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs); gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs);
......
...@@ -191,8 +191,8 @@ static int snd_gusmax_match(struct device *pdev, unsigned int dev) ...@@ -191,8 +191,8 @@ static int snd_gusmax_match(struct device *pdev, unsigned int dev)
static int snd_gusmax_probe(struct device *pdev, unsigned int dev) static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
{ {
static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; static const int possible_dmas[] = {5, 6, 7, 1, 3, -1};
int xirq, xdma1, xdma2, err; int xirq, xdma1, xdma2, err;
struct snd_card *card; struct snd_card *card;
struct snd_gus_card *gus = NULL; struct snd_gus_card *gus = NULL;
...@@ -241,7 +241,7 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev) ...@@ -241,7 +241,7 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
pcm_channels[dev], pcm_channels[dev],
0, &gus); 0, &gus);
} else { } else {
static unsigned long possible_ports[] = { static const unsigned long possible_ports[] = {
0x220, 0x230, 0x240, 0x250, 0x260 0x220, 0x230, 0x240, 0x250, 0x260
}; };
int i; int i;
......
...@@ -364,7 +364,7 @@ struct rom_hdr { ...@@ -364,7 +364,7 @@ struct rom_hdr {
static void snd_interwave_detect_memory(struct snd_gus_card *gus) static void snd_interwave_detect_memory(struct snd_gus_card *gus)
{ {
static unsigned int lmc[13] = static const unsigned int lmc[13] =
{ {
0x00000001, 0x00000101, 0x01010101, 0x00000401, 0x00000001, 0x00000101, 0x01010101, 0x00000401,
0x04040401, 0x00040101, 0x04040101, 0x00000004, 0x04040401, 0x00040101, 0x04040101, 0x00000004,
...@@ -475,7 +475,7 @@ static void snd_interwave_init(int dev, struct snd_gus_card *gus) ...@@ -475,7 +475,7 @@ static void snd_interwave_init(int dev, struct snd_gus_card *gus)
} }
static struct snd_kcontrol_new snd_interwave_controls[] = { static const struct snd_kcontrol_new snd_interwave_controls[] = {
WSS_DOUBLE("Master Playback Switch", 0, WSS_DOUBLE("Master Playback Switch", 0,
CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1),
WSS_DOUBLE("Master Playback Volume", 0, WSS_DOUBLE("Master Playback Volume", 0,
...@@ -788,8 +788,8 @@ static int snd_interwave_isa_probe(struct device *pdev, ...@@ -788,8 +788,8 @@ static int snd_interwave_isa_probe(struct device *pdev,
unsigned int dev) unsigned int dev)
{ {
int err; int err;
static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; static const int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1};
if (irq[dev] == SNDRV_AUTO_IRQ) { if (irq[dev] == SNDRV_AUTO_IRQ) {
if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) {
...@@ -813,7 +813,7 @@ static int snd_interwave_isa_probe(struct device *pdev, ...@@ -813,7 +813,7 @@ static int snd_interwave_isa_probe(struct device *pdev,
if (port[dev] != SNDRV_AUTO_PORT) if (port[dev] != SNDRV_AUTO_PORT)
return snd_interwave_isa_probe1(dev, pdev); return snd_interwave_isa_probe1(dev, pdev);
else { else {
static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; static const long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260};
int i; int i;
for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { for (i = 0; i < ARRAY_SIZE(possible_ports); i++) {
port[dev] = possible_ports[i]; port[dev] = possible_ports[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment